This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho] Better deduplication of personality pointers
ClosedPublic

Authored by int3 on Feb 22 2021, 6:52 PM.

Details

Summary

D95809: [lld-macho] Emit personalities in compact unwind introduced a mechanism for synthetic symbol creation of personality
pointers. When multiple section relocations referred to the same personality
pointer, it would deduplicate them. However, it neglected to consider that we
could have symbol relocations that also refer to the same personality pointer.
This diff fixes it.

In practice, this mix of relocations arises when there is a statically-linked
personality routine that is referenced from multiple object files. Within the
same object file, it will be referred to via section relocations, but
(obviously) other object files will refer to it via symbol relocations. Failing
to deduplicate these references resulted in us going over the
3-personality-pointer limit when linking some larger applications.

Fixes llvm.org/PR48389.

Diff Detail

Event Timeline

int3 created this revision.Feb 22 2021, 6:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 22 2021, 6:52 PM
int3 requested review of this revision.Feb 22 2021, 6:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 22 2021, 6:52 PM
thakis accepted this revision.Feb 23 2021, 6:50 AM
thakis added a subscriber: thakis.

Woot!

lld/MachO/UnwindInfoSection.cpp
123

nit: put a continue; here, move code below out of else and dedent (https://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code)

134

same here, add continue here, remove else below

140

same here too: continue after handling the dylib symbol, use if without else here

This revision is now accepted and ready to land.Feb 23 2021, 6:50 AM
int3 updated this revision to Diff 325840.Feb 23 2021, 10:57 AM
int3 marked 3 inline comments as done.

continues

int3 retitled this revision from [lld-macho] Better deduplication of personality symbols to [lld-macho] Better deduplication of personality pointers.Feb 23 2021, 6:41 PM
This revision was landed with ongoing or failed builds.Feb 23 2021, 7:02 PM
This revision was automatically updated to reflect the committed changes.