[LLVMbugs] [Bug 23104] New: Copy relocation against protected symbol doesn't work

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Apr 1 17:13:36 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23104

            Bug ID: 23104
           Summary: Copy relocation against protected symbol doesn't work
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: hjl.tools at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Protected data symbol means that it can't be preempted.  It doesn't mean
its address won't be external.  This is true for pointer to protected
function.  With copy relocation, address of protected data defined in the
shared library may also be external.  We only know that for sure at
run-time.  On Linux/x86-64, with linker from binutils master branch:

[hjl at gnu-6 pr65248]$ cat bar.c 
int a;

__attribute__((visibility("protected"))) int a;

void
bar ()
{
  a = 30;
}
[hjl at gnu-6 pr65248]$ make
CC=/export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang libbar.so
/export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang -O3 -fpic    -c -o
bar.o bar.c
/export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang  -shared -o libbar.so
bar.o
/usr/local/bin/ld: bar.o: relocation R_X86_64_PC32 against protected symbol `a'
can not be used when making a shared object
/usr/local/bin/ld: final link failed: Bad value
clang-3.7: error: linker command failed with exit code 1 (use -v to see
invocation)
make: *** [libbar.so] Error 1
[hjl at gnu-6 pr65248]$

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150402/fe9faf8c/attachment.html>


More information about the llvm-bugs mailing list