<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Copy relocation against protected symbol doesn't work"
   href="https://llvm.org/bugs/show_bug.cgi?id=23104">23104</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Copy relocation against protected symbol doesn't work
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>hjl.tools@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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]$</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>