This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[gold] PATCH: Check if -fpic -mtls-dialect=gnu2 works
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: binutils at sourceware dot org
- Cc: Ian Lance Taylor <iant at google dot com>
- Date: Mon, 30 Jan 2012 10:07:39 -0800
- Subject: [gold] PATCH: Check if -fpic -mtls-dialect=gnu2 works
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi Ian,
"-fpic -mtls-dialect=gnu2" isn't working for x32 yet. This patch checks
if -fpic -mtls-dialect=gnu2 works before enabling it. OK to install?
Thanks.
H.J.
---
2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
* configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
* configure: Regenerated.
diff --git a/gold/configure b/gold/configure
index aca7cab..b1744a8 100755
--- a/gold/configure
+++ b/gold/configure
@@ -6437,10 +6437,16 @@ fi
save_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -mtls-dialect=gnu2"
+CFLAGS="$CFLAGS -fpic -mtls-dialect=gnu2"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-int i;
+
+__thread int i;
+void foo (void)
+{
+ i = 10;
+}
+
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
have_tls_gnu2=yes
diff --git a/gold/configure.ac b/gold/configure.ac
index e49bf21..edc5917 100644
--- a/gold/configure.ac
+++ b/gold/configure.ac
@@ -359,8 +359,14 @@ AM_CONDITIONAL(OMP_SUPPORT, test "$gold_cv_c_threadprivate" = "yes")
dnl Test for the -ftls-dialect=gnu2 option.
save_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -mtls-dialect=gnu2"
-AC_COMPILE_IFELSE([int i;], [have_tls_gnu2=yes], [have_tls_gnu2=no])
+CFLAGS="$CFLAGS -fpic -mtls-dialect=gnu2"
+AC_COMPILE_IFELSE([
+__thread int i;
+void foo (void)
+{
+ i = 10;
+}
+], [have_tls_gnu2=yes], [have_tls_gnu2=no])
CFLAGS="$save_CFLAGS"
AM_CONDITIONAL(TLS_GNU2_DIALECT, test "$have_tls_gnu2" = "yes")