This is an archive of the discontinued LLVM Phabricator instance.

Use debug info to print out the first line of symbol conflict message.
Needs ReviewPublic

Authored by ruiu on Nov 8 2016, 12:55 PM.

Details

Reviewers
evgeny777
Summary

If there is a symbol conflict, we will print out an error message like this.

foo.o (.text+0x100): duplicate symbol 'foobar'
bar.o (.text+0x250): previous definition was here

We pass three arguments to reportDuplciate function, namely, the existing
symbol, the new conflicting symbol's section, and the offset of the new symbol.
If the existing is not a regular symbol, we fall back to a less user-friendly
message.

I found that we don't need the existing symbol to print out the first line of
the error message, so that error check was too strict. This patch simplifies
the function and relaxed the restriction.

Event Timeline

ruiu updated this revision to Diff 77244.Nov 8 2016, 12:55 PM
ruiu retitled this revision from to Use debug info to print out the first line of symbol conflict message..
ruiu updated this object.
ruiu added a reviewer: evgeny777.
ruiu added a subscriber: llvm-commits.
evgeny777 added inline comments.Nov 9 2016, 1:57 AM
ELF/SymbolTable.cpp
391

ErrSec may be nullptr, if we're adding absolute symbol

394

If Existing is not DefinedRegular but isn't nullptr either, we may still try to use Existing->File to report previously seen location. This isn't covered by initial patch, I think, but would be nice to have.