Browse Source

build: disable reduced exports by default

This is really a packager's option. While it's helpful to encourage devs to
test this option for daily builds, it's not reliable in several real-world
use-cases. Some older libstdc++ runtimes (freebsd 9, debian wheezy, for
example) fail to properly catch exceptions due to mismatched type_info.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19664 for more info.
0.13
Cory Fields 10 years ago
parent
commit
3ee028f131
  1. 35
      configure.ac

35
configure.ac

@ -115,9 +115,9 @@ AC_ARG_ENABLE([hardening],
AC_ARG_ENABLE([reduce-exports], AC_ARG_ENABLE([reduce-exports],
[AS_HELP_STRING([--enable-reduce-exports], [AS_HELP_STRING([--enable-reduce-exports],
[attempt to reduce exported symbols in the resulting executables (default is yes)])], [attempt to reduce exported symbols in the resulting executables (default is no)])],
[use_reduce_exports=$enableval], [use_reduce_exports=$enableval],
[use_reduce_exports=auto]) [use_reduce_exports=no])
AC_ARG_ENABLE([ccache], AC_ARG_ENABLE([ccache],
[AS_HELP_STRING([--enable-ccache], [AS_HELP_STRING([--enable-ccache],
@ -473,20 +473,12 @@ AC_LINK_IFELSE([AC_LANG_SOURCE([
if test x$use_reduce_exports = xyes; then if test x$use_reduce_exports = xyes; then
AC_MSG_ERROR([Cannot find a working visibility attribute. Use --disable-reduced-exports.]) AC_MSG_ERROR([Cannot find a working visibility attribute. Use --disable-reduced-exports.])
fi fi
AC_MSG_WARN([Cannot find a working visibility attribute. Disabling reduced exports.])
use_reduce_exports=no
] ]
) )
if test x$use_reduce_exports != xno; then
AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],[RE_CXXFLAGS="-fvisibility=hidden"],
[
if test x$use_reduce_exports = xyes; then if test x$use_reduce_exports = xyes; then
AC_MSG_ERROR([Cannot set default symbol visibility. Use --disable-reduced-exports.]) AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],[RE_CXXFLAGS="-fvisibility=hidden"],
fi [AC_MSG_ERROR([Cannot set default symbol visibility. Use --disable-reduced-exports.])])
AC_MSG_WARN([Cannot set default symbol visibility. Disabling reduced exports.])
use_reduce_exports=no
])
fi fi
LEVELDB_CPPFLAGS= LEVELDB_CPPFLAGS=
@ -533,7 +525,7 @@ AX_BOOST_THREAD
AX_BOOST_CHRONO AX_BOOST_CHRONO
if test x$use_reduce_exports != xno; then if test x$use_reduce_exports = xyes; then
AC_MSG_CHECKING([for working boost reduced exports]) AC_MSG_CHECKING([for working boost reduced exports])
TEMP_CPPFLAGS="$CPPFLAGS" TEMP_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$BOOST_CPPFLAGS $CPPFLAGS" CPPFLAGS="$BOOST_CPPFLAGS $CPPFLAGS"
@ -547,25 +539,14 @@ if test x$use_reduce_exports != xno; then
#endif #endif
]])],[ ]])],[
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
],[: ],[
if test x$use_reduce_exports = xauto; then
use_reduce_exports=no
else
if test x$use_reduce_exports = xyes; then
AC_MSG_ERROR([boost versions < 1.49 are known to be broken with reduced exports. Use --disable-reduced-exports.]) AC_MSG_ERROR([boost versions < 1.49 are known to be broken with reduced exports. Use --disable-reduced-exports.])
fi
fi
AC_MSG_RESULT(no)
AC_MSG_WARN([boost versions < 1.49 are known to have symbol visibility issues. Disabling reduced exports.])
]) ])
CPPFLAGS="$TEMP_CPPFLAGS" CPPFLAGS="$TEMP_CPPFLAGS"
fi fi
elif test x$use_reduce_exports = xauto; then
use_reduce_exports=yes
fi fi
if test x$use_reduce_exports != xno; then if test x$use_reduce_exports = xyes; then
CXXFLAGS="$CXXFLAGS $RE_CXXFLAGS" CXXFLAGS="$CXXFLAGS $RE_CXXFLAGS"
AX_CHECK_LINK_FLAG([[-Wl,--exclude-libs,ALL]], [RELDFLAGS="-Wl,--exclude-libs,ALL"]) AX_CHECK_LINK_FLAG([[-Wl,--exclude-libs,ALL]], [RELDFLAGS="-Wl,--exclude-libs,ALL"])
fi fi
@ -827,7 +808,7 @@ else
fi fi
AC_MSG_CHECKING([whether to reduce exports]) AC_MSG_CHECKING([whether to reduce exports])
if test x$use_reduce_exports != xno; then if test x$use_reduce_exports = xyes; then
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
else else
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])

Loading…
Cancel
Save