From 01c82b945d209f3b7481b5be350c33002fb1b103 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 1 Jul 2014 11:46:50 +0200 Subject: Introduce qmake feature use_gold_linker This patch adds the feature use_gold_linker to use the gold linker that has been part of of GNU binutils since 2008. Gold links C++ libraries much faster and use less memory. The feature is autodetected when building Qt on Linux, but can be disabled in configure. On MingW builds it is default off but can be enabled for cross builds. Change-Id: Icdd6ba2e706b2c791bcf44b6e718c2b7a5eb2218 Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- configure | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'configure') diff --git a/configure b/configure index 96cc82bd58..9ac4bfadb6 100755 --- a/configure +++ b/configure @@ -698,6 +698,7 @@ CFG_INOTIFY=auto CFG_EVENTFD=auto CFG_RPATH=yes CFG_FRAMEWORK=auto +CFG_USE_GOLD_LINKER=auto DEFINES= INCLUDES= D_FLAGS= @@ -1592,6 +1593,13 @@ while [ "$#" -gt 0 ]; do UNKNOWN_OPT=yes fi ;; + use-gold-linker) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_USE_GOLD_LINKER="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; zlib) [ "$VAL" = "qt" ] && VAL=yes if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then @@ -2465,6 +2473,9 @@ Additional options: linker optimizations (Qt/X11 and Qt for Embedded Linux only; experimental; needs GNU ld >= 2.18). + -no-use-gold-linker ..... Do not link using the GNU gold linker. + + -use-gold-linker ........ Link using the GNU gold linker if available. + -force-asserts ........ Force Q_ASSERT to be enabled even in release builds. -device ............... Cross-compile for device (experimental) @@ -3230,6 +3241,19 @@ if [ "$CFG_REDUCE_EXPORTS" != "no" ]; then fi fi +# auto-detect -fuse-ld=gold support +if [ "$CFG_USE_GOLD_LINKER" != "no" ]; then + if linkerSupportsFlag $TEST_COMPILER -fuse-ld=gold; then + CFG_USE_GOLD_LINKER=yes + else + if [ "$CFG_USE_GOLD_LINKER" = "yes" ]; then + echo "-use-gold-linker was requested but this compiler does not support it" + exit 1 + fi + CFG_USE_GOLD_LINKER=no + fi +fi + # auto-detect -fstack-protector-strong support (for QNX only currently) if [ "$XPLATFORM_QNX" = "yes" ]; then if compilerSupportsFlag $TEST_COMPILER -fstack-protector-strong; then @@ -5598,6 +5622,7 @@ fi [ "$CFG_REDUCE_RELOCATIONS" = "yes" ] && QT_CONFIG="$QT_CONFIG reduce_relocations" [ "$CFG_STRIP" = "no" ] && QMAKE_CONFIG="$QMAKE_CONFIG nostrip" [ "$CFG_PRECOMPILE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG precompile_header" +[ "$CFG_USE_GOLD_LINKER" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG use_gold_linker" if [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then QT_CONFIG="$QT_CONFIG separate_debug_info" fi @@ -6472,6 +6497,7 @@ else fi unset build_mode release echo " Using C++11 ............ $CFG_CXX11" +echo " Using gold linker....... $CFG_USE_GOLD_LINKER" echo " Using PCH .............. $CFG_PRECOMPILE" echo " Target compiler supports:" if [ "$CFG_ARCH" = "i386" -o "$CFG_ARCH" = "x86_64" ]; then -- cgit v1.2.3