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]

Fall back to a link test for TLS in target libraries


Any thoughts on this patch?  I know that link tests can be troublesome
in target libraries, but I'm not sure what else to do.  I recently
tried to build GCC on an ARM LinuxThreads-only system which did not
provide __tls_get_addr in libc.  So the compile test passed, but the
link test would have failed, and prevented building a broken library
(libjava in this case; the first program to fail to link was gij).

I guess one extension of it would be to check the flag set by
GCC_NO_EXECUTABLES.

-- 
Daniel Jacobowitz
CodeSourcery

2006-11-08  Daniel Jacobowitz  <dan@codesourcery.com>

	* tls.m4 (GCC_CHECK_TLS): Fall back to a link test.

Index: config/tls.m4
===================================================================
--- config/tls.m4	(revision 118333)
+++ config/tls.m4	(working copy)
@@ -13,7 +13,8 @@ AC_DEFUN([GCC_CHECK_TLS], [
 		    [have_tls=yes], [have_tls=no], [])
       LDFLAGS="$save_LDFLAGS"],
       [have_tls=no],
-      [AC_COMPILE_IFELSE([__thread int foo;], [have_tls=yes], [have_tls=no])]
+      [AC_LINK_IFELSE([__thread int a; int b; int main() { return a = b; }],
+	[have_tls=yes], [have_tls=no])]
     )])
   if test "$enable_tls $have_tls" = "yes yes"; then
     AC_DEFINE(HAVE_TLS, 1,


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