forked from OSchip/llvm-project
[MC][RISCV] Support .reloc *, BFD_RELOC_{NONE,32,64}, *
BFD_RELOC_NONE is useful for ld --gc-sections: it provides a generic way indicating a dependency between two sections.
This commit is contained in:
parent
59ff9315fd
commit
2d922de3af
|
|
@ -30,6 +30,9 @@ Optional<MCFixupKind> RISCVAsmBackend::getFixupKind(StringRef Name) const {
|
|||
#define ELF_RELOC(X, Y) .Case(#X, Y)
|
||||
#include "llvm/BinaryFormat/ELFRelocs/RISCV.def"
|
||||
#undef ELF_RELOC
|
||||
.Case("BFD_RELOC_NONE", ELF::R_RISCV_NONE)
|
||||
.Case("BFD_RELOC_32", ELF::R_RISCV_32)
|
||||
.Case("BFD_RELOC_64", ELF::R_RISCV_64)
|
||||
.Default(-1u);
|
||||
if (Type != -1u)
|
||||
return static_cast<MCFixupKind>(FirstLiteralRelocationKind + Type);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@
|
|||
# PRINT: .reloc 0, R_RISCV_32, .data+2
|
||||
# PRINT: .reloc 0, R_RISCV_SET32, foo+3
|
||||
# PRINT: .reloc 0, R_RISCV_32_PCREL, 5
|
||||
# PRINT: .reloc 0, BFD_RELOC_NONE, 9
|
||||
# PRINT-NEXT: .reloc 0, BFD_RELOC_32, 9
|
||||
# PRINT-NEXT: .reloc 0, BFD_RELOC_64, 9
|
||||
|
||||
# CHECK: 0x8 R_RISCV_NONE .data 0x0
|
||||
# CHECK-NEXT: 0x4 R_RISCV_NONE foo 0x4
|
||||
|
|
@ -16,6 +19,9 @@
|
|||
# CHECK-NEXT: 0x0 R_RISCV_32 .data 0x2
|
||||
# CHECK-NEXT: 0x0 R_RISCV_SET32 foo 0x3
|
||||
# CHECK-NEXT: 0x0 R_RISCV_32_PCREL - 0x5
|
||||
# CHECK-NEXT: 0x0 R_RISCV_NONE - 0x9
|
||||
# CHECK-NEXT: 0x0 R_RISCV_32 - 0x9
|
||||
# CHECK-NEXT: 0x0 R_RISCV_64 - 0x9
|
||||
.text
|
||||
ret
|
||||
nop
|
||||
|
|
@ -28,6 +34,10 @@
|
|||
.reloc 0, R_RISCV_SET32, foo+3
|
||||
.reloc 0, R_RISCV_32_PCREL, 5
|
||||
|
||||
.reloc 0, BFD_RELOC_NONE, 9
|
||||
.reloc 0, BFD_RELOC_32, 9
|
||||
.reloc 0, BFD_RELOC_64, 9
|
||||
|
||||
.data
|
||||
.globl foo
|
||||
foo:
|
||||
|
|
|
|||
Loading…
Reference in New Issue