[lld] r272379 - [ELF] - Properly check that R_X86_64_PC32 and R_X86_64_32 relocations are disallowed in DSO.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 10 01:15:13 PDT 2016


Author: grimar
Date: Fri Jun 10 03:15:12 2016
New Revision: 272379

URL: http://llvm.org/viewvc/llvm-project?rev=272379&view=rev
Log:
[ELF] - Properly check that R_X86_64_PC32 and R_X86_64_32 relocations are disallowed in DSO.

Initially we wanted to check that these two relocations are not present when linking DSO because of 
possible overflow in runtime. Patch moves them to writable segment in testcases to allow
proper error check to trigger.
Otherwise error message about using dynamic relocations against text segment was shown.

Differential revision: http://reviews.llvm.org/D21184

Modified:
    lld/trunk/test/ELF/x86-64-reloc-32-fpic.s
    lld/trunk/test/ELF/x86-64-reloc-pc32-fpic.s

Modified: lld/trunk/test/ELF/x86-64-reloc-32-fpic.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/x86-64-reloc-32-fpic.s?rev=272379&r1=272378&r2=272379&view=diff
==============================================================================
--- lld/trunk/test/ELF/x86-64-reloc-32-fpic.s (original)
+++ lld/trunk/test/ELF/x86-64-reloc-32-fpic.s Fri Jun 10 03:15:12 2016
@@ -1,6 +1,7 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
 # RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s
-# CHECK: can't create dynamic relocation R_X86_64_32 against readonly segment
+# CHECK: relocation R_X86_64_32 cannot be used when making a shared object; recompile with -fPIC.
 
+.data
 .long _shared

Modified: lld/trunk/test/ELF/x86-64-reloc-pc32-fpic.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/x86-64-reloc-pc32-fpic.s?rev=272379&r1=272378&r2=272379&view=diff
==============================================================================
--- lld/trunk/test/ELF/x86-64-reloc-pc32-fpic.s (original)
+++ lld/trunk/test/ELF/x86-64-reloc-pc32-fpic.s Fri Jun 10 03:15:12 2016
@@ -1,6 +1,7 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
 # RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s
-# CHECK: can't create dynamic relocation R_X86_64_PC32 against readonly segment
+# CHECK: relocation R_X86_64_PC32 cannot be used when making a shared object; recompile with -fPIC.
 
+.data
 call _shared




More information about the llvm-commits mailing list