[K/N] Properly support watchosArm64

This commit is contained in:
Sergey Bogolepov
2022-04-18 19:31:50 +03:00
committed by Space
parent 7401760d23
commit 5a0c3920a5
3 changed files with 6 additions and 15 deletions
@@ -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.
@@ -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
+1 -2
View File
@@ -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