@@ -1593,19 +1593,13 @@ elif (run_os in ['linux-gnu', 'linux-gnueabihf', 'freebsd', 'openbsd', 'windows-
15931593 config .import_libdispatch = ('-I %s -I %s -L %s'
15941594 % (libdispatch_source_dir , libdispatch_swift_module_dir , libdispatch_artifact_dir ))
15951595
1596- libdispatch_static_artifact_dir = config .libdispatch_static_build_path
1597- libdispatch_swift_static_module_dir = make_path (libdispatch_static_artifact_dir , 'src' , 'swift' , 'swift' )
1596+ libdispatch_static_artifact_dir = os .path .join (config .libdispatch_static_build_path , 'lib' )
15981597 libdispatch_static_artifacts = [
1599- make_path (libdispatch_static_artifact_dir , 'src' , 'libdispatch.a' ),
1600- make_path (libdispatch_static_artifact_dir , 'src' , 'swift' , 'libswiftDispatch.a' ),
1601- make_path (libdispatch_swift_static_module_dir , 'Dispatch.swiftmodule' )]
1598+ make_path (libdispatch_static_artifact_dir , 'libdispatch.a' ),
1599+ make_path (libdispatch_static_artifact_dir , 'libBlocksRuntime.a' )]
16021600 if (all (os .path .exists (p ) for p in libdispatch_static_artifacts )):
16031601 config .available_features .add ('libdispatch_static' )
1604- config .import_libdispatch_static = ('-I %s -I %s -L %s -L %s -L %s'
1605- % (libdispatch_source_dir , libdispatch_swift_static_module_dir ,
1606- make_path (libdispatch_static_artifact_dir , 'src' ),
1607- make_path (libdispatch_static_artifact_dir , 'src' , 'BlocksRuntime' ),
1608- make_path (libdispatch_static_artifact_dir , 'src' , 'swift' )))
1602+ config .import_libdispatch_static = '-L %s' % libdispatch_static_artifact_dir
16091603
16101604 config .target_build_swift = (
16111605 '%s -target %s -toolchain-stdlib-rpath %s %s %s %s %s'
@@ -2649,6 +2643,10 @@ run_filecheck = '%s %s --allow-unused-prefixes --sanitize BUILD_DIR=%s --sanitiz
26492643config .substitutions .append (('%FileCheck' , run_filecheck ))
26502644config .substitutions .append (('%raw-FileCheck' , shell_quote (config .filecheck )))
26512645config .substitutions .append (('%import-libdispatch' , getattr (config , 'import_libdispatch' , '' )))
2646+ # WARNING: the order of components in a substitution name has to be different from the previous one, as lit does
2647+ # a pure string substitution without understanding that these components are grouped together. That is, the following
2648+ # subsitution name can't be `%import-libdispatch-static`, otherwise the first two components will be substituted with
2649+ # the value of `%import-libdispatch` substitution with `-static` string appended to it.
26522650config .substitutions .append (('%import-static-libdispatch' , getattr (config , 'import_libdispatch_static' , '' )))
26532651
26542652# Disable COW sanity checks in the swift runtime by default.
0 commit comments