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: unassignedb...@nondot.org
          Reporter: i...@maskray.me
                CC: llvm-bugs@lists.llvm.org, smithp...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to