[PATCH] D68975: [LLD] [COFF] Try to report source locations for duplicate symbols
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 15 02:40:36 PDT 2019
mstorsjo created this revision.
mstorsjo added reviewers: ruiu, rnk, MaskRay.
Herald added a subscriber: aprantl.
Herald added a project: LLVM.
This fixes the second part of PR42407.
The message is designed to match what the ELF linker prints, and the message for undefined references.
One part of the message is the name of the symbol where the duplicate occured, which is redundant, as that's printed as the original root issue anyway (but the ELF linker does it similarly).
For files with dwarf debug info, it manually loads and iterates .debug_info to find the declared location of variables, to allow reporting them. (This matches the corresponding code in the ELF linker. This code perhaps even could be shared somewhere in lld/Common?)
For functions, it uses the existing getFileLineDwarf which uses LLVMSymbolizer for translating addresses to file lines.
In object files with codeview debug info, only the source location of duplicate functions is printed. (And even there, only for the first input file. The getFileLineCodeView function requires the object file to be fully loaded and initialized to properly resolve source locations, but duplicate symbols are reported at a stage when the second object file isn't fully loaded yet.)
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D68975
Files:
lld/COFF/InputFiles.cpp
lld/COFF/InputFiles.h
lld/COFF/SymbolTable.cpp
lld/COFF/SymbolTable.h
lld/test/COFF/conflict-mangled.test
lld/test/COFF/conflict.test
lld/test/COFF/duplicate-cv.s
lld/test/COFF/duplicate-dwarf.s
lld/test/COFF/duplicate.test
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68975.224978.patch
Type: text/x-patch
Size: 24569 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191015/2f0d872b/attachment.bin>
More information about the llvm-commits
mailing list