diff options
author | Cory Fields <cory-nospam-@coryfields.com> | 2015-11-09 20:52:37 -0500 |
---|---|---|
committer | Cory Fields <cory-nospam-@coryfields.com> | 2015-11-09 22:50:31 -0500 |
commit | 69d05134367da9a897ad14562a1d266750db450a (patch) | |
tree | 8f17551c2e799aa25596c0c5aa9427275a1c3d26 /build-aux | |
parent | 17c4d9d1647bbac4b0557136b1c3d98c951feb79 (diff) |
build: Use fPIC rather than fPIE for qt objects.
But only if qt was built with reduced relocations.
Diffstat (limited to 'build-aux')
-rw-r--r-- | build-aux/m4/bitcoin_qt.m4 | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/build-aux/m4/bitcoin_qt.m4 b/build-aux/m4/bitcoin_qt.m4 index 6f9c0ae218..2480267dc1 100644 --- a/build-aux/m4/bitcoin_qt.m4 +++ b/build-aux/m4/bitcoin_qt.m4 @@ -160,6 +160,43 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[ fi fi + if test x$use_hardening != xno; then + BITCOIN_QT_CHECK([ + AC_MSG_CHECKING(whether -fPIE can be used with this Qt config) + TEMP_CPPFLAGS=$CPPFLAGS + TEMP_CXXFLAGS=$CXXFLAGS + CPPFLAGS="$QT_INCLUDES $CPPFLAGS" + CXXFLAGS="$PIE_FLAGS $CXXFLAGS" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <QtCore/qconfig.h>]], + [[ + #if defined(QT_REDUCE_RELOCATIONS) + choke; + #endif + ]])], + [ AC_MSG_RESULT(yes); QT_PIE_FLAGS=$PIE_FLAGS ], + [ AC_MSG_RESULT(no); QT_PIE_FLAGS=$PIC_FLAGS] + ) + CPPFLAGS=$TEMP_CPPFLAGS + CXXFLAGS=$TEMP_CXXFLAGS + ]) + else + BITCOIN_QT_CHECK([ + AC_MSG_CHECKING(whether -fPIC is needed with this Qt config) + TEMP_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$QT_INCLUDES $CPPFLAGS" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <QtCore/qconfig.h>]], + [[ + #if defined(QT_REDUCE_RELOCATIONS) + choke; + #endif + ]])], + [ AC_MSG_RESULT(no)], + [ AC_MSG_RESULT(yes); QT_PIE_FLAGS=$PIC_FLAGS] + ) + CPPFLAGS=$TEMP_CPPFLAGS + ]) + fi + BITCOIN_QT_PATH_PROGS([MOC], [moc-qt${bitcoin_qt_got_major_vers} moc${bitcoin_qt_got_major_vers} moc], $qt_bin_path) BITCOIN_QT_PATH_PROGS([UIC], [uic-qt${bitcoin_qt_got_major_vers} uic${bitcoin_qt_got_major_vers} uic], $qt_bin_path) BITCOIN_QT_PATH_PROGS([RCC], [rcc-qt${bitcoin_qt_got_major_vers} rcc${bitcoin_qt_got_major_vers} rcc], $qt_bin_path) @@ -205,6 +242,7 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[ ]) AC_MSG_RESULT([$bitcoin_enable_qt (Qt${bitcoin_qt_got_major_vers})]) + AC_SUBST(QT_PIE_FLAGS) AC_SUBST(QT_INCLUDES) AC_SUBST(QT_LIBS) AC_SUBST(QT_LDFLAGS) |