File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -945,6 +945,21 @@ if run_vendor == 'apple':
945945 config .resource_dir_opt = "-resource-dir %s" % new_resource_dir
946946 lit_config .note ('Using freestanding resource dir: ' + new_resource_dir )
947947
948+ # Auto-linking does not work when stdlib is built with LTO, because linked
949+ # libraries are discovered too late (after optimizations are applied). Let's
950+ # explicitly link all libraries needed in tests.
951+ #
952+ # Note that this won't work on Linux (without LLD). The autolinking
953+ # mechanism on Linux will fail due to needing -L arguments to the path even
954+ # with this forced linking as the extracted commands will force the linker
955+ # to look up the linking by name as well.
956+ if "stdlib_lto" in config .available_features :
957+ for library in ["swiftCore" , "swiftStdlibUnittest" ,
958+ "swiftSwiftPrivateLibcExtras" , "swiftSwiftPrivate" ,
959+ "swiftDarwin" , "swiftSwiftPrivateThreadExtras" ,
960+ "swiftSwiftOnoneSupport" ]:
961+ swift_execution_tests_extra_flags += ' -Xlinker -l%s' % library
962+
948963 xcrun_prefix = (
949964 "xcrun --toolchain %s --sdk %r" %
950965 (config .darwin_xcrun_toolchain , config .variant_sdk ))
Original file line number Diff line number Diff line change @@ -81,6 +81,9 @@ if '@SWIFT_TOOLS_ENABLE_LTO@'.lower() in ['full', 'thin']:
8181else :
8282 config .available_features .add ('no_lto' )
8383
84+ if '@SWIFT_STDLIB_ENABLE_LTO@' .lower () in ['full' , 'thin' ]:
85+ config .available_features .add ('stdlib_lto' )
86+
8487if "@LLVM_ENABLE_ASSERTIONS@" == "TRUE" :
8588 config .available_features .add ('asserts' )
8689else :
You can’t perform that action at this time.
0 commit comments