This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho] Simplify linker optimization hint processing
ClosedPublic

Authored by BertalanD on Sep 4 2022, 8:06 AM.

Details

Summary

This commit removes the relocTargets vector, and instead makes the
code reconstruct the referent addresses from the relocated instructions.
This will allow us to move applyOptimizationHints from
ConcatInputSection::writeTo to a separate pass that parses and applies
LOHs at the same time, on a per-file basis. This will improve
performance, as parsing is currently done serially in ObjFile::parse.

I opted to remove the sanity check that ensures that all relocations
within a LOH point to the same symbol. This completely removes the need
to search through relocations. Mismatched referents should not be
present in valid object files, so it's unlikely that the removal will
lead to mislinks.

Diff Detail

Event Timeline

BertalanD created this revision.Sep 4 2022, 8:06 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
BertalanD requested review of this revision.Sep 4 2022, 8:06 AM
int3 accepted this revision.Sep 4 2022, 11:56 AM
int3 added a subscriber: int3.

Neat! I assume you'll add perf numbers in the diff that parallelizes this :)

This revision is now accepted and ready to land.Sep 4 2022, 11:56 AM
BertalanD updated this revision to Diff 458014.Sep 5 2022, 8:30 AM

Rebased in order to re-run precommit checks before I push.

Herald added a project: Restricted Project. · View Herald TranscriptSep 5 2022, 11:27 PM