From f7933f61b2ff10b34b661b2be815529e40223d1c Mon Sep 17 00:00:00 2001 From: cvs2svn <> Date: Sat, 25 Jul 2009 14:58:56 +0000 Subject: This commit was manufactured by cvs2svn to create branch 'msnyder- checkpoint-072509-branch'. Sprout from dje-cgen-play1-branch 2009-06-26 17:19:08 UTC cvs2svn 'This commit was manufactured by cvs2svn to create branch 'dje-cgen-' Cherrypick from master 2009-07-25 14:58:55 UTC H.J. Lu 'bfd/': ChangeLog config/ChangeLog config/tls.m4 configure configure.ac djunpack.bat include/ChangeLog include/demangle.h include/dwarf2.h include/elf/ChangeLog include/elf/common.h include/elf/ppc.h include/elf/ppc64.h include/elf/spu.h include/libiberty.h Delete: include/elf/dwarf2.h --- config/tls.m4 | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'config/tls.m4') diff --git a/config/tls.m4 b/config/tls.m4 index acb123f69..0ae60460b 100644 --- a/config/tls.m4 +++ b/config/tls.m4 @@ -1,5 +1,6 @@ dnl Check whether the target supports TLS. AC_DEFUN([GCC_CHECK_TLS], [ + AC_REQUIRE([AC_CANONICAL_HOST]) GCC_ENABLE(tls, yes, [], [Use thread-local storage]) AC_CACHE_CHECK([whether the target supports thread-local storage], gcc_cv_have_tls, [ @@ -66,7 +67,24 @@ AC_DEFUN([GCC_CHECK_TLS], [ [dnl This is the cross-compiling case. Assume libc supports TLS if the dnl binutils and the compiler do. AC_LINK_IFELSE([__thread int a; int b; int main() { return a = b; }], - [gcc_cv_have_tls=yes], [gcc_cv_have_tls=no]) + [chktls_save_LDFLAGS="$LDFLAGS" + dnl Shared library options may depend on the host; this check + dnl is only known to be needed for GNU/Linux. + case $host in + *-*-linux*) + LDFLAGS="-shared -Wl,--no-undefined $LDFLAGS" + ;; + esac + chktls_save_CFLAGS="$CFLAGS" + CFLAGS="-fPIC $CFLAGS" + dnl If -shared works, test if TLS works in a shared library. + AC_LINK_IFELSE([int f() { return 0; }], + [AC_LINK_IFELSE([__thread int a; int b; int f() { return a = b; }], + [gcc_cv_have_tls=yes], + [gcc_cv_have_tls=no])], + [gcc_cv_have_tls=yes]) + CFLAGS="$chktls_save_CFLAGS" + LDFLAGS="$chktls_save_LDFLAGS"], [gcc_cv_have_tls=no]) ] )]) if test "$enable_tls $gcc_cv_have_tls" = "yes yes"; then -- cgit v1.2.3