This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho][nfc] Allow Defined symbols to be placed in binding sections
ClosedPublic

Authored by int3 on Mar 9 2022, 8:43 PM.

Details

Summary

Previously, we only allowed this for DylibSymbols. However, in order to
properly support -flat_namespace as well as -interposable, we need
to allow this for Defined symbols too. Therefore we hoist the
lazyBindOffset and the stubsHelperIndex into the parent Symbol
class.

The actual change to support interposition under -flat_namespace is in
D119294: [lld-macho] -flat_namespace for dylibs should make all externs interposable; the NFC changes here have been split out for easier review.

Perf regression isn't stat sig on my 3.2 GHz 16-Core Intel Xeon W linking
chromium_framework:

           base           diff           difference (95% CI)
sys_time   1.227 ± 0.021  1.234 ± 0.031  [  -0.3% ..   +1.5%]
user_time  3.665 ± 0.036  3.674 ± 0.035  [  -0.2% ..   +0.7%]
wall_time  4.596 ± 0.055  4.609 ± 0.064  [  -0.3% ..   +0.9%]
samples    34             47

Max RSS regression is barely stat sig:

         base                           diff                           difference (95% CI)
time     1003664356.324 ± 15404053.912  1010380403.613 ± 10578309.455  [  +0.0% ..   +1.3%]
samples  37                             31

Diff Detail

Event Timeline

int3 created this revision.Mar 9 2022, 8:43 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 9 2022, 8:43 PM
int3 requested review of this revision.Mar 9 2022, 8:43 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 9 2022, 8:43 PM
modimo accepted this revision.Mar 10 2022, 1:54 PM

LGTM aside from one comment. Thanks for splitting this out!

lld/MachO/SyntheticSections.cpp
423

interposable hasn't been defined yet here so the builds are failing. Should be fine to move this to D119294 since this'll be committed as a stack.

This revision is now accepted and ready to land.Mar 10 2022, 1:54 PM
int3 updated this revision to Diff 414524.Mar 10 2022, 4:07 PM

move assert to other diff