This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Don't crash if relocation target section is discarded
ClosedPublic

Authored by evgeny777 on Oct 10 2016, 8:07 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

evgeny777 updated this revision to Diff 74128.Oct 10 2016, 8:07 AM
evgeny777 retitled this revision from to [ELF] Don't crash if relocation target section is discarded.
evgeny777 updated this object.
evgeny777 added reviewers: ruiu, rafael.
evgeny777 set the repository for this revision to rL LLVM.
evgeny777 added a project: lld.
evgeny777 added subscribers: grimar, ikudrin, llvm-commits.
ruiu added inline comments.Oct 10 2016, 3:34 PM
ELF/Symbols.cpp
57 ↗(On Diff #74128)

Please include a filename and symbol name in the error message.

58 ↗(On Diff #74128)

Isn't it better to return 0 instead of D.Value?

evgeny777 added inline comments.Oct 11 2016, 4:12 AM
ELF/Symbols.cpp
57 ↗(On Diff #74128)

symbol name is typically nothing more than '.section + addend'.

evgeny777 updated this revision to Diff 74229.Oct 11 2016, 4:13 AM
evgeny777 removed rL LLVM as the repository for this revision.

Addressed review comments

ruiu accepted this revision.Oct 11 2016, 11:19 AM
ruiu edited edge metadata.

LGTM

ELF/Symbols.cpp
57 ↗(On Diff #74128)

Ah, right. Since this is an error path, maybe this should suffice.

warn(SC->getFile()->getName() + ": relocation refers to discarded section");
This revision is now accepted and ready to land.Oct 11 2016, 11:19 AM
This revision was automatically updated to reflect the committed changes.