https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71767
--- Comment #45 from Iain Sandoe <iains at gcc dot gnu.org> --- Author: iains Date: Sun Nov 27 14:21:51 2016 New Revision: 242893 URL: https://gcc.gnu.org/viewcvs?rev=242893&root=gcc&view=rev Log: [Darwin, ld64] Make PIC indirections and constant labels linker-visible. Indirections: If we have a situation like: global_weak_symbol: .... Lnon_weak_local: .... ld64 will be unable to split this into two atoms (because the "L" makes the second symbol 'invisible'). This means that legitimate direct accesses to the second symbol will appear to be non-allowed direct accesses to an atom of type weak, global which are not allowed. To avoid this, we make the indirections have a leading 'l' (lower-case L) which has a special meaning: linker can see this and use it to determine atoms, but it is not placed into the final symbol table. The implementation here is somewhat heavy-handed in that it will also mark indirections to the __IMPORT,__pointers section the same way which is really unnecessary, since ld64 _can_ split those into atoms as they are fixed size. FIXME: determine if this is a penalty worth extra code to fix. Similarly, with: .const weak_global_constant: .... LCxx: ... ld64 can't split the second, causing a warning when it's directly accessed. gcc/ 2016-11-27 Iain Sandoe <i...@codesourcery.com> PR target/71767 * config/darwin.c (imachopic_indirection_name): Make data section indirections linker-visible. * config/darwin.h (ASM_GENERATE_INTERNAL_LABEL): Make local constant labels linker-visible. Modified: trunk/gcc/ChangeLog trunk/gcc/config/darwin.c trunk/gcc/config/darwin.h