This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho] Only fold private-label aliases that do not have flags
ClosedPublic

Authored by int3 on Dec 22 2022, 9:14 PM.

Details

Summary

This will enable us to re-land D139069: [lld-macho] Private label aliases to weak symbols should not retain section data.

The issue with the original diff was that we were folding all
private-label symbols. We were not merging the symbol flags during this
folding; instead we just made all references to the folded symbol point
to its aliasee. This caused some flags to be incorrectly discarded. This
surfaced as code that was incorrectly stripped due to LLD dropping the
.no_dead_strip flag.

This diff fixes things by only folding flag-less private-label aliases.
Most (maybe all) of the ltmp<N> symbols that are generated by the MC
aarch64 backend are flag-less, so this conservative folding behavior
does the job.

Diff Detail

Event Timeline

int3 created this revision.Dec 22 2022, 9:14 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptDec 22 2022, 9:14 PM
int3 requested review of this revision.Dec 22 2022, 9:14 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 22 2022, 9:14 PM
thakis accepted this revision.Dec 23 2022, 9:30 AM
thakis added a subscriber: thakis.

Lg

This revision is now accepted and ready to land.Dec 23 2022, 9:30 AM
This revision was landed with ongoing or failed builds.Dec 23 2022, 11:52 AM
This revision was automatically updated to reflect the committed changes.