Stop marking reflection metadata sections as 'no_dead_strip' on Darwin #41224
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm trying to expand dead-strippability to reflection metadata, part of the solution is #40853, this is another part -- currently IRGen marks all reflection metadata sections as 'no_dead_strip' (with a Darwin linker specific attribute). This seems unnecessarily conservative, and there seems to be no good reason why we need these entire sections to opt out of dead-strippability: The globals should either be "alive" (referenced by other globals/code), or if there's situations where there's actually a un-referenced global that still needs to survive into final binaries, we should use llvm.used on that particular global. Furthermore, we already do not use the equivalent of a section-wide dead-strippability opt-out for non-Mach-O targets, and also I tried to dig up why 'no_dead_strip' was added in git history, but I couldn't find anything -- seems like this has always been that way, with no explanation why.