Message ID | yddd0ofzr42.fsf@CeBiTec.Uni-Bielefeld.DE |
---|---|
State | New |
Headers | show |
Series | [libphobos] Work around Solaris ld bug linking __tls_get_addr on 64-bit x86 | expand |
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes: > Here's the patch I mentioned in > > https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01661.html > > to work around an amd64 Solaris ld bug. I'm just posting it for > reference now: until it's clear if a fix will make it into Solaris 11.5 > or not, there's no point in applying it yet. > > Still, review comments are appreciated. With the revised patch for non-dlpi_tls_modid versions of Solaris https://gcc.gnu.org/ml/gcc-patches/2019-04/msg00354.html __tls_get_addr will always be called and thus this workaround is needed unconditionally, even should the ld bug be fixed in Solaris 11.5. This revision adjusts the patch accordingly and was tested together with the other one on Solaris 11.[345]/x86. Ok for mainline? Rainer
On Tue, 9 Apr 2019 at 21:36, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote: > > Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes: > > > Here's the patch I mentioned in > > > > https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01661.html > > > > to work around an amd64 Solaris ld bug. I'm just posting it for > > reference now: until it's clear if a fix will make it into Solaris 11.5 > > or not, there's no point in applying it yet. > > > > Still, review comments are appreciated. > > With the revised patch for non-dlpi_tls_modid versions of Solaris > > https://gcc.gnu.org/ml/gcc-patches/2019-04/msg00354.html > > __tls_get_addr will always be called and thus this workaround is needed > unconditionally, even should the ld bug be fixed in Solaris 11.5. > > This revision adjusts the patch accordingly and was tested together with > the other one on Solaris 11.[345]/x86. > > Ok for mainline? > OK
# HG changeset patch # Parent 4dadb62112e1e735535bc37fe31e14c82340a1b4 Work around Solaris ld bug linking __tls_get_addr on 64-bit x86 diff --git a/libphobos/configure.ac b/libphobos/configure.ac --- a/libphobos/configure.ac +++ b/libphobos/configure.ac @@ -126,6 +126,7 @@ DRUNTIME_OS_SOURCES DRUNTIME_OS_THREAD_MODEL DRUNTIME_OS_ARM_EABI_UNWINDER DRUNTIME_OS_MINFO_BRACKETING +DRUNTIME_OS_LINK_SPEC WITH_LOCAL_DRUNTIME([ AC_LANG_PUSH([D]) diff --git a/libphobos/m4/druntime/os.m4 b/libphobos/m4/druntime/os.m4 --- a/libphobos/m4/druntime/os.m4 +++ b/libphobos/m4/druntime/os.m4 @@ -182,3 +182,27 @@ AC_DEFUN([DRUNTIME_OS_MINFO_BRACKETING], AC_SUBST(DCFG_MINFO_BRACKETING) AC_LANG_POP([C]) ]) + +# DRUNTIME_OS_LINK_SPEC +# --------------------- +# Add target-specific link options to link_spec. +AC_DEFUN([DRUNTIME_OS_LINK_SPEC], +[ + case $target in + i?86-*-solaris2.* | x86_64-*-solaris2.*) + # 64-bit Solaris/x86 ld breaks calls to __tls_get_addr with non-TLS + # relocs. Work around by disabling TLS transitions. Not necessary + # on 32-bit x86, but cannot be distinguished reliably in specs. + if test $DCFG_DLPI_TLS_MODID = true; then + druntime_ld_prog=`$CC -print-prog-name=ld` + if test -n "$druntime_ld_prog" \ + && $druntime_ld_prog -v 2>&1 | grep GNU > /dev/null 2>&1; then + : + else + OS_LINK_SPEC='-z relax=transtls' + fi + fi + ;; + esac + AC_SUBST(OS_LINK_SPEC) +]) diff --git a/libphobos/src/libgphobos.spec.in b/libphobos/src/libgphobos.spec.in --- a/libphobos/src/libgphobos.spec.in +++ b/libphobos/src/libgphobos.spec.in @@ -4,5 +4,8 @@ # order. # +%rename link linkorig_gdc_renamed +*link: %(linkorig_gdc_renamed) @OS_LINK_SPEC@ + %rename lib liborig_gdc_renamed *lib: @SPEC_PHOBOS_DEPS@ %(liborig_gdc_renamed)