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.

        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2019-01-28  Rainer Orth  <r...@cebitec.uni-bielefeld.de>

        * m4/druntime/os.m4 (DRUNTIME_OS_LINK_SPEC): New macro.
        * configure.ac: Call it.
        * configure: Regenerate.
        * src/libgphobos.spec.in (*link): Append OS_LINK_SPEC.

# 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)

Reply via email to