Page MenuHomePhabricator

Change the error message format for undefined symbols.

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



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

Diff Detail


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
83 ↗(On Diff #93417)

Maybe factor these 3 lines into a small helper method?

264 ↗(On Diff #93417)

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
83 ↗(On Diff #93417)


264 ↗(On Diff #93417)

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.

623 ↗(On Diff #93509)

Obj is never empty, is it?

624 ↗(On Diff #93509)

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
623 ↗(On Diff #93509)

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

This revision was automatically updated to reflect the committed changes.