[llvm-dev] [RFC] better link error messages

Hans Wennborg via llvm-dev llvm-dev at lists.llvm.org
Fri Mar 24 03:05:20 PDT 2017


On Thu, Mar 23, 2017 at 10:17 PM, Rui Ueyama via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> Folks,
>
> I'd like propose a new error message format for LLD so that error message
> for undefined or duplicated symbols are more informative and easy to read.
>
> Below are examples of the current error messages (note that characters in
> red are actually red on terminal):
>
> Undefined symbols
> /ssd/clang/bin/ld.lld: error: /ssd/llvm-project/lld/ELF/Writer.cpp:207:
> undefined symbol
> 'lld::elf::EhFrameSection<llvm::object::ELFType<(llvm::support::endianness)0,
> true> >::addSection(lld::elf::InputSectionBase*)'
>
> Conflicting symbols
> /ssd/clang/bin/ld.lld: error: /ssd/llvm-project/lld/ELF/Writer.cpp:38:
> duplicate symbol 'lld::elf::MipsGotSection::addEntry(lld::elf::SymbolBody&,
> long, lld::elf::RelExpr)'
> /ssd/clang/bin/ld.lld: error:
> /ssd/llvm-project/lld/ELF/SyntheticSections.cpp:673: previous definition was
> here
>
>
> For each error, we want to print out information about 1) symbol name, 2)
> source file name(s) and source location(s) if available and 3) source object
> file name(s) and archive file name(s) if available. Currently, these
> messages lack object file names, and I think the above error messages are a
> bit hard to grasp because too much information is packed into each line.
>
> I'm thinking of changing the format to something like the following:
>
> Undefined symbols
> /ssd/clang/bin/ld.lld: error: undefined symbol:
> lld::elf::EhFrameSection<llvm::object::ELFType<(llvm::support::endianness)0,
> true> >::addSection(lld::elf::InputSectionBase*)
>   Source: /ssd/llvm-project/lld/ELF/Writer.cpp:207
>   Object: lib/liblldELF.a(Writer.cpp.o)

There's a chance users can be confused about "source" here: it's not
the source code for the symbol, it's the source of the reference.
Maybe "Referenced by" would be better a wording.


More information about the llvm-dev mailing list