[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

llvm-svn: 272379
This commit is contained in:
George Rimar 2016-06-10 08:15:12 +00:00
parent b9e6487e76
commit 0a2f19701e
2 changed files with 4 additions and 2 deletions

View File

@ -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

View File

@ -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