Check if Solaris ld supports -z relax=transtls
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Tue, 7 May 2019 10:38:45 +0000 (10:38 +0000)
committerRainer Orth <ro@gcc.gnu.org>
Tue, 7 May 2019 10:38:45 +0000 (10:38 +0000)
* m4/druntime/os.m4 (DRUNTIME_OS_LINK_SPEC): Only use -z
relax=transtls if linker supports it.
* configure.ac (enable_libphobos, LIBPHOBOS_SUPPORTED): Move down.
(x86_64-*-solaris2.* | i?86-*-solaris2.*): Only
mark supported with either gld or ld -z relax=transtls.
* configure: Regenerate.

From-SVN: r270939

libphobos/ChangeLog
libphobos/configure
libphobos/configure.ac
libphobos/m4/druntime/os.m4

index 1051fb84a6c38e1fff65538160fc685d3241aa23..c15227b4f97a126cfb0f9409c824848460d97ab9 100644 (file)
@@ -1,3 +1,12 @@
+2019-05-07  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       * m4/druntime/os.m4 (DRUNTIME_OS_LINK_SPEC): Only use -z
+       relax=transtls if linker supports it.
+       * configure.ac (enable_libphobos, LIBPHOBOS_SUPPORTED): Move down.
+       (x86_64-*-solaris2.* | i?86-*-solaris2.*): Only
+       mark supported with either gld or ld -z relax=transtls.
+       * configure: Regenerate.
+
 2019-05-02  Maciej W. Rozycki  <macro@wdc.com>
 
        * std/math.d (IeeeFlags.getIeeeFlags): Handle RISC-V soft-float ABI.
index e2977b3cc749dacd3c1d91dee1872818c1be1299..95a2b423218741a0510b8618fbf1f49fe3698f3b 100755 (executable)
@@ -636,6 +636,8 @@ LIBOBJS
 GDCFLAGSX
 libtool_VERSION
 SPEC_PHOBOS_DEPS
+ENABLE_LIBPHOBOS_FALSE
+ENABLE_LIBPHOBOS_TRUE
 gdc_include_dir
 libphobos_toolexeclibdir
 libphobos_toolexecdir
@@ -698,8 +700,6 @@ DRUNTIME_GC_ENABLE_TRUE
 libphobos_srcdir
 libphobos_builddir
 get_gcc_base_ver
-ENABLE_LIBPHOBOS_FALSE
-ENABLE_LIBPHOBOS_TRUE
 phobos_compiler_shared_flag
 phobos_compiler_pic_flag
 OTOOL64
@@ -827,7 +827,6 @@ with_pic
 enable_fast_install
 with_gnu_ld
 enable_libtool_lock
-enable_libphobos
 with_gcc_major_version_only
 enable_werror
 enable_druntime_gc
@@ -838,6 +837,7 @@ with_libbacktrace
 with_target_system_zlib
 with_cross_host
 enable_version_specific_runtime_libs
+enable_libphobos
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1478,7 +1478,6 @@ Optional Features:
   --enable-fast-install[=PKGS]
                           optimize for fast installation [default=yes]
   --disable-libtool-lock  avoid locking (might break parallel builds)
