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':
945
945
config .resource_dir_opt = "-resource-dir %s" % new_resource_dir
946
946
lit_config .note ('Using freestanding resource dir: ' + new_resource_dir )
947
947
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
+
948
963
xcrun_prefix = (
949
964
"xcrun --toolchain %s --sdk %r" %
950
965
(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']:
81
81
else :
82
82
config .available_features .add ('no_lto' )
83
83
84
+ if '@SWIFT_STDLIB_ENABLE_LTO@' .lower () in ['full' , 'thin' ]:
85
+ config .available_features .add ('stdlib_lto' )
86
+
84
87
if "@LLVM_ENABLE_ASSERTIONS@" == "TRUE" :
85
88
config .available_features .add ('asserts' )
86
89
else :
You can’t perform that action at this time.
0 commit comments