This is an archive of the discontinued LLVM Phabricator instance.

[LLD] [COFF] Don't error out on relocations to discarded sections in .eh_frame
ClosedPublic

Authored by mstorsjo on Oct 9 2017, 2:27 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

mstorsjo created this revision.Oct 9 2017, 2:27 AM
mstorsjo updated this revision to Diff 118190.Oct 9 2017, 2:29 AM

Updated a comment together in sync with the updated code.

smeenai added a reviewer: rnk.Oct 9 2017, 9:03 AM
rnk edited edge metadata.Oct 9 2017, 10:05 AM

lgtm, this is consistent with this comment in the ELF side:

// .eh_frame is horribly special and can reference discarded sections. To
// avoid having to parse and recreate .eh_frame, we just replace any
// relocation in it pointing to discarded sections with R_*_NONE, which
// hopefully creates a frame that is ignored at runtime.

We might want to start using associative comdats to avoid making object files like this on win64, though.

rnk accepted this revision.Oct 9 2017, 10:05 AM

Mark as accepted

This revision is now accepted and ready to land.Oct 9 2017, 10:05 AM
ruiu added inline comments.Oct 9 2017, 1:07 PM
COFF/Chunks.h
192 ↗(On Diff #118190)

I wonder if you actually need startswith. Why don't you use ==?

mstorsjo added inline comments.Oct 9 2017, 1:25 PM
COFF/Chunks.h
192 ↗(On Diff #118190)

I remembered seeing section names like .eh_frame$funcName somewhere, but now I can't really find that (perhaps it even was in some tests on ELF), and linking succeeds with plain ==. So I can change it to ==, and I can see later if I ever need startswith.

mstorsjo updated this revision to Diff 118265.Oct 9 2017, 1:26 PM

Changed the section name comparison to ==.

ruiu accepted this revision.Oct 9 2017, 1:30 PM

LGTM

This revision was automatically updated to reflect the committed changes.