aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-10-14 03:57:22 +0000
committerIan Lance Taylor <iant@google.com>2007-10-14 03:57:22 +0000
commit097ec620e1fcc41ed0ab82ebcbb802f25df92a4a (patch)
treef35255a61f1ed0ea03178f0ef9de72838a679b1f
parent8261e3bfa575454a0a1cdeed6e989f9fa547c310 (diff)
downloadfsf-binutils-gdb-097ec620e1fcc41ed0ab82ebcbb802f25df92a4a.zip
fsf-binutils-gdb-097ec620e1fcc41ed0ab82ebcbb802f25df92a4a.tar.gz
fsf-binutils-gdb-097ec620e1fcc41ed0ab82ebcbb802f25df92a4a.tar.bz2
Only run static TLS tests on glibc 2.4 or later.
-rw-r--r--gold/Makefile.in2
-rwxr-xr-xgold/configure113
-rw-r--r--gold/configure.ac32
-rw-r--r--gold/testsuite/Makefile.am10
-rw-r--r--gold/testsuite/Makefile.in24
5 files changed, 153 insertions, 28 deletions
diff --git a/gold/Makefile.in b/gold/Makefile.in
index 9d9ff8c..8c979be 100644
--- a/gold/Makefile.in
+++ b/gold/Makefile.in
@@ -205,6 +205,8 @@ POSUB = @POSUB@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+STATIC_TLS_FALSE = @STATIC_TLS_FALSE@
+STATIC_TLS_TRUE = @STATIC_TLS_TRUE@
STRIP = @STRIP@
TARGETOBJS = @TARGETOBJS@
TLS_FALSE = @TLS_FALSE@
diff --git a/gold/configure b/gold/configure
index d127048..1da2adf 100755
--- a/gold/configure
+++ b/gold/configure
@@ -309,7 +309,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar TARGETOBJS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE YACC RANLIB ac_ct_RANLIB LN_S USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT MKINSTALLDIRS MSGFMT MSGMERGE NATIVE_LINKER_TRUE NATIVE_LINKER_FALSE GCC_TRUE GCC_FALSE FN_PTRS_IN_SO_WITHOUT_PIC_TRUE FN_PTRS_IN_SO_WITHOUT_PIC_FALSE TLS_TRUE TLS_FALSE WARN_CFLAGS NO_WERROR WARN_CXXFLAGS LFS_CXXFLAGS LIBOBJS CXXCPP EGREP MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar TARGETOBJS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE YACC RANLIB ac_ct_RANLIB LN_S USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT MKINSTALLDIRS MSGFMT MSGMERGE NATIVE_LINKER_TRUE NATIVE_LINKER_FALSE GCC_TRUE GCC_FALSE FN_PTRS_IN_SO_WITHOUT_PIC_TRUE FN_PTRS_IN_SO_WITHOUT_PIC_FALSE TLS_TRUE TLS_FALSE STATIC_TLS_TRUE STATIC_TLS_FALSE WARN_CFLAGS NO_WERROR WARN_CXXFLAGS LFS_CXXFLAGS LIBOBJS CXXCPP EGREP MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -4431,7 +4431,12 @@ else
fi
-cat >conftest.$ac_ext <<_ACEOF
+echo "$as_me:$LINENO: checking for thread support" >&5
+echo $ECHO_N "checking for thread support... $ECHO_C" >&6
+if test "${gold_cv_c_thread+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
__thread int i = 1;
_ACEOF
rm -f conftest.$ac_objext
@@ -4456,17 +4461,21 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- tls=yes
+ gold_cv_c_thread=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-tls=no
+gold_cv_c_thread=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $gold_cv_c_thread" >&5
+echo "${ECHO_T}$gold_cv_c_thread" >&6
-if test "$tls" = "yes"; then
+
+if test "$gold_cv_c_thread" = "yes"; then
TLS_TRUE=
TLS_FALSE='#'
else
@@ -4475,6 +4484,66 @@ else
fi
+echo "$as_me:$LINENO: checking for glibc >= 2.4" >&5
+echo $ECHO_N "checking for glibc >= 2.4... $ECHO_C" >&6
+if test "${gold_cv_lib_glibc24+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+
+#include <features.h>
+#if !defined __GLIBC__
+error
+#elif __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 4)
+error
+#endif
+
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ gold_cv_lib_glibc24=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+gold_cv_lib_glibc24=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $gold_cv_lib_glibc24" >&5
+echo "${ECHO_T}$gold_cv_lib_glibc24" >&6
+
+
+
+if test "$gold_cv_lib_glibc24" = "yes"; then
+ STATIC_TLS_TRUE=
+ STATIC_TLS_FALSE='#'
+else
+ STATIC_TLS_TRUE='#'
+ STATIC_TLS_FALSE=
+fi
+
+
GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
@@ -5545,7 +5614,12 @@ fi
done
-cat >conftest.$ac_ext <<_ACEOF
+echo "$as_me:$LINENO: checking template member calls" >&5
+echo $ECHO_N "checking template member calls... $ECHO_C" >&6
+if test "${gold_cv_c_membertemplates+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
class c { public: template<int i> void fn(); };
template<int i> void foo(c cv) { cv.fn<i>(); }
@@ -5573,17 +5647,25 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_MEMBER_TEMPLATE_SPECIFICATIONS
-_ACEOF
-
+ gold_cv_c_membertemplates=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
+gold_cv_c_membertemplates=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $gold_cv_c_membertemplates" >&5
+echo "${ECHO_T}$gold_cv_c_membertemplates" >&6
+
+if test "$gold_cv_c_membertemplates" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MEMBER_TEMPLATE_SPECIFICATIONS
+_ACEOF
+
+fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@@ -5758,6 +5840,13 @@ echo "$as_me: error: conditional \"TLS\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
+if test -z "${STATIC_TLS_TRUE}" && test -z "${STATIC_TLS_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"STATIC_TLS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"STATIC_TLS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@@ -6391,6 +6480,8 @@ s,@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@,$FN_PTRS_IN_SO_WITHOUT_PIC_TRUE,;t t
s,@FN_PTRS_IN_SO_WITHOUT_PIC_FALSE@,$FN_PTRS_IN_SO_WITHOUT_PIC_FALSE,;t t
s,@TLS_TRUE@,$TLS_TRUE,;t t
s,@TLS_FALSE@,$TLS_FALSE,;t t
+s,@STATIC_TLS_TRUE@,$STATIC_TLS_TRUE,;t t
+s,@STATIC_TLS_FALSE@,$STATIC_TLS_FALSE,;t t
s,@WARN_CFLAGS@,$WARN_CFLAGS,;t t
s,@NO_WERROR@,$NO_WERROR,;t t
s,@WARN_CXXFLAGS@,$WARN_CXXFLAGS,;t t
diff --git a/gold/configure.ac b/gold/configure.ac
index eb4416a..aefd617 100644
--- a/gold/configure.ac
+++ b/gold/configure.ac
@@ -152,8 +152,25 @@ AM_CONDITIONAL(FN_PTRS_IN_SO_WITHOUT_PIC, [
esac])
dnl Test for __thread support.
-AC_COMPILE_IFELSE([__thread int i = 1;], [tls=yes], [tls=no])
-AM_CONDITIONAL(TLS, test "$tls" = "yes")
+AC_CACHE_CHECK([for thread support], [gold_cv_c_thread],
+[AC_COMPILE_IFELSE([__thread int i = 1;],
+[gold_cv_c_thread=yes], [gold_cv_c_thread=no])])
+
+AM_CONDITIONAL(TLS, test "$gold_cv_c_thread" = "yes")
+
+dnl On GNU/Linux TLS in static programs only works when using glibc
+dnl 2.4 or later.
+AC_CACHE_CHECK([for glibc >= 2.4], [gold_cv_lib_glibc24],
+[AC_COMPILE_IFELSE([
+#include <features.h>
+#if !defined __GLIBC__
+error
+#elif __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 4)
+error
+#endif
+], [gold_cv_lib_glibc24=yes], [gold_cv_lib_glibc24=no])])
+
+AM_CONDITIONAL(STATIC_TLS, test "$gold_cv_lib_glibc24" = "yes")
AM_BINUTILS_WARNINGS
@@ -174,12 +191,17 @@ AC_CHECK_HEADERS(ext/hash_map ext/hash_set)
AC_CHECK_FUNCS(mallinfo)
dnl Test whether the compiler can specify a member templates to call.
-AC_COMPILE_IFELSE([
+AC_CACHE_CHECK([template member calls], [gold_cv_c_membertemplates],
+[AC_COMPILE_IFELSE([
class c { public: template<int i> void fn(); };
template<int i> void foo(c cv) { cv.fn<i>(); }
template void foo<1>(c cv);],
-[AC_DEFINE(HAVE_MEMBER_TEMPLATE_SPECIFICATIONS, [],
- [Whether the C++ compiler can call a template member with no arguments])])
+[gold_cv_c_membertemplates=yes], [gold_cv_c_membertemplates=no])])
+
+if test "$gold_cv_c_membertemplates" = "yes"; then
+ AC_DEFINE(HAVE_MEMBER_TEMPLATE_SPECIFICATIONS, [],
+ [Whether the C++ compiler can call a template member with no arguments])
+fi
AC_LANG_POP(C++)
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
index 8e1adb6..0221ee7 100644
--- a/gold/testsuite/Makefile.am
+++ b/gold/testsuite/Makefile.am
@@ -55,10 +55,16 @@ if TLS
NATIVE_PROGS += \
tls_test \
tls_pic_test \
- tls_static_test \
- tls_static_pic_test \
tls_shared_test
+if STATIC_TLS
+
+NATIVE_PROGS += \
+ tls_static_test \
+ tls_static_pic_test
+
+endif
+
if FN_PTRS_IN_SO_WITHOUT_PIC
NATIVE_PROGS += \
diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
index 56e6a09..35fbb42 100644
--- a/gold/testsuite/Makefile.in
+++ b/gold/testsuite/Makefile.in
@@ -52,14 +52,16 @@ target_triplet = @target@
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@am__append_2 = \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_pic_test \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_static_test \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_static_pic_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_shared_test
-@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@am__append_3 = \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@STATIC_TLS_TRUE@@TLS_TRUE@am__append_3 = \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@STATIC_TLS_TRUE@@TLS_TRUE@ tls_static_test \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@STATIC_TLS_TRUE@@TLS_TRUE@ tls_static_pic_test
+
+@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@am__append_4 = \
@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_shared_nonpic_test
-check_PROGRAMS = object_unittest$(EXEEXT) $(am__EXEEXT_4)
+check_PROGRAMS = object_unittest$(EXEEXT) $(am__EXEEXT_5)
@GCC_FALSE@constructor_test_DEPENDENCIES = libgoldtest.a ../libgold.a \
@GCC_FALSE@ ../../libiberty/libiberty.a $(am__DEPENDENCIES_1)
@NATIVE_LINKER_FALSE@constructor_test_DEPENDENCIES = libgoldtest.a \
@@ -131,11 +133,11 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest_a_OBJECTS)
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@am__EXEEXT_2 = \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_test$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_pic_test$(EXEEXT) \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_static_test$(EXEEXT) \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_static_pic_test$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_shared_test$(EXEEXT)
-@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@am__EXEEXT_3 = tls_shared_nonpic_test$(EXEEXT)
-@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_4 = \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@STATIC_TLS_TRUE@@TLS_TRUE@am__EXEEXT_3 = tls_static_test$(EXEEXT) \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@STATIC_TLS_TRUE@@TLS_TRUE@ tls_static_pic_test$(EXEEXT)
+@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@am__EXEEXT_4 = tls_shared_nonpic_test$(EXEEXT)
+@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_5 = \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ constructor_test$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ constructor_static_test$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test$(EXEEXT) \
@@ -154,7 +156,7 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest_a_OBJECTS)
@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_separate_shared_12_test$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_separate_shared_21_test$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(am__EXEEXT_1) $(am__EXEEXT_2) \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(am__EXEEXT_3)
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(am__EXEEXT_3) $(am__EXEEXT_4)
am__constructor_static_test_SOURCES_DIST = constructor_test.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@am_constructor_static_test_OBJECTS = \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ constructor_test.$(OBJEXT)
@@ -457,6 +459,8 @@ POSUB = @POSUB@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+STATIC_TLS_FALSE = @STATIC_TLS_FALSE@
+STATIC_TLS_TRUE = @STATIC_TLS_TRUE@
STRIP = @STRIP@
TARGETOBJS = @TARGETOBJS@
TLS_FALSE = @TLS_FALSE@
@@ -542,7 +546,7 @@ INCLUDES = -D_GNU_SOURCE \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_separate_shared_12_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_separate_shared_21_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(am__append_1) $(am__append_2) \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(am__append_3)
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(am__append_3) $(am__append_4)
@GCC_TRUE@@NATIVE_LINKER_TRUE@NATIVE_TESTING = \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ basic_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ basic_pic_test \