[lld] r270264 - Check pc relative relocations too.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri May 20 13:02:27 PDT 2016


Author: rafael
Date: Fri May 20 15:02:27 2016
New Revision: 270264

URL: http://llvm.org/viewvc/llvm-project?rev=270264&view=rev
Log:
Check pc relative relocations too.

Added:
    lld/trunk/test/ELF/x86-64-reloc-range.s
Modified:
    lld/trunk/ELF/Target.cpp

Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=270264&r1=270263&r2=270264&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Fri May 20 15:02:27 2016
@@ -714,6 +714,7 @@ void X86_64TargetInfo::relocateOne(uint8
   case R_X86_64_TLSLD:
   case R_X86_64_DTPOFF32:
   case R_X86_64_SIZE32:
+    checkInt<32>(Val, Type);
     write32le(Loc, Val);
     break;
   default:

Added: lld/trunk/test/ELF/x86-64-reloc-range.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/x86-64-reloc-range.s?rev=270264&view=auto
==============================================================================
--- lld/trunk/test/ELF/x86-64-reloc-range.s (added)
+++ lld/trunk/test/ELF/x86-64-reloc-range.s Fri May 20 15:02:27 2016
@@ -0,0 +1,13 @@
+// RUN: llvm-mc %s -o %t.o -triple x86_64-pc-linux -filetype=obj
+// RUN: not ld.lld %t.o -o %t.so -shared 2>&1 | FileCheck %s
+
+// CHECK: relocation R_X86_64_PC32 out of range
+// CHECK-NOT: relocation
+
+        lea     foo(%rip), %rax
+        lea     foo(%rip), %rax
+
+        .hidden foo
+        .bss
+        .zero 0x7fffe007
+foo:




More information about the llvm-commits mailing list