<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Find the "best" order for local symbols"
   href="https://bugs.llvm.org/show_bug.cgi?id=36716">36716</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Find the "best" order for local symbols
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>ELF
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>rafael@espindo.la
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>There is an interesting discussion at <a href="mailto:generic-abi@googlegroups.com">generic-abi@googlegroups.com</a> about the
order of local symbols.

The ELF spec doesn't say anything about it, so we can try to figure out what is
the most convenient for linkers and consumers

Linking
----------------------------------
        .file "file1"
local1:
        .global hidden1
        .hidden hidden1
hidden1:
---------------------------------
And
---------------------------------
        .file "file2"
local2:
        .global hidden2
        .hidden hidden2
hidden2:
--------------------------------

The results are

lld: local1, local2, hidden1, hidden2
bfd: file1, corrupted file2?, hidden1, hidden2
gold: file1, local1, file2, local2, hidden1, hidden2

Gold's output has the advantage that one can map the original local symbols to
a file. The exception being that the hidden symbols show up as being from file2
(one can still check the visibility to tell the difference).

Two orders that might be ever better are

* hidden1, hidden2, file1, local2, file2, local2
* file1, local1, hidden1, file2, local2, hidden2

The first one has the advantage of making it easy to find out the file of local
symbols.

The second one has the advantage of specifying where the hidden symbols came
from.</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>