Page MenuHomePhabricator

[lld-macho] Improve hiding of unnamed_addr symbols
ClosedPublic

Authored by int3 on Feb 14 2022, 12:42 PM.

Details

Reviewers
thevinster
Group Reviewers
Restricted Project
Commits
rGfd3669c25673: [lld-macho] Improve hiding of unnamed_addr symbols
Summary

Symbols for which canBeOmittedFromSymbolTable() is true should be
treated as private externs. This diff tries to do that by unsetting the
ExportDynamic bit. It seems to mostly work with the FullLTO backend, but
with the ThinLTO backend, the local_unnamed_addr symbols still fail to
be properly hidden. Nonetheless, this is a step in the right direction.

I've documented all the remaining differences between our behavior and
LD64's in the lto-internalized-unnamed-addr.ll test.

See also https://discourse.llvm.org/t/mach-o-lto-handling-of-linkonce-odr-unnamed-addr/60015

Diff Detail

Event Timeline

int3 created this revision.Feb 14 2022, 12:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 14 2022, 12:42 PM
int3 requested review of this revision.Feb 14 2022, 12:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 14 2022, 12:42 PM
int3 added a comment.Feb 14 2022, 3:19 PM

cc @steven_wu -- you may find the comments in the test file of interest, given the discussion in https://discourse.llvm.org/t/mach-o-lto-handling-of-linkonce-odr-unnamed-addr/60015/

ormris removed a subscriber: ormris.Feb 15 2022, 10:43 AM
thevinster accepted this revision.Feb 18 2022, 8:50 AM
This revision is now accepted and ready to land.Feb 18 2022, 8:50 AM
This revision was automatically updated to reflect the committed changes.