[lld] r252415 - [ELF2/AArch64] Support R_AARCH64_LDST64_ABS_LO12_NC relocation.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 7 20:45:27 PST 2015


Author: davide
Date: Sat Nov  7 22:45:26 2015
New Revision: 252415

URL: http://llvm.org/viewvc/llvm-project?rev=252415&view=rev
Log:
[ELF2/AArch64] Support R_AARCH64_LDST64_ABS_LO12_NC relocation.


Modified:
    lld/trunk/ELF/Target.cpp
    lld/trunk/test/elf2/aarch64-relocs.s

Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=252415&r1=252414&r2=252415&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Sat Nov  7 22:45:26 2015
@@ -660,6 +660,10 @@ void AArch64TargetInfo::relocateOne(uint
     updateAArch64Adr(Loc, (X >> 12) & 0x1FFFFF); // X[32:12]
     break;
   }
+  case R_AARCH64_LDST64_ABS_LO12_NC:
+    // No overflow check needed.
+    or32le(Loc, (SA & 0xFF8) << 7);
+    break;
   case R_AARCH64_PREL16:
     if (!isInt<16>(SA))
       error("Relocation R_AARCH64_PREL16 out of range");

Modified: lld/trunk/test/elf2/aarch64-relocs.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/aarch64-relocs.s?rev=252415&r1=252414&r2=252415&view=diff
==============================================================================
--- lld/trunk/test/elf2/aarch64-relocs.s (original)
+++ lld/trunk/test/elf2/aarch64-relocs.s Sat Nov  7 22:45:26 2015
@@ -44,3 +44,16 @@ mystr:
 # CHECK: Disassembly of section .R_AARCH64_ADD_ABS_LO12_NC:
 # CHECK-NEXT: $x.4:
 # CHECK-NEXT:   1101b:       00 7c 00 91     add     x0, x0, #31
+
+.section .R_AARCH64_LDST64_ABS_LO12_NC,"ax", at progbits
+  ldr x28, [x27, :lo12:foo]
+foo:
+  .asciz "foo"
+  .size mystr, 3
+
+# S = 0x11024, A = 0x4
+# R = ((S + A) & 0xFFF) << 7 = 0x00001400
+# 0x00001400 | 0xf940177c = 0xf940177c
+# CHECK: Disassembly of section .R_AARCH64_LDST64_ABS_LO12_NC:
+# CHECK-NEXT: $x.6:
+# CHECK-NEXT:   11024:       7c 17 40 f9     ldr     x28, [x27, #40]




More information about the llvm-commits mailing list