<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 --- - PowerPC - bug in generation of @ha/@l pair for symbol+addend"
   href="https://llvm.org/bugs/show_bug.cgi?id=28727">28727</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>PowerPC - bug in generation of @ha/@l pair for symbol+addend
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.8
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>eric.schweitz@pgroup.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=16815" name="attach_16815" title="reduced bitcode file">attachment 16815</a> <a href="attachment.cgi?id=16815&action=edit" title="reduced bitcode file">[details]</a></span>
reduced bitcode file

When the attached example is assembled by llc, as in,

  % llc -O2 -disable-ppc-vsx-fma-mutation reduced.bc -o buggy.s

We can look at the high-adjusted and low relocation notations in the assembly
and see that some of the pairings do not match. In this partial list,

        addis 14, 2, z00cb@toc@ha
        lwa 4, z00cb@toc@l+8(14)
        stw 5, z00cb@toc@l+20(14)
        lwz 5, z00cb@toc@l+20(14)

we see that the high adjusted value of z00cb has no addend, but there are
several low subsequent notations that do have addends (of 8 and 20). This has
resulted in some hard to diagnose, hard to reproduce failures on OpenPOWER.

We believe, after reviewing "Power Architecture 64-Bit ELF V2 ABI
Specification", that this code-gen pattern is simply incorrect. The linker
cannot correctly generate a high adjusted value near a 16-bit boundary without
also knowing and accounting for all used addend values. Some may wrap and some
may not. Specifically then, the @ha and @l notations must be exactly paired.</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>