Skip to content

Commit d64a6ca

Browse files
committed
[embedded] Use %target-embedded-link substitution for embedded linking in lit tests
1 parent dcb2636 commit d64a6ca

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Diff for: test/embedded/linkage-mergeable4.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// RUN: %target-swift-frontend -mergeable-symbols -num-threads 2 -O -c -emit-module -o %t/MyModule.o %t/MyModule.swift -enable-experimental-feature Embedded -parse-as-library
55
// RUN: %target-swift-frontend -mergeable-symbols -num-threads 2 -O -c -o %t/MainA.o -o %t/MainB.o %t/MainA.swift %t/MainB.swift -I %t -enable-experimental-feature Embedded -parse-as-library
6-
// RUN: %target-clang %linux_rng_support_c_if_needed %t/MainA.o %t/MainB.o %t/MyModule.o -o %t/a.out
6+
// RUN: %target-embedded-link %t/MainA.o %t/MainB.o %t/MyModule.o -o %t/a.out
77
// RUN: %target-run %t/a.out | %FileCheck %s
88

99
// REQUIRES: swift_in_compiler

Diff for: test/embedded/lit.local.cfg

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ config.substitutions = list(config.substitutions)
44
# A handful of test setup tweaks that we want for *all* Embedded Swift tests (i.e. all tests in this directory):
55

66
# (1) When targeting macOS, raise the deployment target to macOS 14.0 (from the default 13.0)
7+
config.target_clang = config.target_clang.replace("-apple-macosx13.0", "-apple-macos14")
78
if config.target_sdk_name == 'macosx':
89
def do_fixup(key, value):
910
if isinstance(value, str):
@@ -31,6 +32,6 @@ if 'SWIFT_AVOID_WARNING_USING_OLD_DRIVER' in config.environment: del config.envi
3132

3233
# (5) Provide some useful substitutions to simplify writing tests that work across platforms (macOS, Linux, etc.)
3334
if "OS=linux-gnu" in config.available_features:
34-
config.substitutions.append(("%linux_rng_support_c_if_needed", "-x c %S/Inputs/linux-rng-support.c"))
35+
config.substitutions.append(("%target-embedded-link", config.target_clang + " -x c %S/Inputs/linux-rng-support.c -x none"))
3536
else:
36-
config.substitutions.append(("%linux_rng_support_c_if_needed", ""))
37+
config.substitutions.append(("%target-embedded-link", config.target_clang))

0 commit comments

Comments
 (0)