[lld] r253714 - [ELF/AArch64] Add support for LDST8_ABS_LO12_NC/LDST64_ABS_LO12_NC.
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 20 13:35:38 PST 2015
Author: davide
Date: Fri Nov 20 15:35:38 2015
New Revision: 253714
URL: http://llvm.org/viewvc/llvm-project?rev=253714&view=rev
Log:
[ELF/AArch64] Add support for LDST8_ABS_LO12_NC/LDST64_ABS_LO12_NC.
These two relocations where the only missing step to get a dynamically
linked (with libc) "hello world" on FreeBSD.
Modified:
lld/trunk/ELF/Target.cpp
lld/trunk/test/ELF/aarch64-relocs.s
Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=253714&r1=253713&r2=253714&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Fri Nov 20 15:35:38 2015
@@ -742,10 +742,18 @@ void AArch64TargetInfo::relocateOne(uint
or32le(Loc, (X & 0x0FFFFFFC) >> 2);
break;
}
+ case R_AARCH64_LDST32_ABS_LO12_NC:
+ // No overflow check needed.
+ or32le(Loc, (SA & 0xFFC) << 8);
+ break;
case R_AARCH64_LDST64_ABS_LO12_NC:
// No overflow check needed.
or32le(Loc, (SA & 0xFF8) << 7);
break;
+ case R_AARCH64_LDST8_ABS_LO12_NC:
+ // No overflow check needed.
+ or32le(Loc, (SA & 0xFFF) << 10);
+ break;
case R_AARCH64_PREL16:
if (!isInt<16>(SA))
error("Relocation R_AARCH64_PREL16 out of range");
Modified: lld/trunk/test/ELF/aarch64-relocs.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/aarch64-relocs.s?rev=253714&r1=253713&r2=253714&view=diff
==============================================================================
--- lld/trunk/test/ELF/aarch64-relocs.s (original)
+++ lld/trunk/test/ELF/aarch64-relocs.s Fri Nov 20 15:35:38 2015
@@ -92,3 +92,31 @@ jump26:
# CHECK: Disassembly of section .R_AARCH64_JUMP26:
# CHECK-NEXT: jump26:
# CHECK-NEXT: 11038: fe ff ff 17 b #-8
+
+.section .R_AARCH64_LDST32_ABS_LO12_NC,"ax", at progbits
+ldst32:
+ ldr s4, [x5, :lo12:foo32]
+foo32:
+ .asciz "foo"
+ .size mystr, 3
+
+# S = 0x1103c, A = 0x4
+# R = ((S + A) & 0xFFC) << 8 = 0x00004000
+# 0x00004000 | 0xbd4000a4 = 0xbd4040a4
+# CHECK: Disassembly of section .R_AARCH64_LDST32_ABS_LO12_NC:
+# CHECK-NEXT: ldst32:
+# CHECK-NEXT: 1103c: a4 40 40 bd ldr s4, [x5, #64]
+
+.section .R_AARCH64_LDST8_ABS_LO12_NC,"ax", at progbits
+ldst8:
+ ldrsb x11, [x13, :lo12:foo8]
+foo8:
+ .asciz "foo"
+ .size mystr, 3
+
+# S = 0x11044, A = 0x4
+# R = ((S + A) & 0xFFF) << 10 = 0x00012000
+# 0x00012000 | 0x398001ab = 0x398121ab
+# CHECK: Disassembly of section .R_AARCH64_LDST8_ABS_LO12_NC:
+# CHECK-NEXT: ldst8:
+# CHECK-NEXT: 11044: ab 21 81 39 ldrsb x11, [x13, #72]
More information about the llvm-commits
mailing list