gcc/ 2007-06-15 H.J. Lu * configure.ac (ENABLE_DECIMAL_BID_FORMAT): Make it as a target template. (HAVE_TLS): Likewise. Use GCC_CHECK_TLS for native compiler of the native target. * aclocal.m4: Regenerated. * config.in: Likewise. * configure: Regenerated. libgcc/ 2007-06-15 H.J. Lu * Makefile.in (gcc_compile_bare): Add @use_tls@. * configure.ac: Include ../config/enable.m4 and ../config/tls.m4. Use GCC_CHECK_TLS for cross compiler and substitute use_tls. * configure: Regenerated. --- gcc/gcc/aclocal.m4.tls 2007-06-14 05:12:44.000000000 -0700 +++ gcc/gcc/aclocal.m4 2007-06-14 22:19:38.000000000 -0700 @@ -94,6 +94,7 @@ fi m4_include([../config/acx.m4]) m4_include([../config/codeset.m4]) +m4_include([../config/enable.m4]) m4_include([../config/gettext-sister.m4]) m4_include([../config/iconv.m4]) m4_include([../config/lcmessage.m4]) @@ -101,5 +102,6 @@ m4_include([../config/lib-ld.m4]) m4_include([../config/lib-link.m4]) m4_include([../config/lib-prefix.m4]) m4_include([../config/progtest.m4]) +m4_include([../config/tls.m4]) m4_include([../config/warnings.m4]) m4_include([acinclude.m4]) --- gcc/gcc/config.in.tls 2007-06-14 16:18:21.000000000 -0700 +++ gcc/gcc/config.in 2007-06-15 05:42:32.000000000 -0700 @@ -48,10 +48,7 @@ /* Define to 1 to specify that we are using the BID decimal floating point format instead of DPD */ -#ifndef USED_FOR_TARGET #undef ENABLE_DECIMAL_BID_FORMAT -#endif - /* Define to 1 to enable decimal float extension to C. */ #ifndef USED_FOR_TARGET @@ -1211,6 +1208,9 @@ #endif +/* Define to 1 if the target supports thread-local storage. */ +#undef HAVE_TLS + /* Define to 1 if you have the header file. */ #ifndef USED_FOR_TARGET #undef HAVE_UNISTD_H --- gcc/gcc/configure.ac.tls 2007-06-14 16:17:55.000000000 -0700 +++ gcc/gcc/configure.ac 2007-06-15 05:42:19.000000000 -0700 @@ -626,6 +626,7 @@ esac AC_SUBST(enable_decimal_float) bid=`if test $enable_decimal_float = bid; then echo 1; else echo 0; fi` +GCC_TARGET_TEMPLATE(ENABLE_DECIMAL_BID_FORMAT) AC_DEFINE_UNQUOTED(ENABLE_DECIMAL_BID_FORMAT, $bid, [Define to 1 to specify that we are using the BID decimal floating point format instead of DPD]) @@ -3419,6 +3420,18 @@ zlibinc= AC_SUBST(zlibdir) AC_SUBST(zlibinc) +# Check if we can really use thread-local storage. We can only check +# it with the native compiler for the native target since we want to +# know if our target will support thread-local storage, not the build +# machine. +if test x$build = x$target && test x$host = x$target; then + if test x$enable_tls = x; then + enable_tls=$set_have_as_tls + fi + GCC_TARGET_TEMPLATE(HAVE_TLS) + GCC_CHECK_TLS +fi + dnl Very limited version of automake's enable-maintainer-mode AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) --- gcc/libgcc/Makefile.in.tls 2007-06-14 22:19:38.000000000 -0700 +++ gcc/libgcc/Makefile.in 2007-06-14 22:19:38.000000000 -0700 @@ -225,7 +225,8 @@ MULTIOSSUBDIR := $(shell if test $(MULTI inst_libdir = $(libsubdir)$(MULTISUBDIR) inst_slibdir = $(slibdir)$(MULTIOSSUBDIR) -gcc_compile_bare = $(CC) $(INTERNAL_CFLAGS) +# If we can use thread-local storage +gcc_compile_bare = $(CC) $(INTERNAL_CFLAGS) @use_tls@ compile_deps = -MT $@ -MD -MP -MF $(basename $@).dep gcc_compile = $(gcc_compile_bare) -o $@ $(compile_deps) gcc_s_compile = $(gcc_compile) -DSHARED --- gcc/libgcc/configure.ac.tls 2007-06-14 22:19:38.000000000 -0700 +++ gcc/libgcc/configure.ac 2007-06-14 22:19:38.000000000 -0700 @@ -1,5 +1,7 @@ dnl Process this file with autoconf to produce a configure script. +sinclude(../config/enable.m4) +sinclude(../config/tls.m4) sinclude(../config/acx.m4) sinclude(../config/no-executables.m4) sinclude(../config/lib-ld.m4) @@ -169,6 +171,23 @@ else fi AC_SUBST(vis_hide) +# See if we support thread-local storage. We can only test it for +# cross build sicne it requires run-time test with the newly built +# gcc, which can't be used to build executable due to that libgcc +# is yet to be built here. For native build, we will check it in gcc. +# We define USE_TLS instead of HAVE_TLS as GCC_CHECK_TLS does since +# HAVE_TLS may be undefined in gcc when building a cross compiler. +# We need to check both USE_TLS and HAVE_TLS to see if TLS can be +# used in libgcc. +use_tls= +if test "$build" != "$host"; then + GCC_CHECK_TLS + if test "$enable_tls $use_tls" = "yes yes"; then + use_tls="-DUSE_TLS" + fi +fi +AC_SUBST(use_tls) + # Conditionalize the makefile for this target machine. tmake_file_= for f in ${tmake_file}