This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix TLS support test on Solaris 10


Hi,

Solaris 10 doesn't support full static linking (because there is no static 
libc on this platform) so the TLS support test in config/ always fails:

    AC_RUN_IFELSE([__thread int a; int b; int main() { return a = b; }],
      [dnl If the test case passed with dynamic linking, try again with
      dnl static linking.  This fails at least with some older Red Hat
      dnl releases.
      save_LDFLAGS="$LDFLAGS"
      LDFLAGS="-static $LDFLAGS"
      AC_RUN_IFELSE([__thread int a; int b; int main() { return a = b; }],
		    [have_tls=yes], [have_tls=no], [])
      LDFLAGS="$save_LDFLAGS"],
      [have_tls=no],

Tested on SPARC/Solaris 10 and AMD64/Linux, OK for mainline and 4.2 branch?


2006-12-03  Eric Botcazou  <ebotcazou@libertysurf.fr>

config/
	* tls.m4 (GCC_CHECK_TLS): Do not test TLS with static linking
	if static linking doesn't even work.

libgomp/
	* configure: Regenerate.

libmudflap/
	* configure: Regenerate.

libjava/
	* configure: Regenerate.

libstdc++-v3/
	* configure: Regenerate.


-- 
Eric Botcazou
Index: tls.m4
===================================================================
--- tls.m4	(revision 119302)
+++ tls.m4	(working copy)
@@ -5,12 +5,14 @@ AC_DEFUN([GCC_CHECK_TLS], [
 		 have_tls, [
     AC_RUN_IFELSE([__thread int a; int b; int main() { return a = b; }],
       [dnl If the test case passed with dynamic linking, try again with
-      dnl static linking.  This fails at least with some older Red Hat
-      dnl releases.
+       dnl static linking, but only if static linking is supported (not
+       dnl on Solaris 10).  This fails with some older Red Hat releases.
       save_LDFLAGS="$LDFLAGS"
       LDFLAGS="-static $LDFLAGS"
-      AC_RUN_IFELSE([__thread int a; int b; int main() { return a = b; }],
-		    [have_tls=yes], [have_tls=no], [])
+      AC_LINK_IFELSE([int main() { return 0; }],
+	AC_RUN_IFELSE([__thread int a; int b; int main() { return a = b; }],
+		      [have_tls=yes], [have_tls=no],[]),
+	[have_tls=yes])
       LDFLAGS="$save_LDFLAGS"],
       [have_tls=no],
       [AC_COMPILE_IFELSE([__thread int foo;], [have_tls=yes], [have_tls=no])]

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]