This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho] Don't fold subsections with symbols at nonzero offsets
ClosedPublic

Authored by int3 on Oct 14 2022, 5:06 PM.

Details

Summary

Symbols occur at non-zero offsets in a subsection if they are
.alt_entry symbols, or if .subsections_via_symbols is omitted.

It doesn't seem like ld64 supports folding those subsections either.
Moreover, supporting this it makes foldIdentical a lot more
complicated to implement. The existing implementation has some
questionable behavior around STABS omission -- if a section with an
non-zero offset symbol was folded into one without, we would omit the
STABS entry for the non-zero offset symbol.

I will be following up with a diff that makes foldIdentical zero out
the symbol sizes for folded symbols. Again, this is much easier to
implement if we don't have to worry about non-zero offsets.

Diff Detail

Event Timeline

int3 created this revision.Oct 14 2022, 5:06 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptOct 14 2022, 5:06 PM
int3 requested review of this revision.Oct 14 2022, 5:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 14 2022, 5:06 PM
oontvoo accepted this revision.Oct 18 2022, 6:31 AM
oontvoo added a subscriber: oontvoo.

LG

lld/MachO/InputSection.cpp
147

this comment is stale?

This revision is now accepted and ready to land.Oct 18 2022, 6:31 AM