mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-18 22:35:39 +01:00
build: Split hardening/fPIE options out
This allows for fPIE to be used selectively.
This commit is contained in:
19
configure.ac
19
configure.ac
@@ -326,6 +326,7 @@ case $host in
|
||||
|
||||
AX_CHECK_LINK_FLAG([[-Wl,-headerpad_max_install_names]], [LDFLAGS="$LDFLAGS -Wl,-headerpad_max_install_names"])
|
||||
CPPFLAGS="$CPPFLAGS -DMAC_OSX"
|
||||
OBJCXXFLAGS="$CXXFLAGS"
|
||||
;;
|
||||
*linux*)
|
||||
TARGET_OS=linux
|
||||
@@ -424,6 +425,11 @@ if test x$use_glibc_compat != xno; then
|
||||
|
||||
fi
|
||||
|
||||
if test x$TARGET_OS != xwindows; then
|
||||
# All windows code is PIC, forcing it on just adds useless compile warnings
|
||||
AX_CHECK_COMPILE_FLAG([-fPIC],[PIC_FLAGS="-fPIC"])
|
||||
fi
|
||||
|
||||
if test x$use_hardening != xno; then
|
||||
AX_CHECK_COMPILE_FLAG([-Wstack-protector],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -Wstack-protector"])
|
||||
AX_CHECK_COMPILE_FLAG([-fstack-protector-all],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-protector-all"])
|
||||
@@ -441,8 +447,7 @@ if test x$use_hardening != xno; then
|
||||
AX_CHECK_LINK_FLAG([[-Wl,-z,now]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"])
|
||||
|
||||
if test x$TARGET_OS != xwindows; then
|
||||
# All windows code is PIC, forcing it on just adds useless compile warnings
|
||||
AX_CHECK_COMPILE_FLAG([-fPIE],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fPIE"])
|
||||
AX_CHECK_COMPILE_FLAG([-fPIE],[PIE_FLAGS="-fPIE"])
|
||||
AX_CHECK_LINK_FLAG([[-pie]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -pie"])
|
||||
fi
|
||||
|
||||
@@ -451,11 +456,6 @@ if test x$use_hardening != xno; then
|
||||
AC_CHECK_LIB([ssp], [main],, AC_MSG_ERROR(lib missing))
|
||||
;;
|
||||
esac
|
||||
|
||||
CXXFLAGS="$CXXFLAGS $HARDENED_CXXFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $HARDENED_CPPFLAGS"
|
||||
LDFLAGS="$LDFLAGS $HARDENED_LDFLAGS"
|
||||
OBJCXXFLAGS="$CXXFLAGS"
|
||||
fi
|
||||
|
||||
dnl this flag screws up non-darwin gcc even when the check fails. special-case it.
|
||||
@@ -915,6 +915,11 @@ AC_SUBST(CLIENT_VERSION_IS_RELEASE, _CLIENT_VERSION_IS_RELEASE)
|
||||
AC_SUBST(COPYRIGHT_YEAR, _COPYRIGHT_YEAR)
|
||||
|
||||
AC_SUBST(RELDFLAGS)
|
||||
AC_SUBST(HARDENED_CXXFLAGS)
|
||||
AC_SUBST(HARDENED_CPPFLAGS)
|
||||
AC_SUBST(HARDENED_LDFLAGS)
|
||||
AC_SUBST(PIC_FLAGS)
|
||||
AC_SUBST(PIE_FLAGS)
|
||||
AC_SUBST(LIBTOOL_APP_LDFLAGS)
|
||||
AC_SUBST(USE_UPNP)
|
||||
AC_SUBST(USE_QRCODE)
|
||||
|
||||
Reference in New Issue
Block a user