This is an archive of the discontinued LLVM Phabricator instance.

MachO: don't emit L... private symbols in do_not_dead_strip sections.
ClosedPublic

Authored by t.p.northover on Jul 14 2021, 5:57 AM.

Details

Reviewers
steven_wu
Summary

The linker can sometimes drop the do_not_dead_strip if it can't associate the atom with a symbol (the other place to specify no dead-stripping in MachO files).

Diff Detail

Event Timeline

t.p.northover created this revision.Jul 14 2021, 5:57 AM
t.p.northover requested review of this revision.Jul 14 2021, 5:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 14 2021, 5:57 AM

I think the reason for linker to drop that is macho linker do not care about no_dead_strip sections and it only looks at the no_dead_strip attribute on the atom. Once it turned into private label, the no_dead_strip attribute can be gone on the atom. Even ld -r preserves attribute on the section, it might not work.

steven_wu accepted this revision.Jul 14 2021, 3:02 PM
This revision is now accepted and ready to land.Jul 14 2021, 3:02 PM
t.p.northover closed this revision.Jul 15 2021, 6:41 AM

Thanks. Committed as 5d7632ee72c5.