diff options
-rw-r--r-- | config_help.txt | 3 | ||||
-rw-r--r-- | configure.json | 49 | ||||
-rw-r--r-- | configure.pri | 16 | ||||
-rw-r--r-- | mkspecs/common/gcc-base-unix.conf | 2 | ||||
-rw-r--r-- | mkspecs/features/default_post.prf | 2 | ||||
-rw-r--r-- | mkspecs/features/qt_configure.prf | 8 |
6 files changed, 74 insertions, 6 deletions
diff --git a/config_help.txt b/config_help.txt index 223adf61d7..8eea64e03a 100644 --- a/config_help.txt +++ b/config_help.txt @@ -167,7 +167,8 @@ Build options: -pch ................. Use precompiled headers [auto] -ltcg ................ Use Link Time Code Generation [no] - -use-gold-linker ..... Use the GNU gold linker [auto] + -linker [bfd,gold,lld] Force use of the GNU ld, GNU gold or LLVM/LLD linker + instead of default one (GCC only) -incredibuild-xge .... Use the IncrediBuild XGE [no] (Windows only) -ccache .............. Use the ccache compiler cache [no] (Unix only) -make-tool <tool> .... Use <tool> to build qmake [nmake] (Windows only) diff --git a/configure.json b/configure.json index f1a414fbf9..4a9e1fc24e 100644 --- a/configure.json +++ b/configure.json @@ -90,6 +90,7 @@ "headersclean": "boolean", "incredibuild-xge": { "type": "boolean", "name": "incredibuild_xge" }, "libudev": "boolean", + "linker": { "type": "optionalString", "values": [ "bfd", "gold", "lld" ] }, "ltcg": "boolean", "make": { "type": "addString", "values": [ "examples", "libs", "tests", "tools" ] }, "make-tool": "string", @@ -131,7 +132,7 @@ "syncqt": "boolean", "sysroot": "string", "testcocoon": "boolean", - "use-gold-linker": { "type": "boolean", "name": "use_gold_linker" }, + "use-gold-linker": { "type": "boolean", "name": "use_gold_linker_alias" }, "warnings-are-errors": { "type": "boolean", "name": "warnings_are_errors" }, "Werror": { "type": "boolean", "name": "warnings_are_errors" }, "widgets": "boolean", @@ -224,8 +225,8 @@ }, "testTypeDependencies": { - "linkerSupportsFlag": [ "use_gold_linker" ], - "verifySpec": [ "shared", "use_gold_linker", "compiler-flags", "qmakeargs", "commit" ], + "linkerSupportsFlag": [ "use_bfd_linker", "use_gold_linker", "use_lld_linker" ], + "verifySpec": [ "shared", "use_bfd_linker", "use_gold_linker", "use_lld_linker", "compiler-flags", "qmakeargs", "commit" ], "compile": [ "verifyspec" ], "detectPkgConfig": [ "cross_compile", "machineTuple" ], "library": [ "pkg-config", "compiler-flags" ], @@ -357,11 +358,21 @@ ] } }, + "use_bfd_linker": { + "label": "bfd linker", + "type": "compilerSupportsFlag", + "flag": "-fuse-ld=bfd" + }, "use_gold_linker": { "label": "gold linker", "type": "compilerSupportsFlag", "flag": "-fuse-ld=gold" }, + "use_lld_linker" : { + "label": "lld linker", + "type": "compilerSupportsFlag", + "flag": "-fuse-ld=lld" + }, "optimize_debug": { "label": "-Og support", "type": "compilerSupportsFlag", @@ -649,11 +660,34 @@ "output": [ "qmakeArgs" ], "condition": "input.qmakeArgs != ''" }, + "use_bfd_linker": { + "label": "bfd", + "autoDetect": "false", + "enable" : "input.linker == 'bfd'", + "disable" : "input.linker == 'gold' || input.linker == 'lld'", + "condition": "!config.win32 && !config.integrity && !config.wasm && tests.use_bfd_linker", + "output": [ "privateConfig", "useBFDLinker" ] + }, + "use_gold_linker_alias": { + "autoDetect": "false", + "condition": "!config.win32 && !config.integrity && !config.wasm && tests.use_gold_linker" + }, "use_gold_linker": { - "label": "Using gold linker", + "label": "gold", + "autoDetect": "false", + "enable" : "input.linker == 'gold' || features.use_gold_linker_alias" , + "disable" : "input.linker == 'bfd' || input.linker == 'lld'", "condition": "!config.win32 && !config.integrity && !config.wasm && tests.use_gold_linker", "output": [ "privateConfig", "useGoldLinker" ] }, + "use_lld_linker": { + "label": "lld", + "autoDetect": "false", + "enable" : "input.linker == 'lld'", + "disable" : "input.linker == 'bfd' || input.linker == 'gold'", + "condition": "!config.win32 && !config.integrity && !config.wasm && tests.use_lld_linker", + "output": [ "privateConfig", "useLLDLinker" ] + }, "optimize_debug": { "label": "Optimize debug build", "condition": "!config.msvc && !config.clang && (features.debug || features.debug_and_release) && tests.optimize_debug", @@ -1386,7 +1420,12 @@ Configure with '-qreal float' to create a build that is binary-compatible with 5 "args": "ccache", "condition": "config.unix" }, - "use_gold_linker", + { + "message": "Linker", + "type": "firstAvailableFeature", + "args": "use_bfd_linker use_gold_linker use_lld_linker", + "condition": "features.use_bfd_linker || features.use_gold_linker || features.use_lld_linker" + }, { "type": "feature", "args": "enable_new_dtags", diff --git a/configure.pri b/configure.pri index df890a7c49..d92653885f 100644 --- a/configure.pri +++ b/configure.pri @@ -1026,6 +1026,14 @@ defineTest(qtConfOutput_crossCompile) { export(CONFIG) } +defineTest(qtConfOutput_useBFDLinker) { + !$${2}: return() + + # We need to preempt the output here, so that qtConfTest_linkerSupportsFlag can work properly in qtbase + CONFIG += use_bfd_linker + export(CONFIG) +} + defineTest(qtConfOutput_useGoldLinker) { !$${2}: return() @@ -1034,6 +1042,14 @@ defineTest(qtConfOutput_useGoldLinker) { export(CONFIG) } +defineTest(qtConfOutput_useLLDLinker) { + !$${2}: return() + + # We need to preempt the output here, so that qtConfTest_linkerSupportsFlag can work properly in qtbase + CONFIG += use_lld_linker + export(CONFIG) +} + defineTest(qtConfOutput_debugAndRelease) { $$qtConfEvaluate("features.debug") { qtConfOutputVar(append, "publicPro", "CONFIG", "debug") diff --git a/mkspecs/common/gcc-base-unix.conf b/mkspecs/common/gcc-base-unix.conf index 700f228c36..a456c8f3eb 100644 --- a/mkspecs/common/gcc-base-unix.conf +++ b/mkspecs/common/gcc-base-unix.conf @@ -20,7 +20,9 @@ QMAKE_LFLAGS_RPATH = -Wl,-rpath, QMAKE_LFLAGS_RPATHLINK = -Wl,-rpath-link, QMAKE_LFLAGS_NEW_DTAGS = -Wl,--enable-new-dtags QMAKE_LFLAGS_GDB_INDEX = -Wl,--gdb-index +QMAKE_LFLAGS_USE_BFD = -fuse-ld=bfd QMAKE_LFLAGS_USE_GOLD = -fuse-ld=gold +QMAKE_LFLAGS_USE_LLD = -fuse-ld=lld # -Bsymbolic-functions (ld) support QMAKE_LFLAGS_BSYMBOLIC_FUNC = -Wl,-Bsymbolic-functions diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf index d90da49781..69da78c5b7 100644 --- a/mkspecs/features/default_post.prf +++ b/mkspecs/features/default_post.prf @@ -78,7 +78,9 @@ stack_protector_strong { # disable special linker flags for host builds (no proper test for host support yet) !host_build|!cross_compile { + use_bfd_linker: QMAKE_LFLAGS += $$QMAKE_LFLAGS_USE_BFD use_gold_linker: QMAKE_LFLAGS += $$QMAKE_LFLAGS_USE_GOLD + use_lld_linker: QMAKE_LFLAGS += $$QMAKE_LFLAGS_USE_LLD enable_new_dtags: QMAKE_LFLAGS += $$QMAKE_LFLAGS_NEW_DTAGS enable_gdb_index: QMAKE_LFLAGS += $$QMAKE_LFLAGS_GDB_INDEX } diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index c45439c3ef..f682892abe 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -368,8 +368,12 @@ defineTest(qtConfTest_compilerSupportsFlag) { defineTest(qtConfTest_linkerSupportsFlag) { flag = $$eval($${1}.flag) + use_bfd_linker: \ + LFLAGS = -fuse-ld=bfd use_gold_linker: \ LFLAGS = -fuse-ld=gold + use_lld_linker: \ + LFLAGS = -fuse-ld=lld return($$qtConfToolchainSupportsFlag($$LFLAGS "-Wl,$$flag")) } @@ -1220,8 +1224,12 @@ defineTest(qtConfTest_compile) { else: \ qmake_configs = "static" + use_bfd_linker: \ + qmake_configs += "use_bfd_linker" use_gold_linker: \ qmake_configs += "use_gold_linker" + use_lld_linker: \ + qmake_configs += "use_lld_linker" # disable warnings from the builds, since they're just noise at this point. qmake_configs += "warn_off" |