Mark R_AARCH64_PREL32 as relative.
authorRafael Espindola <rafael.espindola@gmail.com>
Wed, 24 Feb 2016 16:15:13 +0000 (16:15 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Wed, 24 Feb 2016 16:15:13 +0000 (16:15 +0000)
llvm-svn: 261747

lld/ELF/Target.cpp
lld/test/ELF/aarch64-relative.s [new file with mode: 0644]

index a2a609c..ef8ddcc 100644 (file)
@@ -1209,7 +1209,9 @@ AArch64TargetInfo::AArch64TargetInfo() {
   PltZeroSize = 32;
 }
 
-bool AArch64TargetInfo::isRelRelative(uint32_t Type) const { return false; }
+bool AArch64TargetInfo::isRelRelative(uint32_t Type) const {
+  return Type == R_AARCH64_PREL32;
+}
 
 bool AArch64TargetInfo::isTlsGlobalDynamicRel(unsigned Type) const {
   return Type == R_AARCH64_TLSDESC_ADR_PAGE21 ||
diff --git a/lld/test/ELF/aarch64-relative.s b/lld/test/ELF/aarch64-relative.s
new file mode 100644 (file)
index 0000000..9ffd6a8
--- /dev/null
@@ -0,0 +1,11 @@
+// REQUIRES: aarch64
+// RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-freebsd %s -o %t.o
+// RUN: ld.lld %t.o -o %t.so -shared
+// RUN: llvm-readobj -r %t.so | FileCheck %s
+
+        .Lfoo:
+        .rodata
+        .long .Lfoo - .
+
+// CHECK:      Relocations [
+// CHECK-NEXT: ]