rpath: use new DTAGS if available

this allows LD_LIBRARY_PATH to take precedence over the hard-coded
rpath, which is the only sane thing to do (which is also why i'm not
adding an option to disable it).
this behavior is consistent with non-linux systems.

the windows version has no auto-detection, just like for gold linker
usage.

Task-number: QTBUG-3069
Change-Id: Ief9ba032291c898d75d76ecc740390954382a804
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
This commit is contained in:
Oswald Buddenhagen 2015-04-22 13:09:36 +02:00
parent 96527f74e2
commit 67a24c260b
4 changed files with 24 additions and 0 deletions

10
configure vendored
View File

@ -728,6 +728,7 @@ CFG_EVENTFD=auto
CFG_RPATH=yes CFG_RPATH=yes
CFG_FRAMEWORK=auto CFG_FRAMEWORK=auto
CFG_USE_GOLD_LINKER=auto CFG_USE_GOLD_LINKER=auto
CFG_ENABLE_NEW_DTAGS=auto
DEFINES= DEFINES=
INCLUDES= INCLUDES=
D_FLAGS= D_FLAGS=
@ -3442,6 +3443,13 @@ if [ "$CFG_USE_GOLD_LINKER" != "no" ]; then
fi fi
fi fi
# auto-detect --enable-new-dtags support
if linkerSupportsFlag $TEST_COMPILER --enable-new-dtags; then
CFG_ENABLE_NEW_DTAGS=yes
else
CFG_ENABLE_NEW_DTAGS=no
fi
# auto-detect -fstack-protector-strong support (for QNX only currently) # auto-detect -fstack-protector-strong support (for QNX only currently)
if [ "$XPLATFORM_QNX" = "yes" ]; then if [ "$XPLATFORM_QNX" = "yes" ]; then
if compilerSupportsFlag $TEST_COMPILER -fstack-protector-strong; then if compilerSupportsFlag $TEST_COMPILER -fstack-protector-strong; then
@ -6067,6 +6075,7 @@ fi
[ "$CFG_STRIP" = "no" ] && QMAKE_CONFIG="$QMAKE_CONFIG nostrip" [ "$CFG_STRIP" = "no" ] && QMAKE_CONFIG="$QMAKE_CONFIG nostrip"
[ "$CFG_PRECOMPILE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG precompile_header" [ "$CFG_PRECOMPILE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG precompile_header"
[ "$CFG_USE_GOLD_LINKER" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG use_gold_linker" [ "$CFG_USE_GOLD_LINKER" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG use_gold_linker"
[ "$CFG_ENABLE_NEW_DTAGS" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG enable_new_dtags"
if [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then if [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
QT_CONFIG="$QT_CONFIG separate_debug_info" QT_CONFIG="$QT_CONFIG separate_debug_info"
fi fi
@ -6980,6 +6989,7 @@ unset build_mode release
echo " Using sanitizer(s)...... $CFG_SANITIZERS" echo " Using sanitizer(s)...... $CFG_SANITIZERS"
echo " Using C++11 ............ $CFG_CXX11" echo " Using C++11 ............ $CFG_CXX11"
echo " Using gold linker....... $CFG_USE_GOLD_LINKER" echo " Using gold linker....... $CFG_USE_GOLD_LINKER"
echo " Using new DTAGS ........ $CFG_ENABLE_NEW_DTAGS"
echo " Using PCH .............. $CFG_PRECOMPILE" echo " Using PCH .............. $CFG_PRECOMPILE"
echo " Target compiler supports:" echo " Target compiler supports:"
if [ "$CFG_ARCH" = "i386" -o "$CFG_ARCH" = "x86_64" ]; then if [ "$CFG_ARCH" = "i386" -o "$CFG_ARCH" = "x86_64" ]; then

View File

@ -16,6 +16,7 @@ QMAKE_LFLAGS_SONAME += -Wl,-soname,
QMAKE_LFLAGS_THREAD += QMAKE_LFLAGS_THREAD +=
QMAKE_LFLAGS_RPATH = -Wl,-rpath, QMAKE_LFLAGS_RPATH = -Wl,-rpath,
QMAKE_LFLAGS_RPATHLINK = -Wl,-rpath-link, QMAKE_LFLAGS_RPATHLINK = -Wl,-rpath-link,
QMAKE_LFLAGS_NEW_DTAGS = -Wl,--enable-new-dtags
QMAKE_LFLAGS_USE_GOLD = -fuse-ld=gold QMAKE_LFLAGS_USE_GOLD = -fuse-ld=gold
# -Bsymbolic-functions (ld) support # -Bsymbolic-functions (ld) support

View File

@ -63,6 +63,7 @@ debug {
} }
use_gold_linker: QMAKE_LFLAGS += $$QMAKE_LFLAGS_USE_GOLD use_gold_linker: QMAKE_LFLAGS += $$QMAKE_LFLAGS_USE_GOLD
enable_new_dtags: QMAKE_LFLAGS += $$QMAKE_LFLAGS_NEW_DTAGS
dll:win32: QMAKE_LFLAGS += $$QMAKE_LFLAGS_DLL dll:win32: QMAKE_LFLAGS += $$QMAKE_LFLAGS_DLL
static:mac: QMAKE_LFLAGS += $$QMAKE_LFLAGS_STATIC_LIB static:mac: QMAKE_LFLAGS += $$QMAKE_LFLAGS_STATIC_LIB

View File

@ -244,6 +244,8 @@ Configure::Configure(int& argc, char** argv)
dictionary[ "USE_GOLD_LINKER" ] = "no"; dictionary[ "USE_GOLD_LINKER" ] = "no";
dictionary[ "ENABLE_NEW_DTAGS" ] = "no";
dictionary[ "SHARED" ] = "yes"; dictionary[ "SHARED" ] = "yes";
dictionary[ "STATIC_RUNTIME" ] = "no"; dictionary[ "STATIC_RUNTIME" ] = "no";
@ -471,6 +473,10 @@ void Configure::parseCmdLine()
dictionary[ "USE_GOLD_LINKER" ] = "yes"; dictionary[ "USE_GOLD_LINKER" ] = "yes";
else if (configCmdLine.at(i) == "-no-use-gold-linker") else if (configCmdLine.at(i) == "-no-use-gold-linker")
dictionary[ "USE_GOLD_LINKER" ] = "no"; dictionary[ "USE_GOLD_LINKER" ] = "no";
else if (configCmdLine.at(i) == "-enable-new-dtags")
dictionary[ "ENABLE_NEW_DTAGS" ] = "yes";
else if (configCmdLine.at(i) == "-disable-new-dtags")
dictionary[ "ENABLE_NEW_DTAGS" ] = "no";
else if (configCmdLine.at(i) == "-shared") else if (configCmdLine.at(i) == "-shared")
dictionary[ "SHARED" ] = "yes"; dictionary[ "SHARED" ] = "yes";
else if (configCmdLine.at(i) == "-static") else if (configCmdLine.at(i) == "-static")
@ -1793,6 +1799,9 @@ bool Configure::displayHelp()
desc("USE_GOLD_LINKER", "yes", "-use-gold-linker", "Link using the GNU gold linker (gcc only)."); desc("USE_GOLD_LINKER", "yes", "-use-gold-linker", "Link using the GNU gold linker (gcc only).");
desc("USE_GOLD_LINKER", "no", "-no-use-gold-linker", "Do not link using the GNU gold linker.\n"); desc("USE_GOLD_LINKER", "no", "-no-use-gold-linker", "Do not link using the GNU gold linker.\n");
desc("ENABLE_NEW_DTAGS", "yes", "-enable-new-dtags", "Use new DTAGS for RPATH (Linux only).");
desc("ENABLE_NEW_DTAGS", "no", "-disable-new-dtags", "Do not use new DTAGS for RPATH.\n");
desc("SHARED", "yes", "-shared", "Create and use shared Qt libraries."); desc("SHARED", "yes", "-shared", "Create and use shared Qt libraries.");
desc("SHARED", "no", "-static", "Create and use static Qt libraries.\n"); desc("SHARED", "no", "-static", "Create and use static Qt libraries.\n");
@ -2675,6 +2684,9 @@ void Configure::generateOutputVars()
if (dictionary[ "USE_GOLD_LINKER" ] == "yes") if (dictionary[ "USE_GOLD_LINKER" ] == "yes")
qmakeConfig += "use_gold_linker"; qmakeConfig += "use_gold_linker";
if (dictionary[ "ENABLE_NEW_DTAGS" ] == "yes")
qmakeConfig += "enable_new_dtags";
if (dictionary[ "SHARED" ] == "no") if (dictionary[ "SHARED" ] == "no")
qtConfig += "static"; qtConfig += "static";
else else