From dd55ca6ed0c151e286e302cc2a44d9a9a890bda7 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Thu, 7 Dec 2023 15:10:04 +0000 Subject: [PATCH] Native: fix Swift compilation in tests for tvos_simulator_arm64 e5ae32c removed bitcode embedding from tests. In particular, that commit disabled bitcode embedding when compiling Swift code (e.g. in ObjCExport tests). It seems that bitcode embedding also enables adhoc codesigning in the linker. The linker doesn't seem to do adhoc codesigning by default for tvOS arm64 simulator target, and without a signature the binaries can't run on the simulator. So disabling bitcode embedding also disabled adhoc codesigning and made the tests fail on that target. Fix this by explicitly passing `-Xlinker -adhoc_codesign` when compiling Swift code in tests. --- .../build-tools/src/main/kotlin/org/jetbrains/kotlin/Utils.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/Utils.kt b/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/Utils.kt index 0f533d109e8..8e089b4f913 100644 --- a/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/Utils.kt +++ b/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/Utils.kt @@ -297,7 +297,8 @@ fun compileSwift( val swiftTarget = configs.targetTriple.withOSVersion(configs.osVersionMin).toString() val args = listOf("-sdk", configs.absoluteTargetSysRoot, "-target", swiftTarget) + - options + "-o" + output.toString() + sources + options + "-o" + output.toString() + sources + + listOf("-Xlinker", "-adhoc_codesign") // Linker doesn't do adhoc codesigning for tvOS arm64 simulator by default. val (stdOut, stdErr, exitCode) = runProcess( executor = localExecutor(project), executable = compiler, args = args,