[RISCV] Remove -riscv-asm-relax-branches flag (#142855)
This flag has been superseded by `.option exact`, as the test updates show. Given the flag was always hidden, it makes sense to me to remove it, and move tests that required it to use `.option exact`.
This commit is contained in:
parent
70e78be7dc
commit
65077c7ac7
@ -1,7 +1,7 @@
|
|||||||
# REQUIRES: riscv
|
# REQUIRES: riscv
|
||||||
|
|
||||||
# RUN: llvm-mc -filetype=obj -triple=riscv32-unknown-elf -mattr=-relax -riscv-asm-relax-branches=0 %s -o %t.rv32.o
|
# RUN: llvm-mc -filetype=obj -triple=riscv32-unknown-elf %s -o %t.rv32.o
|
||||||
# RUN: llvm-mc -filetype=obj -triple=riscv64-unknown-elf -mattr=-relax -riscv-asm-relax-branches=0 %s -o %t.rv64.o
|
# RUN: llvm-mc -filetype=obj -triple=riscv64-unknown-elf %s -o %t.rv64.o
|
||||||
|
|
||||||
# RUN: ld.lld %t.rv32.o --defsym foo=_start+4 --defsym bar=_start -o %t.rv32
|
# RUN: ld.lld %t.rv32.o --defsym foo=_start+4 --defsym bar=_start -o %t.rv32
|
||||||
# RUN: ld.lld %t.rv64.o --defsym foo=_start+4 --defsym bar=_start -o %t.rv64
|
# RUN: ld.lld %t.rv64.o --defsym foo=_start+4 --defsym bar=_start -o %t.rv64
|
||||||
@ -30,6 +30,8 @@
|
|||||||
# RUN: not ld.lld %t.rv64.o --defsym foo=_start+1 --defsym bar=_start-1 -o /dev/null 2>&1 | FileCheck --check-prefix=ERROR-ALIGN %s
|
# RUN: not ld.lld %t.rv64.o --defsym foo=_start+1 --defsym bar=_start-1 -o /dev/null 2>&1 | FileCheck --check-prefix=ERROR-ALIGN %s
|
||||||
# ERROR-ALIGN: improper alignment for relocation R_RISCV_BRANCH: 0x1 is not aligned to 2 bytes
|
# ERROR-ALIGN: improper alignment for relocation R_RISCV_BRANCH: 0x1 is not aligned to 2 bytes
|
||||||
|
|
||||||
|
.option exact
|
||||||
|
|
||||||
.global _start
|
.global _start
|
||||||
_start:
|
_start:
|
||||||
beq x0, x0, foo
|
beq x0, x0, foo
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# REQUIRES: riscv
|
# REQUIRES: riscv
|
||||||
# RUN: llvm-mc -filetype=obj -triple=riscv64 /dev/null -o %t2.o
|
# RUN: llvm-mc -filetype=obj -triple=riscv64 /dev/null -o %t2.o
|
||||||
# RUN: ld.lld -shared -soname=t2 %t2.o -o %t2.so
|
# RUN: ld.lld -shared -soname=t2 %t2.o -o %t2.so
|
||||||
# RUN: llvm-mc -filetype=obj -triple=riscv64 -riscv-asm-relax-branches=0 %s -o %t.o
|
# RUN: llvm-mc -filetype=obj -triple=riscv64 %s -o %t.o
|
||||||
# RUN: llvm-readobj -r %t.o | FileCheck --check-prefix=RELOC %s
|
# RUN: llvm-readobj -r %t.o | FileCheck --check-prefix=RELOC %s
|
||||||
|
|
||||||
# RUN: ld.lld -e absolute %t.o -o %t
|
# RUN: ld.lld -e absolute %t.o -o %t
|
||||||
@ -12,6 +12,8 @@
|
|||||||
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefixes=CHECK,PLT %s
|
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefixes=CHECK,PLT %s
|
||||||
# RUN: llvm-readelf -x .data %t | FileCheck --check-prefixes=HEX,HEX-WITH-PLT %s
|
# RUN: llvm-readelf -x .data %t | FileCheck --check-prefixes=HEX,HEX-WITH-PLT %s
|
||||||
|
|
||||||
|
.option exact
|
||||||
|
|
||||||
.weak target
|
.weak target
|
||||||
.global absolute, relative, branch
|
.global absolute, relative, branch
|
||||||
|
|
||||||
|
@ -27,8 +27,6 @@
|
|||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
static cl::opt<bool> RelaxBranches("riscv-asm-relax-branches", cl::init(true),
|
|
||||||
cl::Hidden);
|
|
||||||
// Temporary workaround for old linkers that do not support ULEB128 relocations,
|
// Temporary workaround for old linkers that do not support ULEB128 relocations,
|
||||||
// which are abused by DWARF v5 DW_LLE_offset_pair/DW_RLE_offset_pair
|
// which are abused by DWARF v5 DW_LLE_offset_pair/DW_RLE_offset_pair
|
||||||
// implemented in Clang/LLVM.
|
// implemented in Clang/LLVM.
|
||||||
@ -110,9 +108,6 @@ bool RISCVAsmBackend::fixupNeedsRelaxationAdvanced(const MCFixup &Fixup,
|
|||||||
const MCValue &,
|
const MCValue &,
|
||||||
uint64_t Value,
|
uint64_t Value,
|
||||||
bool Resolved) const {
|
bool Resolved) const {
|
||||||
if (!RelaxBranches)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
int64_t Offset = int64_t(Value);
|
int64_t Offset = int64_t(Value);
|
||||||
unsigned Kind = Fixup.getTargetKind();
|
unsigned Kind = Fixup.getTargetKind();
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# RUN: rm -rf %t && mkdir -p %t
|
# RUN: rm -rf %t && mkdir -p %t
|
||||||
# RUN: llvm-mc -triple=riscv64 -filetype=obj -riscv-asm-relax-branches=0 \
|
# RUN: llvm-mc -triple=riscv64 -filetype=obj \
|
||||||
# RUN: -o %t/elf_riscv64_branch.o %s
|
# RUN: -o %t/elf_riscv64_branch.o %s
|
||||||
# RUN: llvm-mc -triple=riscv32 -filetype=obj -riscv-asm-relax-branches=0 \
|
# RUN: llvm-mc -triple=riscv32 -filetype=obj \
|
||||||
# RUN: -o %t/elf_riscv32_branch.o %s
|
# RUN: -o %t/elf_riscv32_branch.o %s
|
||||||
# RUN: llvm-jitlink -noexec \
|
# RUN: llvm-jitlink -noexec \
|
||||||
# RUN: -slab-allocate 100Kb -slab-address 0xfff00ff4 -slab-page-size 4096 \
|
# RUN: -slab-allocate 100Kb -slab-address 0xfff00ff4 -slab-page-size 4096 \
|
||||||
@ -13,6 +13,8 @@
|
|||||||
# RUN: -check %s %t/elf_riscv32_branch.o
|
# RUN: -check %s %t/elf_riscv32_branch.o
|
||||||
#
|
#
|
||||||
|
|
||||||
|
.option exact
|
||||||
|
|
||||||
.text
|
.text
|
||||||
# Empty main entry point.
|
# Empty main entry point.
|
||||||
.globl main
|
.globl main
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
## Test that long branches are not relaxed with -riscv-asm-relax-branches=0
|
## Test that long branches are not relaxed with .option exact
|
||||||
# RUN: split-file %s %t
|
# RUN: split-file %s %t
|
||||||
# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+c \
|
# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+c \
|
||||||
# RUN: -riscv-asm-relax-branches=0 %t/pass.s \
|
# RUN: %t/pass.s \
|
||||||
# RUN: | llvm-objdump -dr -M no-aliases - \
|
# RUN: | llvm-objdump -dr -M no-aliases - \
|
||||||
# RUN: | FileCheck %t/pass.s
|
# RUN: | FileCheck %t/pass.s
|
||||||
# RUN: not llvm-mc -filetype=obj -triple=riscv64 -mattr=+c -o /dev/null \
|
# RUN: not llvm-mc -filetype=obj -triple=riscv64 -mattr=+c -o /dev/null \
|
||||||
# RUN: -riscv-asm-relax-branches=0 %t/fail.s 2>&1 \
|
# RUN: %t/fail.s 2>&1 \
|
||||||
# RUN: | FileCheck %t/fail.s
|
# RUN: | FileCheck %t/fail.s
|
||||||
|
|
||||||
#--- pass.s
|
#--- pass.s
|
||||||
|
.option exact
|
||||||
|
|
||||||
.text
|
.text
|
||||||
test_undefined:
|
test_undefined:
|
||||||
## Branches to undefined symbols should not be relaxed
|
## Branches to undefined symbols should not be relaxed
|
||||||
@ -33,6 +35,8 @@ test_defined_in_range:
|
|||||||
bar:
|
bar:
|
||||||
|
|
||||||
#--- fail.s
|
#--- fail.s
|
||||||
|
.option exact
|
||||||
|
|
||||||
.text
|
.text
|
||||||
## Branches to defined out-of-range symbols should report an error
|
## Branches to defined out-of-range symbols should report an error
|
||||||
test_defined_out_of_range:
|
test_defined_out_of_range:
|
Loading…
x
Reference in New Issue
Block a user