--- Comment #19 from Iain Sandoe <iains at gcc dot gnu.org> ---
Created attachment 39659
proposed patch set.
So I think this is working reasonably, but haven't tested fully across the
range of Darwins yet == have a go please!
There are 4 patches here:
1. A patch that solves a latent problem with atom-recognition where a
non-weak-local follows a weak-global in a data or const sections. This is
exposed by the fixes for the actual bug. (needed once patch 3 is applied)
2a. A patch that allows ld64 to be recognized as a linker, and picks up its
version (and as an example also checks support for -export_dynamic) - this was
part of another patch set but is needed now to support patch 3 (which actually
solves the PR)
2b - just the regenerated config files for 2a.
3. This is the one that does the actual fix, by switching section use when the
linker supports merging of weak stuff without special sections - we might be
able to refine the 'earliest linker' version somewhat - this only represents
what I could test reasonably quickly.
The patch provides a target flag "-mtarget-linker" (after the similarly-named
LLVM one) and uses it to determine if the linker needs coalesced sections to
deal with weak symbols. If not, then we emit in the regular sections.
- needed a tweak to config/i386.c to allow for PICbase thunk output to be
switched to a non-coalesced section too.