1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[MC][AArch64] Support .reloc *, BFD_RELOC_{NONE,16,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:
Fangrui Song 2021-03-05 21:17:31 -08:00
parent d0c3033896
commit c0f3b9dd4e
2 changed files with 17 additions and 0 deletions

View File

@ -342,6 +342,10 @@ Optional<MCFixupKind> AArch64AsmBackend::getFixupKind(StringRef Name) const {
#define ELF_RELOC(X, Y) .Case(#X, Y)
#include "llvm/BinaryFormat/ELFRelocs/AArch64.def"
#undef ELF_RELOC
.Case("BFD_RELOC_NONE", ELF::R_AARCH64_NONE)
.Case("BFD_RELOC_16", ELF::R_AARCH64_ABS16)
.Case("BFD_RELOC_32", ELF::R_AARCH64_ABS32)
.Case("BFD_RELOC_64", ELF::R_AARCH64_ABS64)
.Default(-1u);
if (Type == -1u)
return None;

View File

@ -8,6 +8,10 @@
# PRINT: .reloc 0, R_AARCH64_ABS64, .data+2
# PRINT: .reloc 0, R_AARCH64_TLSDESC, foo+3
# PRINT: .reloc 0, R_AARCH64_IRELATIVE, 5
# PRINT: .reloc 0, BFD_RELOC_NONE, 9
# PRINT: .reloc 0, BFD_RELOC_16, 9
# PRINT: .reloc 0, BFD_RELOC_32, 9
# PRINT: .reloc 0, BFD_RELOC_64, 9
.text
ret
nop
@ -20,6 +24,11 @@
.reloc 0, R_AARCH64_TLSDESC, foo+3
.reloc 0, R_AARCH64_IRELATIVE, 5
.reloc 0, BFD_RELOC_NONE, 9
.reloc 0, BFD_RELOC_16, 9
.reloc 0, BFD_RELOC_32, 9
.reloc 0, BFD_RELOC_64, 9
.data
.globl foo
foo:
@ -33,3 +42,7 @@ foo:
# CHECK-NEXT: 0x0 R_AARCH64_ABS64 .data 0x2
# CHECK-NEXT: 0x0 R_AARCH64_TLSDESC foo 0x3
# CHECK-NEXT: 0x0 R_AARCH64_IRELATIVE - 0x5
# CHECK-NEXT: 0x0 R_AARCH64_NONE - 0x9
# CHECK-NEXT: 0x0 R_AARCH64_ABS16 - 0x9
# CHECK-NEXT: 0x0 R_AARCH64_ABS32 - 0x9
# CHECK-NEXT: 0x0 R_AARCH64_ABS64 - 0x9