Skip to content

Have the frontend and new swift-driver look in an external -sdk for non-Darwin platform runtime libraries and modules too #79621

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions include/swift/AST/DiagnosticsFrontend.def
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
WARNING(warning_no_such_sdk,none,
"no such SDK: '%0'", (StringRef))

WARNING(warning_no_resource_dir_in_sdk, none,
" You passed in an external -sdk without a Swift runtime.\n"
" Either specify a directory containing the runtime libraries with\n"
" the -resource-dir flag, or use -sysroot instead to point at a C/C++\n"
" sysroot alone. Falling back to this path for the Swift runtime modules\n"
" and libraries:\n"
" %0", (StringRef))
ERROR(error_no_frontend_args, none,
"no arguments provided to '-frontend'", ())

Expand Down
4 changes: 2 additions & 2 deletions lib/ClangImporter/ClangImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -770,8 +770,8 @@ void importer::getNormalInvocationArguments(
invocationArgStrs.push_back("-fapinotes-swift-version=" +
languageVersion.asAPINotesVersionString());

// Prefer `-sdk` paths.
if (!searchPathOpts.getSDKPath().empty()) {
// Prefer `-sdk` paths for Darwin.
if (triple.isOSDarwin() && !searchPathOpts.getSDKPath().empty()) {
llvm::SmallString<261> path{searchPathOpts.getSDKPath()};
llvm::sys::path::append(path, "usr", "lib", "swift", "apinotes");

Expand Down
15 changes: 14 additions & 1 deletion lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2280,6 +2280,7 @@ static bool validateSwiftModuleFileArgumentAndAdd(const std::string &swiftModule

static bool ParseSearchPathArgs(SearchPathOptions &Opts, ArgList &Args,
DiagnosticEngine &Diags,
const llvm::Triple &Triple,
const CASOptions &CASOpts,
const FrontendOptions &FrontendOpts,
StringRef workingDirectory) {
Expand Down Expand Up @@ -2414,6 +2415,18 @@ static bool ParseSearchPathArgs(SearchPathOptions &Opts, ArgList &Args,

if (const Arg *A = Args.getLastArg(OPT_resource_dir))
Opts.RuntimeResourcePath = A->getValue();
else if (!Triple.isOSDarwin() && Args.hasArg(OPT_sdk)) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code explicitly follows what the original C++ Driver has long done when looking for the Swift runtime libraries, swiftrt.o, and a few other files found in the Swift resource directory:

if (const Arg *A = args.getLastArg(options::OPT_resource_dir)) {
    StringRef value = A->getValue();
    resourceDirPath.append(value.begin(), value.end());
  } else if (!getTriple().isOSDarwin() && args.hasArg(options::OPT_sdk)) {
    StringRef value = args.getLastArg(options::OPT_sdk)->getValue();
    resourceDirPath.append(value.begin(), value.end());
    llvm::sys::path::append(resourceDirPath, "usr");
    CompilerInvocation::appendSwiftLibDir(resourceDirPath, shared);
  } else {
    auto programPath = getDriver().getSwiftProgramPath();
    CompilerInvocation::computeRuntimeResourcePathFromExecutablePath(
        programPath, shared, resourceDirPath);
  }

Note how the SDK is only looked in if a non-Darwin -sdk is explicitly specified: Saleem later tried to expand that to Darwin also in #26361, but he may have never got it to work.

That C++ Driver setup now matches this Frontend setup, because the default in both is now to look relative to the compiler, which is done first in this Frontend here, ie usr/bin/../lib/swift/. If a -resource-dir is set, that is given first priority, then a non-Darwin -sdk is given second priority, ie the C++ Driver and the Frontend now match in where they look.

This is important for two reasons:

  1. The new swift-driver simply queries the Frontend and uses whatever Swift resource directory it uses, so now the new swift-driver finally matches the original C++ Driver's behavior, and piecemeal workarounds like that in [Unix] Go back to only checking the runtime resource path for swiftrt.o swift-driver#1822 can now be eliminated.
  2. The Frontend will now look in the same Swift resource directory for stdlib/corelibs swiftmodules as the swift-driver is looking for runtime libraries and swiftrt.o, eliminating any confusion between the two by centralizing the Swift resource directory lookup here. That already found one bug in the Windows CI, see my other code comment.

However, unlike the C++ Driver, my -sdk code below actually checks if the -sdk path contains a Swift resource directory for the platform triple and does not use the -sdk for this if not, falling back to the aforementioned default next to the compiler in that case. This is because an -sdk is not guaranteed to have a Swift resource directory and may have only a C/C++ sysroot.

We should probably tighten this up to require an explicit -sdk to have a Swift resource directory, with the only exception when an explicit -resource-dir is also specified, but I'm open to debate here. The C++ Driver doesn't even check if the non-Darwin -sdk has a Swift resource directory and simply assumes one is there, we can do a bit better than that.

llvm::SmallString<128> SDKResourcePath(Opts.getSDKPath());
llvm::sys::path::append(
SDKResourcePath, "usr", "lib",
FrontendOpts.UseSharedResourceFolder ? "swift" : "swift_static");
// Check for eg <sdkRoot>/usr/lib/swift/
if (llvm::sys::fs::exists(SDKResourcePath))
Opts.RuntimeResourcePath = SDKResourcePath.str();
else
Diags.diagnose(SourceLoc(), diag::warning_no_resource_dir_in_sdk,
Opts.RuntimeResourcePath);
}

Opts.SkipAllImplicitImportPaths |= Args.hasArg(OPT_nostdimport);
Opts.SkipSDKImportPaths |= Args.hasArg(OPT_nostdlibimport);
Expand Down Expand Up @@ -4073,7 +4086,7 @@ bool CompilerInvocation::parseArgs(

ParseSymbolGraphArgs(SymbolGraphOpts, ParsedArgs, Diags, LangOpts);

if (ParseSearchPathArgs(SearchPathOpts, ParsedArgs, Diags,
if (ParseSearchPathArgs(SearchPathOpts, ParsedArgs, Diags, LangOpts.Target,
CASOpts, FrontendOpts, workingDirectory)) {
return true;
}
Expand Down
8 changes: 7 additions & 1 deletion test/ClangImporter/sdk-apinotes.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck %s -verify
// RUN: %empty-directory(%t/sdk/usr/lib/swift/apinotes)
// RUN: %empty-directory(%t/sdk/usr/lib/swift/%target-sdk-name)
// RUN: cp -r %clang-importer-sdk-path/usr/include %t/sdk/usr
// RUN: cp -r %test-resource-dir/shims %t/sdk/usr/lib/swift
// RUN: cp %S/Inputs/cfuncs.apinotes %t/sdk/usr/lib/swift/apinotes
// RUN: cp -r %platform-module-dir/Swift.swiftmodule %t/sdk/usr/lib/swift/%target-sdk-name/
// RUN: %target-swift-frontend(mock-sdk: -sdk %t/sdk) -typecheck %s -verify -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import

import cfuncs

Expand Down
5 changes: 3 additions & 2 deletions test/Serialization/module_defining_interface.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// RUN: %empty-directory(%t)
// RUN: %empty-directory(%t/inputs)
// RUN: %empty-directory(%t/test-sdk)
// RUN: %empty-directory(%t/test-sdk/usr/lib/swift)
// RUN: cp -r %platform-module-dir/Swift.swiftmodule %t/test-sdk/usr/lib/swift/Swift.swiftmodule
// RUN: %empty-directory(%t/test-sdk/usr/lib/swift/%target-sdk-name)
// RUN: cp -r %test-resource-dir/shims %t/test-sdk/usr/lib/swift
// RUN: cp -r %platform-module-dir/Swift{,OnoneSupport}.swiftmodule %t/test-sdk/usr/lib/swift/%target-sdk-name/

// RUN: %empty-directory(%t/test-sdk/usr/lib/Foo.swiftmodule)
// RUN: split-file %s %t
Expand Down
5 changes: 3 additions & 2 deletions test/Serialization/module_defining_interface_client.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// RUN: %empty-directory(%t)
// RUN: %empty-directory(%t/inputs)
// RUN: %empty-directory(%t/test-sdk)
// RUN: %empty-directory(%t/test-sdk/usr/lib/swift)
// RUN: %empty-directory(%t/test-sdk/usr/lib/swift/%target-sdk-name)
// RUN: %empty-directory(%t/test-sdk/usr/lib/Foo.swiftmodule)
// RUN: %empty-directory(%t/test-sdk/usr/lib/Bar.swiftmodule)
// RUN: %empty-directory(%t/test-sdk/usr/lib/_Foo_Bar.swiftmodule)
// RUN: %empty-directory(%t/test-sdk/usr/lib/Foo.swiftcrossimport)
// RUN: cp -r %platform-module-dir/Swift.swiftmodule %t/test-sdk/usr/lib/swift/Swift.swiftmodule
// RUN: cp -r %test-resource-dir/shims %t/test-sdk/usr/lib/swift
// RUN: cp -r %platform-module-dir/Swift{,OnoneSupport}.swiftmodule %t/test-sdk/usr/lib/swift/%target-sdk-name/

// RUN: split-file %s %t

Expand Down
2 changes: 1 addition & 1 deletion test/embedded/builtin-float.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// RUN: mkdir -p %t/include
// RUN: %{python} %utils/split_file.py -o %t %s

// RUN: %target-swift-frontend -target armv7em-none-none-eabi -emit-ir %t/Main.swift -enable-experimental-feature Embedded -module-cache-path %t/ModuleCache -Xcc -I%t/include
// RUN: %swift_frontend_plain -target armv7em-none-none-eabi -emit-ir %t/Main.swift -enable-experimental-feature Embedded -module-cache-path %t/ModuleCache -Xcc -I%t/include

// UNSUPPORTED: CPU=wasm32
// REQUIRES: swift_in_compiler
Expand Down
2 changes: 1 addition & 1 deletion test/embedded/float-abi-hard.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: %empty-directory(%t)
// RUN: %{python} %utils/split_file.py -o %t %s

// RUN: %target-swift-emit-ir %t/Main.swift -import-bridging-header %t/BridgingHeader.h -parse-as-library -enable-experimental-feature Embedded -wmo \
// RUN: %swift_frontend_plain -emit-ir %t/Main.swift -import-bridging-header %t/BridgingHeader.h -parse-as-library -enable-experimental-feature Embedded -wmo \
// RUN: -target armv7em-none-none-eabi -Xcc -mthumb -Xcc -mcpu=cortex-m7 -Xcc -mfloat-abi=hard -Xcc -mfpu=fpv5-sp-d16 -Xcc -D__FPU_USED=1 -Xcc -falign-functions=16

// UNSUPPORTED: CPU=wasm32
Expand Down
4 changes: 2 additions & 2 deletions test/embedded/fragile-reference.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %target-swift-frontend -target armv7-apple-none-macho -module-name main -parse-as-library -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %target-swift-frontend -target arm64-apple-none-macho -module-name main -parse-as-library -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %swift_frontend_plain -target armv7-apple-none-macho -module-name main -parse-as-library -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %swift_frontend_plain -target arm64-apple-none-macho -module-name main -parse-as-library -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s

// UNSUPPORTED: CPU=wasm32
// REQUIRES: swift_in_compiler
Expand Down
4 changes: 2 additions & 2 deletions test/embedded/no-allocations-print.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: %target-swift-emit-ir %s -enable-experimental-feature Embedded -no-allocations

// RUN: %target-swift-emit-ir -target armv7-apple-none-macho -no-allocations %s -enable-experimental-feature Embedded
// RUN: %target-swift-emit-ir -target arm64-apple-none-macho -no-allocations %s -enable-experimental-feature Embedded
// RUN: %swift_frontend_plain -emit-ir -target armv7-apple-none-macho -no-allocations %s -enable-experimental-feature Embedded
// RUN: %swift_frontend_plain -emit-ir -target arm64-apple-none-macho -no-allocations %s -enable-experimental-feature Embedded

// UNSUPPORTED: CPU=wasm32
// REQUIRES: swift_in_compiler
Expand Down
7 changes: 2 additions & 5 deletions test/embedded/optionset2.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %target-swift-frontend -target armv7-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %target-swift-frontend -target arm64-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %swift_frontend_plain -target armv7-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %swift_frontend_plain -target arm64-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s

// UNSUPPORTED: CPU=wasm32
// REQUIRES: swift_in_compiler
Expand All @@ -8,9 +8,6 @@
// REQUIRES: embedded_stdlib_cross_compiling
// REQUIRES: swift_feature_Embedded

// https://github.com/apple/swift/issues/73249
// UNSUPPORTED: OS=windows-msvc

protocol MyOptionSet: Equatable {
init(rawValue: Int)
init()
Expand Down
7 changes: 2 additions & 5 deletions test/embedded/ouroboros-bug.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// code, but in the embedded Swift's runtime that's somewhat reasonable thing
// to do (but is to be avoided because of this).

// RUN: %target-swift-frontend -target armv7-apple-none-macho -assert-config Debug -Osize -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %target-swift-frontend -target arm64-apple-none-macho -assert-config Debug -Osize -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %swift_frontend_plain -target armv7-apple-none-macho -assert-config Debug -Osize -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %swift_frontend_plain -target arm64-apple-none-macho -assert-config Debug -Osize -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s

// UNSUPPORTED: CPU=wasm32
// REQUIRES: swift_in_compiler
Expand All @@ -13,9 +13,6 @@
// REQUIRES: embedded_stdlib_cross_compiling
// REQUIRES: swift_feature_Embedded

// https://github.com/apple/swift/issues/73249
// UNSUPPORTED: OS=windows-msvc

public func test() {}
test()

Expand Down
4 changes: 2 additions & 2 deletions test/embedded/ptrauth-none-macho.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %target-swift-frontend -target arm64e-apple-none-macho -enable-experimental-feature Embedded -emit-ir %s -o - | %FileCheck %s
// RUN: %target-swift-frontend -target arm64e-apple-macos14 -enable-experimental-feature Embedded -emit-ir %s -o - | %FileCheck %s
// RUN: %swift_frontend_plain -target arm64e-apple-none-macho -enable-experimental-feature Embedded -emit-ir %s -o - | %FileCheck %s
// RUN: %swift_frontend_plain -target arm64e-apple-macos14 -enable-experimental-feature Embedded -emit-ir %s -o - | %FileCheck %s

// REQUIRES: swift_in_compiler
// REQUIRES: OS=macosx
Expand Down
4 changes: 2 additions & 2 deletions test/embedded/static-object-non-darwin.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %target-swift-frontend -target armv7em-none-none-eabi -parse-as-library -module-name main -O -emit-ir %s -enable-experimental-feature Embedded -Xllvm -link-embedded-runtime=0 | %FileCheck %s
// RUN: %target-swift-frontend -target armv7em-none-none-eabi -parse-as-library -module-name main -Osize -emit-ir %s -enable-experimental-feature Embedded -Xllvm -link-embedded-runtime=0 | %FileCheck %s
// RUN: %swift_frontend_plain -target armv7em-none-none-eabi -parse-as-library -module-name main -O -emit-ir %s -enable-experimental-feature Embedded -Xllvm -link-embedded-runtime=0 | %FileCheck %s
// RUN: %swift_frontend_plain -target armv7em-none-none-eabi -parse-as-library -module-name main -Osize -emit-ir %s -enable-experimental-feature Embedded -Xllvm -link-embedded-runtime=0 | %FileCheck %s

// UNSUPPORTED: CPU=wasm32
// REQUIRES: swift_in_compiler
Expand Down
7 changes: 2 additions & 5 deletions test/embedded/stdlib-array.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %target-swift-frontend -target armv7-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %target-swift-frontend -target arm64-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %swift_frontend_plain -target armv7-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %swift_frontend_plain -target arm64-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s

// UNSUPPORTED: CPU=wasm32
// REQUIRES: swift_in_compiler
Expand All @@ -8,9 +8,6 @@
// REQUIRES: embedded_stdlib_cross_compiling
// REQUIRES: swift_feature_Embedded

// https://github.com/apple/swift/issues/73249
// UNSUPPORTED: OS=windows-msvc

public func test() {
var array: [Int] = [1, 2, 3]
array.append(42)
Expand Down
7 changes: 2 additions & 5 deletions test/embedded/stdlib-basic.swift
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
// RUN: %target-swift-frontend -target armv7-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %target-swift-frontend -target arm64-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %swift_frontend_plain -target armv7-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %swift_frontend_plain -target arm64-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s

// UNSUPPORTED: CPU=wasm32
// REQUIRES: swift_in_compiler
// REQUIRES: CODEGENERATOR=ARM
// REQUIRES: embedded_stdlib_cross_compiling
// REQUIRES: swift_feature_Embedded

// https://github.com/apple/swift/issues/73249
// UNSUPPORTED: OS=windows-msvc

public func bool() -> Bool {
return true
}
Expand Down
7 changes: 2 additions & 5 deletions test/embedded/stdlib-dictionary.swift
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
// RUN: %target-swift-frontend -target armv7-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %target-swift-frontend -target arm64-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %swift_frontend_plain -target armv7-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %swift_frontend_plain -target arm64-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s

// UNSUPPORTED: CPU=wasm32
// REQUIRES: swift_in_compiler
// REQUIRES: optimized_stdlib
// REQUIRES: embedded_stdlib_cross_compiling
// REQUIRES: swift_feature_Embedded

// https://github.com/apple/swift/issues/73249
// UNSUPPORTED: OS=windows-msvc

public func test() {
var d: [Int:Int] = [1: 2, 3: 4, 5: 6]
d[8] = 9
Expand Down
7 changes: 2 additions & 5 deletions test/embedded/stdlib-random.swift
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
// RUN: %target-swift-frontend -target armv7-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %target-swift-frontend -target arm64-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %swift_frontend_plain -target armv7-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %swift_frontend_plain -target arm64-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s

// UNSUPPORTED: CPU=wasm32
// REQUIRES: swift_in_compiler
// REQUIRES: optimized_stdlib
// REQUIRES: embedded_stdlib_cross_compiling
// REQUIRES: swift_feature_Embedded

// https://github.com/apple/swift/issues/73249
// UNSUPPORTED: OS=windows-msvc

public func test() {
Bool.random()
Int.random(in: 0 ..< 100)
Expand Down
7 changes: 2 additions & 5 deletions test/embedded/stdlib-set.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %target-swift-frontend -target armv7-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %target-swift-frontend -target arm64-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %swift_frontend_plain -target armv7-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %swift_frontend_plain -target arm64-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s

// UNSUPPORTED: CPU=wasm32
// REQUIRES: swift_in_compiler
Expand All @@ -8,9 +8,6 @@
// REQUIRES: embedded_stdlib_cross_compiling
// REQUIRES: swift_feature_Embedded

// https://github.com/apple/swift/issues/73249
// UNSUPPORTED: OS=windows-msvc

public func test() {
var s: Set<Int> = [1, 2, 3]
s.insert(42)
Expand Down
6 changes: 3 additions & 3 deletions test/embedded/stdlib-strings-interpolation3.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: %target-swift-frontend -target armv7-apple-none-macho -module-name main -parse-as-library -emit-ir %s -enable-experimental-feature Embedded
// RUN: %target-swift-frontend -target armv7-apple-none-macho -module-name main -parse-as-library -emit-ir %s -enable-experimental-feature Embedded -O
// RUN: %target-swift-frontend -target armv7-apple-none-macho -module-name main -parse-as-library -emit-ir %s -enable-experimental-feature Embedded -Osize
// RUN: %swift_frontend_plain -target armv7-apple-none-macho -module-name main -parse-as-library -emit-ir %s -enable-experimental-feature Embedded
// RUN: %swift_frontend_plain -target armv7-apple-none-macho -module-name main -parse-as-library -emit-ir %s -enable-experimental-feature Embedded -O
// RUN: %swift_frontend_plain -target armv7-apple-none-macho -module-name main -parse-as-library -emit-ir %s -enable-experimental-feature Embedded -Osize

// UNSUPPORTED: CPU=wasm32
// REQUIRES: swift_in_compiler
Expand Down
4 changes: 2 additions & 2 deletions test/embedded/stdlib-types-riscv.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %target-swift-frontend -target riscv32-none-none-eabi -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %target-swift-frontend -target riscv64-none-none-eabi -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %swift_frontend_plain -target riscv32-none-none-eabi -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %swift_frontend_plain -target riscv64-none-none-eabi -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s

// UNSUPPORTED: CPU=wasm32
// REQUIRES: swift_in_compiler
Expand Down
7 changes: 2 additions & 5 deletions test/embedded/stdlib-types.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %target-swift-frontend -target armv7-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %target-swift-frontend -target arm64-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %swift_frontend_plain -target armv7-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
// RUN: %swift_frontend_plain -target arm64-apple-none-macho -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s

// UNSUPPORTED: CPU=wasm32
// REQUIRES: swift_in_compiler
Expand All @@ -8,9 +8,6 @@
// REQUIRES: embedded_stdlib_cross_compiling
// REQUIRES: swift_feature_Embedded

// https://github.com/apple/swift/issues/73249
// UNSUPPORTED: OS=windows-msvc

class MyClass {}

public func test() {
Expand Down
2 changes: 1 addition & 1 deletion utils/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,7 @@ function Build-CMakeProject {
# Disable EnC as that introduces padding in the conformance tables
$SwiftFlags += @("-Xlinker", "/INCREMENTAL:NO")
# Swift requires COMDAT folding and de-duplication
$SwiftFlags += @("-Xlinker", "/OPT:REF", "-Xlinker", "/OPT:ICF")
$SwiftFlags += @("-Xlinker", "/OPT:REF", "-Xlinker", "/OPT:ICF", "-v", "-Xcc", "-v")

Add-FlagsDefine $Defines CMAKE_Swift_FLAGS $SwiftFlags
# Workaround CMake 3.26+ enabling `-wmo` by default on release builds
Expand Down