[llvm-bugs] [Bug 48023] New: Should LLD synthesize STT_FILE symbols when copying local symbols?

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Oct 30 11:28:00 PDT 2020


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

            Bug ID: 48023
           Summary: Should LLD synthesize STT_FILE symbols when copying
                    local symbols?
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: i at maskray.me
                CC: llvm-bugs at lists.llvm.org, smithp352 at googlemail.com

The ELF spec says

> STT_FILE - Conventionally, the symbol's name gives the name of the source file associated with the object file. A file symbol has STB_LOCAL binding, its section index is SHN_ABS, and it precedes the other STB_LOCAL symbols for the file, if it is present.

If an object file has STB_LOCAL non-STT_SECTION symbols like (ARM $a). LLD
copies them to the output which may be attributed to the previous file (with
STT_FILE).

If we synthesize a STB_LOCAL STT_FILE SHN_ABS symbol, we can resolve this
problem.
However, this behavior can be inconvenient in some cases.

The compiler passes the absolute paths of files like crti.o crtn.o to ld.bfd,
so ld.bfd will synthesize STT_FILE symbols with absolute paths.

If the user wants to pursue "Local determinism: Like incremental basic
determinism, but builds are also independent of the name of the build
directory"
(https://blog.llvm.org/2019/11/deterministic-builds-with-clang-and-lld.html),
the absolute path can actually get in the way.

-- 
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/20201030/8c0d2778/attachment.html>


More information about the llvm-bugs mailing list