This is an archive of the discontinued LLVM Phabricator instance.

Change the error message format for undefined symbols.
ClosedPublic

Authored by ruiu on Mar 29 2017, 3:27 PM.

Details

Summary

Previously, undefined symbol errors are one line like this
and wasn't easy to read.

/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*)'

This patch make it more structured like this.

bin/ld.lld: error: undefined symbol: lld::elf::EhFrameSection<llvm::object::ELFType<(llvm::support::endianness)0, true>
>>> Referenced by Writer.cpp:207 (/ssd/llvm-project/lld/ELF/Writer.cpp:207)
>>>               Writer.cpp.o in archive lib/liblldELF.a

Discussion thread is
http://lists.llvm.org/pipermail/llvm-dev/2017-March/111459.html

Event Timeline

ruiu created this revision.Mar 29 2017, 3:27 PM
emaste added a subscriber: emaste.Mar 29 2017, 6:28 PM
rafael added inline comments.Mar 30 2017, 10:52 AM
lld/ELF/Error.cpp
83

Maybe factor these 3 lines into a small helper method?

lld/ELF/InputSection.cpp
264

Why does it have to be a function? Don't we want the same drag when, for example, a vtable has an undefined reference?

ruiu updated this revision to Diff 93509.Mar 30 2017, 11:23 AM
  • Address review comments.
ruiu added inline comments.Mar 30 2017, 11:24 AM
lld/ELF/Error.cpp
83

Done.

lld/ELF/InputSection.cpp
264

The current code does this too, but there's probably no strong reason to do this only for functions, so I made this to find any symbol that encloses a given location.

rafael accepted this revision.Mar 30 2017, 12:17 PM

LGTM with a nit.

lld/ELF/Relocations.cpp
622

Obj is never empty, is it?

623

If Obj is never empty you can factor

Msg += "\n>>> referenced by "

before the if/else if chain.

This revision is now accepted and ready to land.Mar 30 2017, 12:17 PM
ruiu added inline comments.Mar 30 2017, 12:18 PM
lld/ELF/Relocations.cpp
622

If it is a synthetic section, it can be null, I think.

This revision was automatically updated to reflect the committed changes.