[llvm-bugs] [Bug 36716] New: Find the "best" order for local symbols

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Mar 13 16:31:46 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=36716

            Bug ID: 36716
           Summary: Find the "best" order for local symbols
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: rafael at espindo.la
                CC: llvm-bugs at lists.llvm.org

There is an interesting discussion at generic-abi at googlegroups.com 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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180313/54081a7f/attachment.html>


More information about the llvm-bugs mailing list