This is an archive of the discontinued LLVM Phabricator instance.

COFF: Correctly handle relocations against early discarded sections.
ClosedPublic

Authored by pcc on Nov 19 2017, 11:47 PM.

Details

Summary

Don't crash if we encounter a reference to an early discarded section
(such as .drectve). Instead, handle them the same way as sections
discarded by comdat merging, i.e. either print an error message or
(for debug sections) silently ignore the relocation.

Diff Detail

Repository
rL LLVM

Event Timeline

pcc created this revision.Nov 19 2017, 11:47 PM
ruiu accepted this revision.Nov 20 2017, 2:02 AM

LGTM

lld/COFF/Chunks.cpp
271 ↗(On Diff #123540)

If you move this piece of code immediately after auto *Sym = dyn_cast_or_null.., can't you simplify code a bit? You would have to write two fatal function calls with the same message, but I don't think that's not that bad.

This revision is now accepted and ready to land.Nov 20 2017, 2:02 AM
This revision was automatically updated to reflect the committed changes.