diff --git a/cmake/QtInternalTargets.cmake b/cmake/QtInternalTargets.cmake index bd3d034f60..e59e075d32 100644 --- a/cmake/QtInternalTargets.cmake +++ b/cmake/QtInternalTargets.cmake @@ -213,6 +213,14 @@ if(DEFINED QT_EXTRA_FRAMEWORKPATHS AND APPLE) unset(__qt_fw_flags) endif() +if(QT_FEATURE_use_gold_linker) + target_link_options(PlatformCommonInternal INTERFACE "-fuse-ld=gold") +elseif(QT_FEATURE_use_bfd_linker) + target_link_options(PlatformCommonInternal INTERFACE "-fuse-ld=bfd") +elseif(QT_FEATURE_use_lld_linker) + target_link_options(PlatformCommonInternal INTERFACE "-fuse-ld=lld") +endif() + function(qt_get_implicit_sse2_genex_condition out_var) set(is_shared_lib "$,SHARED_LIBRARY>") set(is_static_lib "$,STATIC_LIBRARY>") diff --git a/cmake/configure-cmake-mapping.md b/cmake/configure-cmake-mapping.md index e0edfe98e7..cafe139ce8 100644 --- a/cmake/configure-cmake-mapping.md +++ b/cmake/configure-cmake-mapping.md @@ -66,7 +66,8 @@ The effort of this is tracked in QTBUG-85373 and QTBUG-85349. | -static-runtime | -DFEATURE_static_runtime=ON | | | -pch | -DBUILD_WITH_PCH=ON | | | -ltcg | | | -| -linker [bfd,gold,lld] | | | +| -linker [bfd,gold,lld] | -DINPUT_linker= or | | +| | -DFEATURE_use__linker=ON | | | -incredibuild-xge | | | | -ccache | -DQT_USE_CCACHE=ON | | | -make-tool | n/a | | diff --git a/configure.cmake b/configure.cmake index 0fb01ef4fb..d870e3a759 100644 --- a/configure.cmake +++ b/configure.cmake @@ -393,6 +393,14 @@ qt_feature("use_gold_linker_alias" AUTODETECT false CONDITION NOT WIN32 AND NOT INTEGRITY AND NOT WASM AND TEST_use_gold_linker ) +qt_feature("use_gold_linker" + LABEL "gold" + AUTODETECT false + CONDITION NOT WIN32 AND NOT INTEGRITY AND NOT WASM AND NOT rtems AND TEST_use_gold_linker + ENABLE INPUT_linker STREQUAL 'gold' OR QT_FEATURE_use_gold_linker_alias + DISABLE INPUT_linker STREQUAL 'bfd' OR INPUT_linker STREQUAL 'lld' +) +qt_feature_config("use_gold_linker" QMAKE_PRIVATE_CONFIG) qt_feature("use_lld_linker" LABEL "lld" AUTODETECT false @@ -912,6 +920,12 @@ qt_configure_add_summary_entry( ARGS "ccache" CONDITION UNIX ) +qt_configure_add_summary_entry( + TYPE "firstAvailableFeature" + ARGS "use_bfd_linker use_gold_linker use_lld_linker" + MESSAGE "Linker" + CONDITION QT_FEATURE_use_bfd_linker OR QT_FEATURE_use_gold_linker OR QT_FEATURE_use_lld_linker +) qt_configure_add_summary_entry( ARGS "enable_new_dtags" CONDITION LINUX diff --git a/util/cmake/configurejson2cmake.py b/util/cmake/configurejson2cmake.py index 86ebf4bae8..81181135ac 100755 --- a/util/cmake/configurejson2cmake.py +++ b/util/cmake/configurejson2cmake.py @@ -945,7 +945,6 @@ def get_feature_mapping(): "stl": None, # Do we really need to test for this in 2018?! "strip": None, "tiff": {"condition": "QT_FEATURE_imageformatplugin AND TIFF_FOUND"}, - "use_gold_linker": None, "verifyspec": None, # qmake specific... "warnings_are_errors": None, # FIXME: Do we need these? "webp": {"condition": "QT_FEATURE_imageformatplugin AND WrapWebP_FOUND"}, @@ -1007,7 +1006,8 @@ def parseFeature(ctx, feature, data, cm_fh): if isinstance(o, dict): outputType = o["type"] - if outputType in ["varAssign", "varAppend", "varRemove"]: + if outputType in ["varAssign", "varAppend", "varRemove", + "useBFDLinker", "useGoldLinker", "useLLDLinker"]: continue elif outputType == "define": publicDefine = True