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).
Details
Details
Diff Detail
Diff Detail
Unit Tests
Unit Tests
Event Timeline
Comment Actions
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.