CMake: Implement configure -linker [bfd,gold,lld]

Fixes: QTBUG-86155
Change-Id: I5ba2d3b52d9ca240b48904c492f7902a056c0292
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Joerg Bornemann 2020-08-20 09:06:16 +02:00
parent df28355981
commit 2f1a55c0b1
4 changed files with 26 additions and 3 deletions

View File

@ -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 "$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>")
set(is_static_lib "$<STREQUAL:$<TARGET_PROPERTY:TYPE>,STATIC_LIBRARY>")

View File

@ -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=<name> or | |
| | -DFEATURE_use_<name>_linker=ON | |
| -incredibuild-xge | | |
| -ccache | -DQT_USE_CCACHE=ON | |
| -make-tool <tool> | n/a | |

View File

@ -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

View File

@ -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