[llvm] r338673 - [AArch64] Add support for got relocated LDR's
David Green via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 1 23:24:40 PDT 2018
Author: dmgreen
Date: Wed Aug 1 23:24:40 2018
New Revision: 338673
URL: http://llvm.org/viewvc/llvm-project?rev=338673&view=rev
Log:
[AArch64] Add support for got relocated LDR's
As a part of adding the tiny codemodel, we need to support ldr's with :got:
relocations on them. This seems to be mostly already done, just needs the
relocation type support.
Differential Revision: https://reviews.llvm.org/D50137
Modified:
llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp
llvm/trunk/test/MC/AArch64/arm64-elf-relocs.s
llvm/trunk/test/MC/AArch64/elf-reloc-pcreladdressing.s
llvm/trunk/test/MC/AArch64/inline-asm-modifiers.s
Modified: llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp?rev=338673&r1=338672&r2=338673&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp Wed Aug 1 23:24:40 2018
@@ -169,6 +169,8 @@ unsigned AArch64ELFObjectWriter::getRelo
case AArch64::fixup_aarch64_ldr_pcrel_imm19:
if (SymLoc == AArch64MCExpr::VK_GOTTPREL)
return R_CLS(TLSIE_LD_GOTTPREL_PREL19);
+ if (SymLoc == AArch64MCExpr::VK_GOT)
+ return R_CLS(GOT_LD_PREL19);
return R_CLS(LD_PREL_LO19);
case AArch64::fixup_aarch64_pcrel_branch14:
return R_CLS(TSTBR14);
Modified: llvm/trunk/test/MC/AArch64/arm64-elf-relocs.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AArch64/arm64-elf-relocs.s?rev=338673&r1=338672&r2=338673&view=diff
==============================================================================
--- llvm/trunk/test/MC/AArch64/arm64-elf-relocs.s (original)
+++ llvm/trunk/test/MC/AArch64/arm64-elf-relocs.s Wed Aug 1 23:24:40 2018
@@ -269,3 +269,10 @@ trickQuestion:
// certainly be accepted when assembling.
add x3, x5, :lo12:imm
// CHECK: add x3, x5, :lo12:imm
+
+ ldr x24, #:got:sym
+ ldr d22, :got:sym
+// CHECK: ldr x24, :got:sym
+// CHECK: ldr d22, :got:sym
+// CHECK-OBJ-LP64: R_AARCH64_GOT_LD_PREL19 sym
+// CHECK-OBJ-LP64: R_AARCH64_GOT_LD_PREL19 sym
\ No newline at end of file
Modified: llvm/trunk/test/MC/AArch64/elf-reloc-pcreladdressing.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AArch64/elf-reloc-pcreladdressing.s?rev=338673&r1=338672&r2=338673&view=diff
==============================================================================
--- llvm/trunk/test/MC/AArch64/elf-reloc-pcreladdressing.s (original)
+++ llvm/trunk/test/MC/AArch64/elf-reloc-pcreladdressing.s Wed Aug 1 23:24:40 2018
@@ -7,11 +7,14 @@
adrp x5, :got:some_label
ldr x0, [x5, #:got_lo12:some_label]
+ ldr x0, :got:some_label
+
// OBJ: Relocations [
// OBJ-NEXT: Section {{.*}} .rela.text {
// OBJ-NEXT: 0x0 R_AARCH64_ADR_PREL_LO21 some_label 0x0
// OBJ-NEXT: 0x4 R_AARCH64_ADR_PREL_PG_HI21 some_label 0x0
// OBJ-NEXT: 0x8 R_AARCH64_ADR_GOT_PAGE some_label 0x0
// OBJ-NEXT: 0xC R_AARCH64_LD64_GOT_LO12_NC some_label 0x0
+// OBJ-NEXT: 0x10 R_AARCH64_GOT_LD_PREL19 some_label 0x0
// OBJ-NEXT: }
// OBJ-NEXT: ]
Modified: llvm/trunk/test/MC/AArch64/inline-asm-modifiers.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AArch64/inline-asm-modifiers.s?rev=338673&r1=338672&r2=338673&view=diff
==============================================================================
--- llvm/trunk/test/MC/AArch64/inline-asm-modifiers.s (original)
+++ llvm/trunk/test/MC/AArch64/inline-asm-modifiers.s Wed Aug 1 23:24:40 2018
@@ -68,6 +68,9 @@ test_inline_modifier_A:
//APP
adrp x0, :gottprel:var_tlsie
//NO_APP
+ //APP
+ ldr x0, :got:var_got
+ //NO_APP
ret
.Ltmp2:
.size test_inline_modifier_A, .Ltmp2-test_inline_modifier_A
@@ -75,6 +78,7 @@ test_inline_modifier_A:
// CHECK: R_AARCH64_ADR_GOT_PAGE var_got
// CHECK: R_AARCH64_TLSDESC_ADR_PAGE21 var_tlsgd
// CHECK: R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 var_tlsie
+// CHECK: R_AARCH64_GOT_LD_PREL19 var_got
.globl test_inline_modifier_wx
.type test_inline_modifier_wx, at function
More information about the llvm-commits
mailing list