-  --enable-libphobos      Enable libphobos
   --enable-werror         turns on -Werror [default=no]
   --enable-druntime-gc    enable D runtime garbage collector (default: yes)
   --enable-unix           enables Unix runtime (default: yes, for Unix
@@ -1489,6 +1488,7 @@ Optional Features:
   --enable-version-specific-runtime-libs
                           Specify that runtime libraries should be installed
                           in a compiler-specific directory
+  --enable-libphobos      Enable libphobos
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
 lt_prog_compiler_pic_D="$phobos_compiler_shared_flag"
 pic_mode='default'
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --enable-libphobos" >&5
-$as_echo_n "checking for --enable-libphobos... " >&6; }
-# Check whether --enable-libphobos was given.
-if test "${enable_libphobos+set}" = set; then :
-  enableval=$enable_libphobos;
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_libphobos" >&5
-$as_echo "$enable_libphobos" >&6; }
-
-# See if supported.
-unset LIBPHOBOS_SUPPORTED
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for host support for libphobos" >&5
-$as_echo_n "checking for host support for libphobos... " >&6; }
-. ${srcdir}/configure.tgt
-case ${host} in
-  x86_64-*-solaris2.* | i?86-*-solaris2.*)
-    # libphobos doesn't compile with the Solaris/x86 assembler due to a
-    # relatively low linelength limit.
-    as_prog=`$CC -print-prog-name=as`
-    if test -n "$as_prog" && $as_prog -v /dev/null 2>&1 | grep GNU > /dev/null 2>&1; then
-      druntime_cv_use_gas=yes;
-    else
-      druntime_cv_use_gas=no;
-    fi
-    rm -f a.out
-    if test x$druntime_cv_use_gas = xno; then
-      LIBPHOBOS_SUPPORTED=no
-    fi
-    ;;
-esac
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBPHOBOS_SUPPORTED" >&5
-$as_echo "$LIBPHOBOS_SUPPORTED" >&6; }
-
-# Decide if it's usable.
-case $LIBPHOBOS_SUPPORTED:$enable_libphobos in
-*:no)  use_libphobos=no  ;;
-*:yes) use_libphobos=yes ;;
-yes:*) use_libphobos=yes ;;
-*:*)   use_libphobos=no  ;;
-esac
- if test x$use_libphobos = xyes; then
-  ENABLE_LIBPHOBOS_TRUE=
-  ENABLE_LIBPHOBOS_FALSE='#'
-else
-  ENABLE_LIBPHOBOS_TRUE='#'
-  ENABLE_LIBPHOBOS_FALSE=
-fi
-
-
 # Determine what GCC version number to use in filesystem paths.
 
   get_gcc_base_ver="cat"
@@ -14407,10 +14357,22 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
       # relocs.  Work around by disabling TLS transitions.  Not necessary
       # on 32-bit x86, but cannot be distinguished reliably in specs.
       druntime_ld_prog=`$CC -print-prog-name=ld`
+      druntime_ld_gld=no
+      druntime_ld_relax_transtls=no
       if test -n "$druntime_ld_prog" \
          && $druntime_ld_prog -v 2>&1 | grep GNU > /dev/null 2>&1; then
-        :
+        druntime_ld_gld=yes
       else
+        echo 'int main (void) { return 0; }' > conftest.c
+        save_LDFLAGS="$LDFLAGS"
+        LDFLAGS="$LDFLAGS -Wl,-z,relax=transtls"
+        if $CC $CFLAGS $LDFLAGS -o conftest conftest.c > /dev/null 2>&1; then
+          druntime_ld_relax_transtls=yes
+        fi
+        LDFLAGS="$save_LDFLAGS"
+        rm -f conftest.c conftest
+      fi
+      if test "$druntime_ld_relax_transtls" = "yes"; then
         OS_LINK_SPEC='-z relax=transtls'
       fi
       ;;
@@ -15298,6 +15260,60 @@ $as_echo "$version_specific_libs" >&6; }
 
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --enable-libphobos" >&5
+$as_echo_n "checking for --enable-libphobos... " >&6; }
+# Check whether --enable-libphobos was given.
+if test "${enable_libphobos+set}" = set; then :
+  enableval=$enable_libphobos;
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_libphobos" >&5
+$as_echo "$enable_libphobos" >&6; }
+
+# See if supported.
+unset LIBPHOBOS_SUPPORTED
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for host support for libphobos" >&5
+$as_echo_n "checking for host support for libphobos... " >&6; }
+. ${srcdir}/configure.tgt
+case ${host} in
+  x86_64-*-solaris2.* | i?86-*-solaris2.*)
+    # libphobos doesn't compile with the Solaris/x86 assembler due to a
+    # relatively low linelength limit.
+    as_prog=`$CC -print-prog-name=as`
+    if test -n "$as_prog" && $as_prog -v /dev/null 2>&1 | grep GNU > /dev/null 2>&1; then
+      druntime_cv_use_gas=yes;
+    else
+      druntime_cv_use_gas=no;
+    fi
+    rm -f a.out
+    if test x$druntime_cv_use_gas = xno; then
+      LIBPHOBOS_SUPPORTED=no
+    fi
+    # 64-bit D execution fails with Solaris ld without -z relax=transtls support.
+    if test "$druntime_ld_gld" = "no" && test "$druntime_ld_relax_transtls" = "no"; then
+      LIBPHOBOS_SUPPORTED=no
+    fi
+    ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBPHOBOS_SUPPORTED" >&5
+$as_echo "$LIBPHOBOS_SUPPORTED" >&6; }
+
+# Decide if it's usable.
+case $LIBPHOBOS_SUPPORTED:$enable_libphobos in
+*:no)  use_libphobos=no  ;;
+*:yes) use_libphobos=yes ;;
+yes:*) use_libphobos=yes ;;
+*:*)   use_libphobos=no  ;;
+esac
+ if test x$use_libphobos = xyes; then
+  ENABLE_LIBPHOBOS_TRUE=
+  ENABLE_LIBPHOBOS_FALSE='#'
+else
+  ENABLE_LIBPHOBOS_TRUE='#'
+  ENABLE_LIBPHOBOS_FALSE=
+fi
+
+
 # Add drtbegin.o/drtend.o to startfile/endfile specs in libgphobos.spec
 if test "$DCFG_MINFO_BRACKETING" = "false"; then
     DRTSTUFF_SPEC=$srcdir/src/drtstuff.spec
