@@ -0,0 +1,6 @@
+2011-11-07 Torvald Riegel <triegel@redhat.com>
+
+ Merged from transactional-memory.
+
+ * exportcontrols.m4: New file; based on libgfortran's and
+ libstdc++v3's acinclude.m4.
new file mode 100644
@@ -0,0 +1,182 @@
+dnl ----------------------------------------------------------------------
+dnl This whole bit snagged from libgfortran.
+
+dnl Check whether the target supports hidden visibility.
+AC_DEFUN([GCC_CHECK_ATTRIBUTE_VISIBILITY], [
+ AC_CACHE_CHECK([whether the target supports hidden visibility],
+ gcc_cv_have_attribute_visibility, [
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror"
+ AC_TRY_COMPILE([void __attribute__((visibility("hidden"))) foo(void) { }],
+ [], gcc_cv_have_attribute_visibility=yes,
+ gcc_cv_have_attribute_visibility=no)
+ CFLAGS="$save_CFLAGS"])
+ if test $gcc_cv_have_attribute_visibility = yes; then
+ AC_DEFINE(HAVE_ATTRIBUTE_VISIBILITY, 1,
+ [Define to 1 if the target supports __attribute__((visibility(...))).])
+ fi])
+
+dnl Check whether the target supports dllexport
+AC_DEFUN([GCC_CHECK_ATTRIBUTE_DLLEXPORT], [
+ AC_CACHE_CHECK([whether the target supports dllexport],
+ gcc_cv_have_attribute_dllexport, [
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror"
+ AC_TRY_COMPILE([void __attribute__((dllexport)) foo(void) { }],
+ [], gcc_cv_have_attribute_dllexport=yes,
+ gcc_cv_have_attribute_dllexport=no)
+ CFLAGS="$save_CFLAGS"])
+ if test $gcc_cv_have_attribute_dllexport = yes; then
+ AC_DEFINE(HAVE_ATTRIBUTE_DLLEXPORT, 1,
+ [Define to 1 if the target supports __attribute__((dllexport)).])
+ fi])
+
+dnl Check whether the target supports symbol aliases.
+AC_DEFUN([GCC_CHECK_ATTRIBUTE_ALIAS], [
+ AC_CACHE_CHECK([whether the target supports symbol aliases],
+ gcc_cv_have_attribute_alias, [
+ AC_TRY_LINK([
+void foo(void) { }
+extern void bar(void) __attribute__((alias("foo")));],
+ [bar();], gcc_cv_have_attribute_alias=yes, gcc_cv_have_attribute_alias=no)])
+ if test $gcc_cv_have_attribute_alias = yes; then
+ AC_DEFINE(HAVE_ATTRIBUTE_ALIAS, 1,
+ [Define to 1 if the target supports __attribute__((alias(...))).])
+ fi])
+
+
+dnl ----------------------------------------------------------------------
+dnl This whole bit snagged from libstdc++v3.
+
+dnl
+dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
+dnl the native linker is in use, all variables will be defined to something
+dnl safe (like an empty string).
+dnl
+dnl Defines:
+dnl SECTION_LDFLAGS='-Wl,--gc-sections' if possible
+dnl OPT_LDFLAGS='-Wl,-O1' and '-z,relro' if possible
+dnl LD (as a side effect of testing)
+dnl Sets:
+dnl with_gnu_ld
+dnl gcc_ld_is_gold (set to "no" or "yes")
+dnl gcc_gnu_ld_version (possibly)
+dnl
+dnl The last will be a single integer, e.g., version 1.23.45.0.67.89 will
+dnl set gcc_gnu_ld_version to 12345. Zeros cause problems.
+dnl
+AC_DEFUN([GCC_CHECK_LINKER_FEATURES], [
+ # If we're not using GNU ld, then there's no point in even trying these
+ # tests. Check for that first. We should have already tested for gld
+ # by now (in libtool), but require it now just to be safe...
+ test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
+ test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
+ AC_REQUIRE([AC_PROG_LD])
+ AC_REQUIRE([AC_PROG_AWK])
+
+ # The name set by libtool depends on the version of libtool. Shame on us
+ # for depending on an impl detail, but c'est la vie. Older versions used
+ # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
+ # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
+ # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't
+ # set (hence we're using an older libtool), then set it.
+ if test x${with_gnu_ld+set} != xset; then
+ if test x${ac_cv_prog_gnu_ld+set} != xset; then
+ # We got through "ac_require(ac_prog_ld)" and still not set? Huh?
+ with_gnu_ld=no
+ else
+ with_gnu_ld=$ac_cv_prog_gnu_ld
+ fi
+ fi
+
+ # Start by getting the version number. I think the libtool test already
+ # does some of this, but throws away the result.
+ gcc_ld_is_gold=no
+ if test x"$with_gnu_ld" = x"yes"; then
+ AC_MSG_CHECKING([for ld version])
+ changequote(,)
+ if $LD --version 2>/dev/null | grep 'GNU gold' >/dev/null 2>&1; then
+ gcc_ld_is_gold=yes
+ fi
+ ldver=`$LD --version 2>/dev/null |
+ sed -e 's/GNU gold /GNU ld /;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
+ changequote([,])
+ gcc_gnu_ld_version=`echo $ldver | \
+ $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
+ AC_MSG_RESULT($gcc_gnu_ld_version)
+ fi
+
+ # Set --gc-sections.
+ gcc_have_gc_sections=no
+ if test "$gcc_ld_is_gold" = "yes"; then
+ if $LD --help 2>/dev/null | grep gc-sections >/dev/null 2>&1; then
+ gcc_have_gc_sections=yes
+ fi
+ else
+ gcc_gcsections_min_ld=21602
+ if test x"$with_gnu_ld" = x"yes" &&
+ test $gcc_gnu_ld_version -gt $gcc_gcsections_min_ld ; then
+ gcc_have_gc_sections=yes
+ fi
+ fi
+ if test "$gcc_have_gc_sections" = "yes"; then
+ # Sufficiently young GNU ld it is! Joy and bunny rabbits!
+ # NB: This flag only works reliably after 2.16.1. Configure tests
+ # for this are difficult, so hard wire a value that should work.
+
+ ac_test_CFLAGS="${CFLAGS+set}"
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS='-Wl,--gc-sections'
+
+ # Check for -Wl,--gc-sections
+ AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
+ AC_TRY_LINK([ int one(void) { return 1; }
+ int two(void) { return 2; }
+ ], [ two(); ] , [ac_gcsections=yes], [ac_gcsections=no])
+ if test "$ac_gcsections" = "yes"; then
+ rm -f conftest.c
+ touch conftest.c
+ if $CC -c conftest.c; then
+ if $LD --gc-sections -o conftest conftest.o 2>&1 | \
+ grep "Warning: gc-sections option ignored" > /dev/null; then
+ ac_gcsections=no
+ fi
+ fi
+ rm -f conftest.c conftest.o conftest
+ fi
+ if test "$ac_gcsections" = "yes"; then
+ SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
+ fi
+ AC_MSG_RESULT($ac_gcsections)
+
+ if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+ else
+ # this is the suspicious part
+ CFLAGS=''
+ fi
+ fi
+
+ # Set -z,relro.
+ # Note this is only for shared objects.
+ ac_ld_relro=no
+ if test x"$with_gnu_ld" = x"yes"; then
+ AC_MSG_CHECKING([for ld that supports -Wl,-z,relro])
+ cxx_z_relo=`$LD -v --help 2>/dev/null | grep "z relro"`
+ if test -n "$cxx_z_relo"; then
+ OPT_LDFLAGS="-Wl,-z,relro"
+ ac_ld_relro=yes
+ fi
+ AC_MSG_RESULT($ac_ld_relro)
+ fi
+
+ # Set linker optimization flags.
+ if test x"$with_gnu_ld" = x"yes"; then
+ OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
+ fi
+
+ AC_SUBST(SECTION_LDFLAGS)
+ AC_SUBST(OPT_LDFLAGS)
+])
+
+
@@ -1,5 +1,6 @@
dnl ----------------------------------------------------------------------
-dnl This whole bit snagged from libgfortran.
+dnl sync built-ins checks are similar to the ones used in libgfortran/libgomp.
+dnl ??? Generalize at some point?
dnl Check whether the target supports __sync_*_compare_and_swap.
AC_DEFUN([LIBITM_CHECK_SYNC_BUILTINS], [
@@ -26,49 +27,6 @@ AC_DEFUN([LIBITM_CHECK_64BIT_SYNC_BUILTINS], [
[Define to 1 if the target supports 64-bit __sync_*_compare_and_swap])
fi])
-dnl Check whether the target supports hidden visibility.
-AC_DEFUN([LIBITM_CHECK_ATTRIBUTE_VISIBILITY], [
- AC_CACHE_CHECK([whether the target supports hidden visibility],
- libitm_cv_have_attribute_visibility, [
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -Werror"
- AC_TRY_COMPILE([void __attribute__((visibility("hidden"))) foo(void) { }],
- [], libitm_cv_have_attribute_visibility=yes,
- libitm_cv_have_attribute_visibility=no)
- CFLAGS="$save_CFLAGS"])
- if test $libitm_cv_have_attribute_visibility = yes; then
- AC_DEFINE(HAVE_ATTRIBUTE_VISIBILITY, 1,
- [Define to 1 if the target supports __attribute__((visibility(...))).])
- fi])
-
-dnl Check whether the target supports dllexport
-AC_DEFUN([LIBITM_CHECK_ATTRIBUTE_DLLEXPORT], [
- AC_CACHE_CHECK([whether the target supports dllexport],
- libitm_cv_have_attribute_dllexport, [
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -Werror"
- AC_TRY_COMPILE([void __attribute__((dllexport)) foo(void) { }],
- [], libitm_cv_have_attribute_dllexport=yes,
- libitm_cv_have_attribute_dllexport=no)
- CFLAGS="$save_CFLAGS"])
- if test $libitm_cv_have_attribute_dllexport = yes; then
- AC_DEFINE(HAVE_ATTRIBUTE_DLLEXPORT, 1,
- [Define to 1 if the target supports __attribute__((dllexport)).])
- fi])
-
-dnl Check whether the target supports symbol aliases.
-AC_DEFUN([LIBITM_CHECK_ATTRIBUTE_ALIAS], [
- AC_CACHE_CHECK([whether the target supports symbol aliases],
- libitm_cv_have_attribute_alias, [
- AC_TRY_LINK([
-void foo(void) { }
-extern void bar(void) __attribute__((alias("foo")));],
- [bar();], libitm_cv_have_attribute_alias=yes, libitm_cv_have_attribute_alias=no)])
- if test $libitm_cv_have_attribute_alias = yes; then
- AC_DEFINE(HAVE_ATTRIBUTE_ALIAS, 1,
- [Define to 1 if the target supports __attribute__((alias(...))).])
- fi])
-
dnl Check how size_t is mangled.
AC_DEFUN([LIBITM_CHECK_SIZE_T_MANGLING], [
AC_CACHE_CHECK([how size_t is mangled],
@@ -106,140 +64,8 @@ AC_DEFUN([AC_PROG_LD])
])
dnl ----------------------------------------------------------------------
-dnl This whole bit snagged from libstdc++-v3.
-
-dnl
-dnl LIBITM_ENABLE
-dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING)
-dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c)
-dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER)
-dnl
-dnl See docs/html/17_intro/configury.html#enable for documentation.
-dnl
-m4_define([LIBITM_ENABLE],[dnl
-m4_define([_g_switch],[--enable-$1])dnl
-m4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
- AC_ARG_ENABLE($1,_g_help,
- m4_bmatch([$5],
- [^permit ],
- [[
- case "$enableval" in
- m4_bpatsubst([$5],[permit ])) ;;
- *) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;;
- dnl Idea for future: generate a URL pointing to
- dnl "onlinedocs/configopts.html#whatever"
- esac
- ]],
- [^$],
- [[
- case "$enableval" in
- yes|no) ;;
- *) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;;
- esac
- ]],
- [[$5]]),
- [enable_]m4_bpatsubst([$1],-,_)[=][$2])
-m4_undefine([_g_switch])dnl
-m4_undefine([_g_help])dnl
-])
-
-
-dnl
-dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
-dnl the native linker is in use, all variables will be defined to something
-dnl safe (like an empty string).
-dnl
-dnl Defines:
-dnl SECTION_LDFLAGS='-Wl,--gc-sections' if possible
-dnl OPT_LDFLAGS='-Wl,-O1' if possible
-dnl LD (as a side effect of testing)
-dnl Sets:
-dnl with_gnu_ld
-dnl libitm_gnu_ld_version (possibly)
-dnl
-dnl The last will be a single integer, e.g., version 1.23.45.0.67.89 will
-dnl set libitm_gnu_ld_version to 12345. Zeros cause problems.
-dnl
-AC_DEFUN([LIBITM_CHECK_LINKER_FEATURES], [
- # If we're not using GNU ld, then there's no point in even trying these
- # tests. Check for that first. We should have already tested for gld
- # by now (in libtool), but require it now just to be safe...
- test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
- test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
- AC_REQUIRE([AC_PROG_LD])
- AC_REQUIRE([AC_PROG_AWK])
-
- # The name set by libtool depends on the version of libtool. Shame on us
- # for depending on an impl detail, but c'est la vie. Older versions used
- # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
- # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
- # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't
- # set (hence we're using an older libtool), then set it.
- if test x${with_gnu_ld+set} != xset; then
- if test x${ac_cv_prog_gnu_ld+set} != xset; then
- # We got through "ac_require(ac_prog_ld)" and still not set? Huh?
- with_gnu_ld=no
- else
- with_gnu_ld=$ac_cv_prog_gnu_ld
- fi
- fi
-
- # Start by getting the version number. I think the libtool test already
- # does some of this, but throws away the result.
- changequote(,)
- ldver=`$LD --version 2>/dev/null | head -1 | \
- sed -e 's/GNU ld \(version \)\{0,1\}\(([^)]*) \)\{0,1\}\([0-9.][0-9.]*\).*/\3/'`
- changequote([,])
- libitm_gnu_ld_version=`echo $ldver | \
- $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
-
- # Set --gc-sections.
- if test "$with_gnu_ld" = "notbroken"; then
- # GNU ld it is! Joy and bunny rabbits!
-
- # All these tests are for C++; save the language and the compiler flags.
- # Need to do this so that g++ won't try to link in libstdc++
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS='-x c++ -Wl,--gc-sections'
-
- # Check for -Wl,--gc-sections
- # XXX This test is broken at the moment, as symbols required for linking
- # are now in libsupc++ (not built yet). In addition, this test has
- # cored on solaris in the past. In addition, --gc-sections doesn't
- # really work at the moment (keeps on discarding used sections, first
- # .eh_frame and now some of the glibc sections for iconv).
- # Bzzzzt. Thanks for playing, maybe next time.
- AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
- AC_TRY_RUN([
- int main(void)
- {
- try { throw 1; }
- catch (...) { };
- return 0;
- }
- ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes])
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- else
- # this is the suspicious part
- CFLAGS=''
- fi
- if test "$ac_sectionLDflags" = "yes"; then
- SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
- fi
- AC_MSG_RESULT($ac_sectionLDflags)
- fi
-
- # Set linker optimization flags.
- if test x"$with_gnu_ld" = x"yes"; then
- OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
- fi
-
- AC_SUBST(SECTION_LDFLAGS)
- AC_SUBST(OPT_LDFLAGS)
-])
-
+dnl This whole bit is based on libstdc++-v3 but has been changed.
+dnl ??? Generalize at some point?
dnl
dnl Add version tags to symbols in shared library (or not), additionally
@@ -256,13 +82,13 @@ dnl 'no' disables versioning.
dnl
AC_DEFUN([LIBITM_ENABLE_SYMVERS], [
-LIBITM_ENABLE(symvers,yes,[=STYLE],
+GCC_ENABLE(symvers,yes,[=STYLE],
[enables symbol versioning of the shared library],
[permit yes|no|gnu])
# If we never went through the LIBITM_CHECK_LINKER_FEATURES macro, then we
# don't know enough about $LD to do tricks...
-AC_REQUIRE([LIBITM_CHECK_LINKER_FEATURES])
+AC_REQUIRE([GCC_CHECK_LINKER_FEATURES])
# FIXME The following test is too strict, in theory.
if test $enable_shared = no ||
test "x$LD" = x ||
@@ -308,7 +134,7 @@ if test $enable_symvers = yes; then
if test $with_gnu_ld = yes &&
test $libitm_shared_libgcc = yes;
then
- if test $libitm_gnu_ld_version -ge $libitm_min_gnu_ld_version ; then
+ if test $gcc_gnu_ld_version -ge $libitm_min_gnu_ld_version ; then
enable_symvers=gnu
else
# The right tools, the right setup, but too old. Fallbacks?
@@ -316,7 +142,7 @@ if test $enable_symvers = yes; then
AC_MSG_WARN(=== full symbol versioning support in this release of GCC.)
AC_MSG_WARN(=== You would need to upgrade your binutils to version)
AC_MSG_WARN(=== $libitm_min_gnu_ld_version or later and rebuild GCC.)
- if test $libitm_gnu_ld_version -ge 21200 ; then
+ if test $gcc_gnu_ld_version -ge 21200 ; then
# Globbing fix is present, proper block support is not.
dnl AC_MSG_WARN([=== Dude, you are soooo close. Maybe we can fake it.])
dnl enable_symvers=???
@@ -1000,6 +1000,7 @@ m4_include([../config/multi.m4])
m4_include([../config/override.m4])
m4_include([../config/stdint.m4])
m4_include([../config/tls.m4])
+m4_include([../config/exportcontrols.m4])
m4_include([../ltoptions.m4])
m4_include([../ltsugar.m4])
m4_include([../ltversion.m4])
@@ -16448,7 +16448,7 @@ $as_echo "#define HAVE_TLS 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the target supports hidden visibility" >&5
$as_echo_n "checking whether the target supports hidden visibility... " >&6; }
-if test "${libitm_cv_have_attribute_visibility+set}" = set; then :
+if test "${gcc_cv_have_attribute_visibility+set}" = set; then :
$as_echo_n "(cached) " >&6
else
@@ -16466,16 +16466,16 @@ main ()
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
- libitm_cv_have_attribute_visibility=yes
+ gcc_cv_have_attribute_visibility=yes
else
- libitm_cv_have_attribute_visibility=no
+ gcc_cv_have_attribute_visibility=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS="$save_CFLAGS"
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libitm_cv_have_attribute_visibility" >&5
-$as_echo "$libitm_cv_have_attribute_visibility" >&6; }
- if test $libitm_cv_have_attribute_visibility = yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_have_attribute_visibility" >&5
+$as_echo "$gcc_cv_have_attribute_visibility" >&6; }
+ if test $gcc_cv_have_attribute_visibility = yes; then
$as_echo "#define HAVE_ATTRIBUTE_VISIBILITY 1" >>confdefs.h
@@ -16483,7 +16483,7 @@ $as_echo "#define HAVE_ATTRIBUTE_VISIBILITY 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the target supports dllexport" >&5
$as_echo_n "checking whether the target supports dllexport... " >&6; }
-if test "${libitm_cv_have_attribute_dllexport+set}" = set; then :
+if test "${gcc_cv_have_attribute_dllexport+set}" = set; then :
$as_echo_n "(cached) " >&6
else
@@ -16501,16 +16501,16 @@ main ()
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
- libitm_cv_have_attribute_dllexport=yes
+ gcc_cv_have_attribute_dllexport=yes
else
- libitm_cv_have_attribute_dllexport=no
+ gcc_cv_have_attribute_dllexport=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS="$save_CFLAGS"
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libitm_cv_have_attribute_dllexport" >&5
-$as_echo "$libitm_cv_have_attribute_dllexport" >&6; }
- if test $libitm_cv_have_attribute_dllexport = yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_have_attribute_dllexport" >&5
+$as_echo "$gcc_cv_have_attribute_dllexport" >&6; }
+ if test $gcc_cv_have_attribute_dllexport = yes; then
$as_echo "#define HAVE_ATTRIBUTE_DLLEXPORT 1" >>confdefs.h
@@ -16518,7 +16518,7 @@ $as_echo "#define HAVE_ATTRIBUTE_DLLEXPORT 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the target supports symbol aliases" >&5
$as_echo_n "checking whether the target supports symbol aliases... " >&6; }
-if test "${libitm_cv_have_attribute_alias+set}" = set; then :
+if test "${gcc_cv_have_attribute_alias+set}" = set; then :
$as_echo_n "(cached) " >&6
else
@@ -16536,16 +16536,16 @@ bar();
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- libitm_cv_have_attribute_alias=yes
+ gcc_cv_have_attribute_alias=yes
else
- libitm_cv_have_attribute_alias=no
+ gcc_cv_have_attribute_alias=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libitm_cv_have_attribute_alias" >&5
-$as_echo "$libitm_cv_have_attribute_alias" >&6; }
- if test $libitm_cv_have_attribute_alias = yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_have_attribute_alias" >&5
+$as_echo "$gcc_cv_have_attribute_alias" >&6; }
+ if test $gcc_cv_have_attribute_alias = yes; then
$as_echo "#define HAVE_ATTRIBUTE_ALIAS 1" >>confdefs.h
@@ -16686,54 +16686,84 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
# Start by getting the version number. I think the libtool test already
# does some of this, but throws away the result.
+ gcc_ld_is_gold=no
+ if test x"$with_gnu_ld" = x"yes"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld version" >&5
+$as_echo_n "checking for ld version... " >&6; }
- ldver=`$LD --version 2>/dev/null | head -1 | \
- sed -e 's/GNU ld \(version \)\{0,1\}\(([^)]*) \)\{0,1\}\([0-9.][0-9.]*\).*/\3/'`
+ if $LD --version 2>/dev/null | grep 'GNU gold' >/dev/null 2>&1; then
+ gcc_ld_is_gold=yes
+ fi
+ ldver=`$LD --version 2>/dev/null |
+ sed -e 's/GNU gold /GNU ld /;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
- libitm_gnu_ld_version=`echo $ldver | \
- $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'`
+ gcc_gnu_ld_version=`echo $ldver | \
+ $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_gnu_ld_version" >&5
+$as_echo "$gcc_gnu_ld_version" >&6; }
+ fi
# Set --gc-sections.
- if test "$with_gnu_ld" = "notbroken"; then
- # GNU ld it is! Joy and bunny rabbits!
+ gcc_have_gc_sections=no
+ if test "$gcc_ld_is_gold" = "yes"; then
+ if $LD --help 2>/dev/null | grep gc-sections >/dev/null 2>&1; then
+ gcc_have_gc_sections=yes
+ fi
+ else
+ gcc_gcsections_min_ld=21602
+ if test x"$with_gnu_ld" = x"yes" &&
+ test $gcc_gnu_ld_version -gt $gcc_gcsections_min_ld ; then
+ gcc_have_gc_sections=yes
+ fi
+ fi
+ if test "$gcc_have_gc_sections" = "yes"; then
+ # Sufficiently young GNU ld it is! Joy and bunny rabbits!
+ # NB: This flag only works reliably after 2.16.1. Configure tests
+ # for this are difficult, so hard wire a value that should work.
- # All these tests are for C++; save the language and the compiler flags.
- # Need to do this so that g++ won't try to link in libstdc++
ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
- CFLAGS='-x c++ -Wl,--gc-sections'
+ CFLAGS='-Wl,--gc-sections'
# Check for -Wl,--gc-sections
- # XXX This test is broken at the moment, as symbols required for linking
- # are now in libsupc++ (not built yet). In addition, this test has
- # cored on solaris in the past. In addition, --gc-sections doesn't
- # really work at the moment (keeps on discarding used sections, first
- # .eh_frame and now some of the glibc sections for iconv).
- # Bzzzzt. Thanks for playing, maybe next time.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld that supports -Wl,--gc-sections" >&5
$as_echo_n "checking for ld that supports -Wl,--gc-sections... " >&6; }
- if test "$cross_compiling" = yes; then :
- ac_sectionLDflags=yes
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
+ int one(void) { return 1; }
+ int two(void) { return 2; }
- int main(void)
- {
- try { throw 1; }
- catch (...) { };
- return 0;
- }
-
+int
+main ()
+{
+ two();
+ ;
+ return 0;
+}
_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
- ac_sectionLDflags=yes
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_gcsections=yes
else
- ac_sectionLDflags=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
+ ac_gcsections=no
fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ if test "$ac_gcsections" = "yes"; then
+ rm -f conftest.c
+ touch conftest.c
+ if $CC -c conftest.c; then
+ if $LD --gc-sections -o conftest conftest.o 2>&1 | \
+ grep "Warning: gc-sections option ignored" > /dev/null; then
+ ac_gcsections=no
+ fi
+ fi
+ rm -f conftest.c conftest.o conftest
+ fi
+ if test "$ac_gcsections" = "yes"; then
+ SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_gcsections" >&5
+$as_echo "$ac_gcsections" >&6; }
if test "$ac_test_CFLAGS" = set; then
CFLAGS="$ac_save_CFLAGS"
@@ -16741,11 +16771,21 @@ fi
# this is the suspicious part
CFLAGS=''
fi
- if test "$ac_sectionLDflags" = "yes"; then
- SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
+ fi
+
+ # Set -z,relro.
+ # Note this is only for shared objects.
+ ac_ld_relro=no
+ if test x"$with_gnu_ld" = x"yes"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld that supports -Wl,-z,relro" >&5
+$as_echo_n "checking for ld that supports -Wl,-z,relro... " >&6; }
+ cxx_z_relo=`$LD -v --help 2>/dev/null | grep "z relro"`
+ if test -n "$cxx_z_relo"; then
+ OPT_LDFLAGS="-Wl,-z,relro"
+ ac_ld_relro=yes
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_sectionLDflags" >&5
-$as_echo "$ac_sectionLDflags" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ld_relro" >&5
+$as_echo "$ac_ld_relro" >&6; }
fi
# Set linker optimization flags.
@@ -16852,7 +16892,7 @@ if test $enable_symvers = yes; then
if test $with_gnu_ld = yes &&
test $libitm_shared_libgcc = yes;
then
- if test $libitm_gnu_ld_version -ge $libitm_min_gnu_ld_version ; then
+ if test $gcc_gnu_ld_version -ge $libitm_min_gnu_ld_version ; then
enable_symvers=gnu
else
# The right tools, the right setup, but too old. Fallbacks?
@@ -16864,7 +16904,7 @@ $as_echo "$as_me: WARNING: === full symbol versioning support in this release of
$as_echo "$as_me: WARNING: === You would need to upgrade your binutils to version" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: === $libitm_min_gnu_ld_version or later and rebuild GCC." >&5
$as_echo "$as_me: WARNING: === $libitm_min_gnu_ld_version or later and rebuild GCC." >&2;}
- if test $libitm_gnu_ld_version -ge 21200 ; then
+ if test $gcc_gnu_ld_version -ge 21200 ; then
# Globbing fix is present, proper block support is not.
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: === Symbol versioning will be disabled." >&5
$as_echo "$as_me: WARNING: === Symbol versioning will be disabled." >&2;}
@@ -24,7 +24,7 @@ AC_CONFIG_HEADER(config.h)
# -------
AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
-LIBITM_ENABLE(version-specific-runtime-libs, no, ,
+GCC_ENABLE(version-specific-runtime-libs, no, ,
[Specify that runtime libraries should be installed in a compiler-specific directory],
permit yes|no)
AC_MSG_RESULT($enable_version_specific_runtime_libs)
@@ -35,7 +35,7 @@ AC_MSG_RESULT($enable_version_specific_runtime_libs)
# sources. Therefore we have --enable-generated-files-in-srcdir to do
# just that.
AC_MSG_CHECKING([for --enable-generated-files-in-srcdir])
-LIBITM_ENABLE(generated-files-in-srcdir, no, ,
+GCC_ENABLE(generated-files-in-srcdir, no, ,
[put copies of generated files in source dir intended for creating source
tarballs for users without texinfo bison or flex.],
permit yes|no)
@@ -209,9 +209,9 @@ GCC_LINUX_FUTEX(:)
GCC_CHECK_TLS
# See what sort of export controls are availible.
-LIBITM_CHECK_ATTRIBUTE_VISIBILITY
-LIBITM_CHECK_ATTRIBUTE_DLLEXPORT
-LIBITM_CHECK_ATTRIBUTE_ALIAS
+GCC_CHECK_ATTRIBUTE_VISIBILITY
+GCC_CHECK_ATTRIBUTE_DLLEXPORT
+GCC_CHECK_ATTRIBUTE_ALIAS
LIBITM_ENABLE_SYMVERS
if test $enable_symvers = gnu; then