https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68771

--- Comment #13 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Iain Sandoe from comment #12)
> (In reply to Daniel Vollmer from comment #10)
> > Created attachment 46036 [details]
> > Example triggering "This was likely caused by different translation units
> > being compiled with different visibility settings."
> > 
> > Generates (w/ g++-7.4 on Darwin)
> > 
> > ld: warning: direct access in function '__GLOBAL__sub_I_65535_0_test.cpp'
> > from file
> > '/var/folders/02/yl3m8d4d0397mk6dxn6dpcqw0000gp/T//ccuYv6qu.ltrans0.ltrans.
> > o' to global weak symbol '__ZGVZ19BroadcastFromMasterImEvPT_mE4bufs' from
> > file
> > '/var/folders/02/yl3m8d4d0397mk6dxn6dpcqw0000gp/T//ccuYv6qu.ltrans0.ltrans.
> > o' means the weak symbol cannot be overridden at runtime. This was likely
> > caused by different translation units being compiled with different
> > visibility settings.
> 
> Thanks, I can reproduce this with my local gcc-7 branch, 
> interesting that it needs both -Ofast and -fprofile-generate to fire.

OK (initial analysis). what we have is 

__ZGVZ19BroadcastFromMasterImEvPT_mE4bufs:
  .space 8
....

LPX0:
 ....

and then a reference to LPX0 in __GLOBAL__sub_I_65535_0_test.cpp.

So ld64 breaks the code and data into "atoms" where each atom begins with a
linker-visible symbol.

What it's saying is that the data pointed to by LPX0 is in the atom named
__ZGVZ19BroadcastFromMasterImEvPT_mE4bufs (because LPX0 is not visible to the
linker).

right now, not sure if it's really a potential issue or just more linker
warning noise - need to look at it fresh with plenty of coffee.  FWIW, Linux
generates pretty much identical code, but (of course) the BFD linker has
different behaviour from Darwin's ld64.

=====

So, we now have two different issues, neither of which is related to the
current bug title :)

Please pick one - and make a new PR for the second (probably ^^^^ this stuff is
quite self-contained and could be split out) ... we can then retitle the
existing bug to make it easier for folks to find things.

Reply via email to