https://sourceware.org/bugzilla/show_bug.cgi?id=33177

--- Comment #3 from Rainer Orth <ro at gcc dot gnu.org> ---
The attached example shows what's going on:

* I created shared objects with gcc configured to use gas/ld (libld.so) and
  gas/gld (libgld.so).  This contains a _GLOBAL_OFFSET_TABLE_ definition
  since that's one of the Solaris ABI symbols.  When linked with ld, the symbol
  is global with protected visibility, with gld it's global with default
  visibility.

* When linking an executable against either lib with
--as-needed/--no-as-needed,
  gld drags in the library because of these _G_O_T_ definitions, while ld does
  not.

* The _G_O_T_ reference that triggers this is from one of the Solaris CRTs:
  crtbegin.o on x86, crt1.o in sparc, as can be seen when running gld with -M.

* From what I learned from Ali (and can also be seen when running ld with
  LD_DEBUG=all,detail), ld creates the ABI-specified symbols (_G_O_T_ included)
  very early on, so the references from the CRTs can be resolved from that.

I've so far struggled in vain how to handle this.  I think it might be possible
(at least as a workaround) with --defsym or a linker script, but so far have
failed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to