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

--- Comment #5 from Rainer Orth <ro at gcc dot gnu.org> ---
Created attachment 46329
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46329&action=edit
Use __tls_get_addr indirectly on 64-bit Solaris/x86

This patch addresses the execution failures on 64-bit Solaris/x86 when
-z relax=transtls is not available (as on Solaris 10 and Illumos).  It's based
on the observation that the linker bug losing the call to __tls_get_addr only
occurs when linking an executable, while shared objects (and position
independent
exeutables, which aren't supported on Solaris 10) are unaffected.  So the
workaround
consists in always funneling the call to __tls_get_addr through a helper shared
object, libgdc_s.so.1, which provides __tls_get_addr_s and passes its args to
the real __tls_get_addr.

The attached patch implements this, and bootstrap on i386-pc-solaris2.10 and
i386-pc-solaris2.11 provided almost exactly the same libphobos and gdc test
results.

There are a few rough edges at the moment:

* That new libgdc_s should only be used with -static-libphobos.  The shared
  libgdruntime.so isn't affected from the ld bug.  It would be silly to depend
  no that helper lib if it's not really needed.  Still need to figure out how
  to do this.

* A few comment cleanups are in order.

With that fixed, the patch could go onto mainline, thus benefitting Illumos,
and the gcc-9 branch as a prerequisite should we decide to add the rest of the
Solaris 10 support there.

Reply via email to