<html>
    <head>
      <base href="http://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 --- - powerpc64le integrated assembler doesn't set correct st_other bits on destructor symbols"
   href="http://llvm.org/bugs/show_bug.cgi?id=21652">21652</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>powerpc64le integrated assembler doesn't set correct st_other bits on destructor symbols
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

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

        <tr>
          <th>Hardware</th>
          <td>Other
          </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>Backend: PowerPC
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jay.foad@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>When I build the address sanitizer unit tests on powerpc64le Linux, I see this
oddness in one of the object files:

$ objdump -x
projects/compiler-rt/lib/asan/tests/ASAN_NOINST_TEST_OBJECTS.gtest-all.cc.powerpc64le-inline.o
| grep " _ZN7testing8internal2RED.Ev"
0000000000000000 g     F .text._ZN7testing8internal2RED2Ev    0000000000000080
_ZN7testing8internal2RED1Ev
0000000000000000 g     F .text._ZN7testing8internal2RED2Ev    0000000000000080
0x60 _ZN7testing8internal2RED2Ev

These two symbols are at the same address, but have different st_other bits.
These st_other bits tell you how to find the function's local entry point; 0x60
means that it's two instructions past the global entry point.

If you link this .o file with ld.bfd then the difference seems harmless, but if
you link with ld.gold then you get real problems: a local call to
_ZN7testing8internal2RED1Ev turns into a bl to the *global* entry point, but
r12 isn't set up properly. The causes the resulting executable
"Asan-powerpc64le-inline-Noinst-Test" to segfault.

A workaround is to compile with -no-integrated-as. Then both symbols get the
same st_other bits:

0000000000000000 g     F .text._ZN7testing8internal2RED2Ev    0000000000000080
0x60 _ZN7testing8internal2RED2Ev
0000000000000000 g     F .text._ZN7testing8internal2RED2Ev    0000000000000080
0x60 _ZN7testing8internal2RED1Ev</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>