diff --git a/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/AbiSpecific.kt b/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/AbiSpecific.kt index a1794e0a27e..657e8a4c812 100644 --- a/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/AbiSpecific.kt +++ b/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/AbiSpecific.kt @@ -18,12 +18,7 @@ import org.jetbrains.kotlin.native.interop.indexer.* internal fun Type.isStret(target: KonanTarget): Boolean { val unwrappedType = this.unwrapTypedefs() val abiInfo: ObjCAbiInfo = when (target.architecture) { - Architecture.ARM64 -> { - // Currently, cinterop works with watchos_arm64 as with watchos_arm32. - // TODO: ABI for watchos_arm64 should be revisited after LLVM update. - require(target != KonanTarget.WATCHOS_ARM64) - DarwinArm64AbiInfo() - } + Architecture.ARM64 -> DarwinArm64AbiInfo() Architecture.X64 -> DarwinX64AbiInfo() @@ -88,6 +83,9 @@ class DarwinArm32AbiInfo(private val target: KonanTarget) : ObjCAbiInfo { } } +/** + * Remember about arm64_32! + */ class DarwinArm64AbiInfo : ObjCAbiInfo { override fun shouldUseStret(returnType: Type): Boolean { // On aarch64 stret is never the case, since an implicit argument gets passed on x8. diff --git a/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt b/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt index 9908305a085..ae7755cb2f6 100644 --- a/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt +++ b/kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt @@ -288,13 +288,7 @@ private fun processCLib(flavor: KotlinPlatform, cinteropArguments: CInteropArgum val (nativeIndex, compilation) = plugin.buildNativeIndex(library, verbose) - // Our current approach to arm64_32 support is to compile armv7k version of bitcode - // for arm64_32. That's the reason for this substitution. - // TODO: Add proper support with the next LLVM update. - val target = when (tool.target) { - KonanTarget.WATCHOS_ARM64 -> KonanTarget.WATCHOS_ARM32 - else -> tool.target - } + val target = tool.target val klibSuffix = CompilerOutputKind.LIBRARY.suffix(target) val moduleName = cinteropArguments.moduleName diff --git a/kotlin-native/konan/konan.properties b/kotlin-native/konan/konan.properties index 59062b0ec7b..5c24cbbaf14 100644 --- a/kotlin-native/konan/konan.properties +++ b/kotlin-native/konan/konan.properties @@ -393,8 +393,7 @@ targetToolchain.macos_arm64-watchos_arm64 = target-toolchain-xcode_13_1 targetTriple.watchos_arm64 = arm64_32-apple-watchos targetSysRoot.watchos_arm64 = target-sysroot-xcode_13_1-watchos -# TODO: Use -target-cpu=apple-s4 when we start generating bitcode for arm64_32. -targetCpu.watchos_arm64 = cortex-a7 +targetCpu.watchos_arm64 = apple-s4 clangFlags.watchos_arm64 = -cc1 -emit-obj -disable-llvm-passes -x ir -mllvm -aarch64-watch-bitcode-compatibility \ -mllvm -arm-bitcode-compatibility clangNooptFlags.watchos_arm64 = -O1