I noticed the following testsuite failure on Solaris 8/x86 with Sun as/ld:

WARNING: program timed out.
FAIL: gcc.dg/di-sync-multithread.c execution test

It turns out that the testcase hangs if /usr/lib/libthread.so is used
(as it is by default), but works with the alternate thread library in
/usr/lib/lwp.  The latter is what's supposed to be used on Solaris 8,
anyway, but right now it does not when the toolchain used (Sun as in
this case) doesn't support TLS.  To avoid this, I chose to
unconditionally link with -lthread for -pthread on Solaris 8, which
achieves the desired outcome and fixes the failure: without -lthread and
LD_LIBRARY_PATH, libthread.so is just a dependency of libpthread.so and
is only searched for via the latter's RUNPATH (none), with an explicit
-lthread, -L/-R/usr/lib/lwp causes the alternate thread library to be
used.

Bootstrapped without regressions on i386-pc-solaris2.8 and
sparc-sun-solaris2.8, installed on mainline.

        Rainer


2012-01-29  Rainer Orth  <r...@cebitec.uni-bielefeld.de>

        * configure.ac (LIB_TLS_SPEC): Enforce use of alternate thread
        library on Solaris 8 even without TLS support.
        * configure: Regenerate.

# HG changeset patch
# Parent 1fb4a848efe883fb988c1d3c4089f85a125f7932
Use alternate thread library on Solaris 8 even without TLS

diff --git a/gcc/configure.ac b/gcc/configure.ac
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -3259,6 +3259,13 @@ case "$target" in
     if test $set_have_as_tls = no; then
       LIBS=
     fi
+    # Even without TLS support on Solaris 8, explicitly link with libthread
+    # to guarantee that the alternate thread library is used.
+    case "$target" in
+      *-*-solaris2.8)
+	LIBS=-lthread
+	;;
+    esac
     # Always define LIB_TLS_SPEC, even without TLS support.
     AC_DEFINE_UNQUOTED(LIB_TLS_SPEC, "$LIBS",
         [Define to the library containing __tls_get_addr/___tls_get_addr.])

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

Reply via email to