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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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@gnu-6 pr65248]$ cat bar.c 
int a;

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

void
bar ()
{
  a = 30;
}
[hjl@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@gnu-6 pr65248]$

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to