mirror of
https://github.com/apple/swift.git
synced 2026-10-08 12:50:50 +02:00
`%target-embedded-link` now bundles `libswiftCore.a` (and `libswiftEmbeddedPlatformPOSIX.a` when available), so RUN lines that spell out `%target-embedded-posix-shim` or `%embedded-stdlib` alongside it are redundant. Also switch `concurrency-dynamic-isolation-link.swift` from raw `%target-clang` to `%target-embedded-link` so it picks up the stdlib archive through the same substitution.
51 lines
2.3 KiB
Swift
51 lines
2.3 KiB
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: split-file %s %t
|
|
|
|
// Compile LibA as a module (not concurrency-checked — no -swift-version 6)
|
|
// RUN: %target-swift-frontend -emit-module -o %t/LibA.swiftmodule %t/LibA.swift -enable-experimental-feature Embedded -parse-as-library
|
|
|
|
// Swift 5: compile, link, and run (should succeed — no dynamic isolation check emitted)
|
|
// RUN: %target-swift-frontend -c -I %t %t/Main.swift -enable-experimental-feature Embedded -o %t/a5.o -parse-as-library -swift-version 5
|
|
// RUN: %target-embedded-link %t/a5.o -o %t/a5.out -L%swift_obj_root/lib/swift/embedded/%module-target-triple %target-clang-resource-dir-opt -lswift_Concurrency %target-swift-default-executor-opt -dead_strip
|
|
// RUN: %target-run %t/a5.out | %FileCheck %s
|
|
|
|
// Swift 6: compile, link, and run should all succeed. Dynamic isolation checking
|
|
// emits a reference to swift_task_reportUnexpectedExecutor, which pulls in Actor.cpp.o
|
|
// from libswift_Concurrency.a. Actor.cpp.o must not reference full-runtime symbols
|
|
// (like _swift_shouldReportFatalErrorsToDebugger) that are unavailable in embedded mode.
|
|
// RUN: %target-swift-frontend -c -I %t %t/Main.swift -enable-experimental-feature Embedded -o %t/a6.o -parse-as-library -swift-version 6
|
|
// RUN: %target-embedded-link %t/a6.o -o %t/a6.out -L%swift_obj_root/lib/swift/embedded/%module-target-triple %target-clang-resource-dir-opt -lswift_Concurrency %target-swift-default-executor-opt -dead_strip
|
|
// RUN: %target-run %t/a6.out | %FileCheck %s
|
|
|
|
// swift_task_reportUnexpectedExecutor should be referenced in Swift 6 (dynamic
|
|
// isolation checking) but not Swift 5. Linking succeeds because Actor.cpp.o
|
|
// (which defines it) no longer pulls in full-runtime symbols in embedded mode.
|
|
// RUN: %llvm-nm --undefined-only %t/a6.o | %FileCheck %s --check-prefix=SWIFT6
|
|
// RUN: %llvm-nm --undefined-only %t/a5.o | %FileCheck %s --check-prefix=SWIFT5
|
|
|
|
// REQUIRES: executable_test
|
|
// REQUIRES: optimized_stdlib
|
|
// REQUIRES: OS=wasip1
|
|
// REQUIRES: swift_feature_Embedded
|
|
|
|
// CHECK: OK
|
|
|
|
// SWIFT6: swift_task_reportUnexpectedExecutor
|
|
// SWIFT5-NOT: swift_task_reportUnexpectedExecutor
|
|
|
|
//--- LibA.swift
|
|
import _Concurrency
|
|
public func takeClosure(_ f: @escaping () -> Void) { f() }
|
|
|
|
//--- Main.swift
|
|
import LibA
|
|
import _Concurrency
|
|
|
|
@main
|
|
struct App {
|
|
static func main() async {
|
|
takeClosure { _ = 42 }
|
|
print("OK")
|
|
}
|
|
}
|