@@ -15485,10 +15501,6 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
   as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${ENABLE_LIBPHOBOS_TRUE}" && test -z "${ENABLE_LIBPHOBOS_FALSE}"; then
-  as_fn_error $? "conditional \"ENABLE_LIBPHOBOS\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${DRUNTIME_GC_ENABLE_TRUE}" && test -z "${DRUNTIME_GC_ENABLE_FALSE}"; then
   as_fn_error $? "conditional \"DRUNTIME_GC_ENABLE\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -15569,6 +15581,10 @@ if test -z "${DRUNTIME_OS_MINFO_BRACKETING_TRUE}" && test -z "${DRUNTIME_OS_MINF
   as_fn_error $? "conditional \"DRUNTIME_OS_MINFO_BRACKETING\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${ENABLE_LIBPHOBOS_TRUE}" && test -z "${ENABLE_LIBPHOBOS_FALSE}"; then
+  as_fn_error $? "conditional \"ENABLE_LIBPHOBOS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 
 : "${CONFIG_STATUS=./config.status}"
 ac_write_fail=0
index c4a86f2ec5a27151145f630ca83d5b6b9aa82770..3b4d46a60e44bc87b67639a43f455bb9381da0c4 100644 (file)
@@ -113,6 +113,41 @@ AC_SUBST(phobos_compiler_shared_flag)
 lt_prog_compiler_pic_D="$phobos_compiler_shared_flag"
 pic_mode='default'
 
+# Determine what GCC version number to use in filesystem paths.
+GCC_BASE_VER
+
+# libphobos/libdruntime specific options and feature detection
+DRUNTIME_CONFIGURE
+DRUNTIME_MULTILIB
+DRUNTIME_WERROR
+DRUNTIME_GC
+DRUNTIME_CPU_SOURCES
+DRUNTIME_OS_UNIX
+DRUNTIME_OS_SOURCES
+DRUNTIME_OS_THREAD_MODEL
+DRUNTIME_OS_ARM_EABI_UNWINDER
+DRUNTIME_OS_MINFO_BRACKETING
+DRUNTIME_OS_DLPI_TLS_MODID
+DRUNTIME_OS_LINK_SPEC
+DRUNTIME_LIBRARIES_CLIB
+
+WITH_LOCAL_DRUNTIME([
+  AC_LANG_PUSH([D])
+  AC_SEARCH_LIBS([malloc], [c])
+  DRUNTIME_LIBRARIES_THREAD
+  AC_SEARCH_LIBS([cosf], [m])
+  AC_SEARCH_LIBS([clock_gettime], [rt])
+  DRUNTIME_ENABLE_ATOMIC_BUILTINS
+  AC_LANG_POP([D])
+], [-nophoboslib])
+
+DRUNTIME_LIBRARIES_ATOMIC
+DRUNTIME_LIBRARIES_BACKTRACE
+DRUNTIME_LIBRARIES_DLOPEN
+DRUNTIME_LIBRARIES_NET
+DRUNTIME_LIBRARIES_ZLIB
+DRUNTIME_INSTALL_DIRECTORIES
+
 AC_MSG_CHECKING([for --enable-libphobos])
 AC_ARG_ENABLE(libphobos,
   [AS_HELP_STRING([--enable-libphobos], [Enable libphobos])])
@@ -136,6 +171,10 @@ case ${host} in
     if test x$druntime_cv_use_gas = xno; then
       LIBPHOBOS_SUPPORTED=no
     fi
+    # 64-bit D execution fails with Solaris ld without -z relax=transtls support.
+    if test "$druntime_ld_gld" = "no" && test "$druntime_ld_relax_transtls" = "no"; then
+      LIBPHOBOS_SUPPORTED=no
+    fi
     ;;
 esac
 AC_MSG_RESULT($LIBPHOBOS_SUPPORTED)
@@ -149,41 +188,6 @@ yes:*) use_libphobos=yes ;;
 esac
 AM_CONDITIONAL(ENABLE_LIBPHOBOS, test x$use_libphobos = xyes)
 
