dnl
dnl Defines:
dnl SECTION_LDFLAGS='-Wl,--gc-sections' if possible
-dnl OPT_LDFLAGS='-Wl,-O1' 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
$AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
# Set --gc-sections.
- if test "$with_gnu_ld" = "notbroken"; then
+ if test x"$with_gnu_ld" = x"yes"; 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++
+ # All these tests are for C++, but run with the "C" compiler driver.
+ # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
- CFLAGS='-x c++ -Wl,--gc-sections'
+ CFLAGS='-x c++ -Werror -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])
+ 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
+ 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
- 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
+ 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_sectionLDflags)
+ AC_MSG_RESULT($ac_ld_relro)
fi
# Set linker optimization flags.
dnl baseline_dir
dnl
AC_DEFUN([GLIBCXX_CONFIGURE_TESTSUITE], [
- if $GLIBCXX_IS_NATIVE && test $is_hosted = yes &&
- test $enable_symvers != no; then
+ if $GLIBCXX_IS_NATIVE ; then
# Do checks for resource limit functions.
GLIBCXX_CHECK_SETRLIMIT
# Look for setenv, so that extended locale tests can be performed.
GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_3(setenv)
+ fi
- if test $enable_symvers = no; then
- enable_abi_check=no
- else
- case "$host" in
- *-*-cygwin*)
- enable_abi_check=no ;;
- *)
- enable_abi_check=yes ;;
- esac
- fi
+ if $GLIBCXX_IS_NATIVE && test $is_hosted = yes &&
+ test $enable_symvers != no; then
+ case "$host" in
+ *-*-cygwin*)
+ enable_abi_check=no ;;
+ *)
+ enable_abi_check=yes ;;
+ esac
else
# Only build this as native, since automake does not understand
# CXX_FOR_BUILD.
fi
# Export file names for ABI checking.
- baseline_dir="$glibcxx_srcdir/config/abi/${abi_baseline_pair}\$(MULTISUBDIR)"
+ baseline_dir="$glibcxx_srcdir/config/abi/post/${abi_baseline_pair}\$(MULTISUBDIR)"
AC_SUBST(baseline_dir)
])
if test $enable_libstdcxx_allocator_flag = auto; then
case ${target_os} in
linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
- enable_libstdcxx_allocator_flag=mt
+ enable_libstdcxx_allocator_flag=new
;;
*)
enable_libstdcxx_allocator_flag=new
dnl glibcxx_PCHFLAGS
dnl
AC_DEFUN([GLIBCXX_ENABLE_PCH], [
- AC_MSG_CHECKING([for enabled PCH])
GLIBCXX_ENABLE(libstdcxx-pch,$1,,[build pre-compiled libstdc++ headers])
- AC_MSG_RESULT([$enable_libstdcxx_pch])
-
if test $enable_libstdcxx_pch = yes; then
AC_CACHE_CHECK([for compiler with PCH support],
[glibcxx_cv_prog_CXX_pch],
enable_libstdcxx_pch=$glibcxx_cv_prog_CXX_pch
fi
+ AC_MSG_CHECKING([for enabled PCH])
+ AC_MSG_RESULT([$enable_libstdcxx_pch])
+
GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_PCH, test $enable_libstdcxx_pch = yes)
if test $enable_libstdcxx_pch = yes; then
glibcxx_PCHFLAGS="-include bits/stdc++.h"
rm -f conftest*
fi
- # This is a tad weird, for hysterical raisins. We have to map enable/disable
- # to two different models.
+ # This is a tad weird, for hysterical raisins. We have to map
+ # enable/disable to two different models.
case $enable_sjlj_exceptions in
yes)
AC_DEFINE(_GLIBCXX_SJLJ_EXCEPTIONS, 1,
GLIBCXX_ENABLE(symvers,$1,[=STYLE],
[enables symbol versioning of the shared library],
- [permit yes|no|gnu|darwin-export])
+ [permit yes|no|gnu|gnu-versioned-namespace|darwin|darwin-export])
# If we never went through the GLIBCXX_CHECK_LINKER_FEATURES macro, then we
# don't know enough about $LD to do tricks...
# Turn a 'yes' into a suitable default.
if test x$enable_symvers = xyes ; then
- if test $enable_shared = no ||
- test "x$LD" = x ; then
+ if test $enable_shared = no || test "x$LD" = x ; then
enable_symvers=no
- elif test $with_gnu_ld == yes ; then
- enable_symvers=gnu
else
- case ${target_os} in
- darwin*)
- enable_symvers=darwin-export ;;
- *)
- AC_MSG_WARN([=== You have requested some kind of symbol versioning, but])
- AC_MSG_WARN([=== you are not using a supported linker.])
- AC_MSG_WARN([=== Symbol versioning will be disabled.])
- enable_symvers=no ;;
- esac
+ if test $with_gnu_ld = yes ; then
+ enable_symvers=gnu
+ else
+ case ${target_os} in
+ darwin*)
+ enable_symvers=darwin ;;
+ *)
+ enable_symvers=no ;;
+ esac
+ fi
fi
fi
-# Check to see if libgcc_s exists, indicating that shared libgcc is possible.
-if test $enable_symvers != no; then
+# Check to see if 'darwin' or 'darwin-export' can win.
+if test x$enable_symvers = xdarwin-export ; then
+ enable_symvers=darwin
+fi
+
+# Check to see if 'gnu' can win.
+if test $enable_symvers = gnu || test $enable_symvers = gnu-versioned-namespace; then
+ # Check to see if libgcc_s exists, indicating that shared libgcc is possible.
AC_MSG_CHECKING([for shared libgcc])
ac_save_CFLAGS="$CFLAGS"
CFLAGS=' -lgcc_s'
fi
fi
AC_MSG_RESULT($glibcxx_shared_libgcc)
-fi
-
-# If no shared libgcc, can't win.
-if test $glibcxx_shared_libgcc != yes &&
- test $enable_symvers != no ; then
- AC_MSG_WARN([=== You have requested some kind of symbol versioning, but])
- AC_MSG_WARN([=== you are not building a shared libgcc_s.])
- AC_MSG_WARN([=== Symbol versioning will be disabled.])
- enable_symvers=no
- enable_symvers=no
-fi
-# Check to see if 'gnu' can win.
-if test $enable_symvers = gnu; then
# For GNU ld, we need at least this version. The format is described in
# GLIBCXX_CHECK_LINKER_FEATURES above.
glibcxx_min_gnu_ld_version=21400
- if test $with_gnu_ld != yes ; then
+ # If no shared libgcc, can't win.
+ if test $glibcxx_shared_libgcc != yes; then
+ AC_MSG_WARN([=== You have requested GNU symbol versioning, but])
+ AC_MSG_WARN([=== you are not building a shared libgcc_s.])
+ AC_MSG_WARN([=== Symbol versioning will be disabled.])
+ enable_symvers=no
+ elif test $with_gnu_ld != yes ; then
# just fail for now
AC_MSG_WARN([=== You have requested GNU symbol versioning, but])
AC_MSG_WARN([=== you are not using the GNU linker.])
# Everything parsed; figure out what file to use.
case $enable_symvers in
no)
- SYMVER_MAP=config/linker-map.dummy
+ SYMVER_FILE=config/abi/pre/none.ver
;;
gnu)
- SYMVER_MAP=config/linker-map.gnu
- AC_DEFINE(_GLIBCXX_SYMVER, 1,
- [Define to use GNU symbol versioning in the shared library.])
+ SYMVER_FILE=config/abi/pre/gnu.ver
+ AC_DEFINE(_GLIBCXX_SYMVER_GNU, 1,
+ [Define to use GNU versioning in the shared library.])
;;
- darwin-export)
- SYMVER_MAP=config/linker-map.gnu
+ gnu-versioned-namespace)
+ SYMVER_FILE=config/abi/pre/gnu-versioned-namespace.ver
+ AC_DEFINE(_GLIBCXX_SYMVER_GNU_NAMESPACE, 1,
+ [Define to use GNU namespace versioning in the shared library.])
+ ;;
+ darwin)
+ SYMVER_FILE=config/abi/pre/gnu.ver
+ AC_DEFINE(_GLIBCXX_SYMVER_DARWIN, 1,
+ [Define to use darwin versioning in the shared library.])
;;
esac
+if test x$enable_symvers != xno ; then
+ AC_DEFINE(_GLIBCXX_SYMVER, 1,
+ [Define to use symbol versioning in the shared library.])
+fi
+
+AC_SUBST(SYMVER_FILE)
+AC_SUBST(port_specific_symbol_files)
+GLIBCXX_CONDITIONAL(ENABLE_SYMVERS, test $enable_symvers != no)
+GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_GNU, test $enable_symvers = gnu)
+GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_GNU_NAMESPACE, test $enable_symvers = gnu-versioned-namespace)
+GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_DARWIN, test $enable_symvers = darwin)
+AC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers)
+
+# Now, set up compatibility support, if any.
# In addition, need this to deal with std::size_t mangling in
# src/compatibility.cc. In a perfect world, could use
# typeid(std::size_t).name()[0] to do direct substitution.
AC_DEFINE(_GLIBCXX_PTRDIFF_T_IS_INT, 1, [Define if ptrdiff_t is int.])
fi
AC_MSG_RESULT([$glibcxx_ptrdiff_t_is_i])
-
-AC_SUBST(SYMVER_MAP)
-AC_SUBST(port_specific_symbol_files)
-GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_GNU, test $enable_symvers == gnu)
-GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_DARWIN_EXPORT, dnl
- test $enable_symvers == darwin-export)
-AC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers)
])
])
])
+# Macros from the top-level gcc directory.
+m4_include([../config/tls.m4])
-dnl vim:et:ts=2:sw=2