-# Determine what GCC version number to use in filesystem paths.
-GCC_BASE_VER
-
-# libphobos/libdruntime specific options and feature detection
-DRUNTIME_CONFIGURE
-DRUNTIME_MULTILIB
-DRUNTIME_WERROR
-DRUNTIME_GC
-DRUNTIME_CPU_SOURCES
-DRUNTIME_OS_UNIX
-DRUNTIME_OS_SOURCES
-DRUNTIME_OS_THREAD_MODEL
-DRUNTIME_OS_ARM_EABI_UNWINDER
-DRUNTIME_OS_MINFO_BRACKETING
-DRUNTIME_OS_DLPI_TLS_MODID
-DRUNTIME_OS_LINK_SPEC
-DRUNTIME_LIBRARIES_CLIB
-
-WITH_LOCAL_DRUNTIME([
-  AC_LANG_PUSH([D])
-  AC_SEARCH_LIBS([malloc], [c])
-  DRUNTIME_LIBRARIES_THREAD
-  AC_SEARCH_LIBS([cosf], [m])
-  AC_SEARCH_LIBS([clock_gettime], [rt])
-  DRUNTIME_ENABLE_ATOMIC_BUILTINS
-  AC_LANG_POP([D])
-], [-nophoboslib])
-
-DRUNTIME_LIBRARIES_ATOMIC
-DRUNTIME_LIBRARIES_BACKTRACE
-DRUNTIME_LIBRARIES_DLOPEN
-DRUNTIME_LIBRARIES_NET
-DRUNTIME_LIBRARIES_ZLIB
-DRUNTIME_INSTALL_DIRECTORIES
-
 # Add drtbegin.o/drtend.o to startfile/endfile specs in libgphobos.spec
 if test "$DCFG_MINFO_BRACKETING" = "false"; then
     DRTSTUFF_SPEC=$srcdir/src/drtstuff.spec
index b473ad5d88ea0cdb623565dd42ad1bfc7a0d6170..74167aa2cdee8bca45d7b34ceaaafdbf42baf927 100644 (file)
@@ -209,10 +209,22 @@ AC_DEFUN([DRUNTIME_OS_LINK_SPEC],
       # relocs.  Work around by disabling TLS transitions.  Not necessary
       # on 32-bit x86, but cannot be distinguished reliably in specs.
       druntime_ld_prog=`$CC -print-prog-name=ld`
+      druntime_ld_gld=no
+      druntime_ld_relax_transtls=no
       if test -n "$druntime_ld_prog" \
          && $druntime_ld_prog -v 2>&1 | grep GNU > /dev/null 2>&1; then
-        :
+        druntime_ld_gld=yes
       else
+        echo 'int main (void) { return 0; }' > conftest.c
+        save_LDFLAGS="$LDFLAGS"
+        LDFLAGS="$LDFLAGS -Wl,-z,relax=transtls"
+        if $CC $CFLAGS $LDFLAGS -o conftest conftest.c > /dev/null 2>&1; then
+          druntime_ld_relax_transtls=yes
+        fi
+        LDFLAGS="$save_LDFLAGS"
+        rm -f conftest.c conftest
+      fi
+      if test "$druntime_ld_relax_transtls" = "yes"; then
         OS_LINK_SPEC='-z relax=transtls'
       fi
       ;;