[K/N] Properly support watchosArm64
This commit is contained in:
+4
-6
@@ -18,12 +18,7 @@ import org.jetbrains.kotlin.native.interop.indexer.*
|
|||||||
internal fun Type.isStret(target: KonanTarget): Boolean {
|
internal fun Type.isStret(target: KonanTarget): Boolean {
|
||||||
val unwrappedType = this.unwrapTypedefs()
|
val unwrappedType = this.unwrapTypedefs()
|
||||||
val abiInfo: ObjCAbiInfo = when (target.architecture) {
|
val abiInfo: ObjCAbiInfo = when (target.architecture) {
|
||||||
Architecture.ARM64 -> {
|
Architecture.ARM64 -> DarwinArm64AbiInfo()
|
||||||
// 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.X64 -> DarwinX64AbiInfo()
|
Architecture.X64 -> DarwinX64AbiInfo()
|
||||||
|
|
||||||
@@ -88,6 +83,9 @@ class DarwinArm32AbiInfo(private val target: KonanTarget) : ObjCAbiInfo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remember about arm64_32!
|
||||||
|
*/
|
||||||
class DarwinArm64AbiInfo : ObjCAbiInfo {
|
class DarwinArm64AbiInfo : ObjCAbiInfo {
|
||||||
override fun shouldUseStret(returnType: Type): Boolean {
|
override fun shouldUseStret(returnType: Type): Boolean {
|
||||||
// On aarch64 stret is never the case, since an implicit argument gets passed on x8.
|
// On aarch64 stret is never the case, since an implicit argument gets passed on x8.
|
||||||
|
|||||||
+1
-7
@@ -288,13 +288,7 @@ private fun processCLib(flavor: KotlinPlatform, cinteropArguments: CInteropArgum
|
|||||||
|
|
||||||
val (nativeIndex, compilation) = plugin.buildNativeIndex(library, verbose)
|
val (nativeIndex, compilation) = plugin.buildNativeIndex(library, verbose)
|
||||||
|
|
||||||
// Our current approach to arm64_32 support is to compile armv7k version of bitcode
|
val target = tool.target
|
||||||
// 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 klibSuffix = CompilerOutputKind.LIBRARY.suffix(target)
|
val klibSuffix = CompilerOutputKind.LIBRARY.suffix(target)
|
||||||
val moduleName = cinteropArguments.moduleName
|
val moduleName = cinteropArguments.moduleName
|
||||||
|
|||||||
@@ -393,8 +393,7 @@ targetToolchain.macos_arm64-watchos_arm64 = target-toolchain-xcode_13_1
|
|||||||
|
|
||||||
targetTriple.watchos_arm64 = arm64_32-apple-watchos
|
targetTriple.watchos_arm64 = arm64_32-apple-watchos
|
||||||
targetSysRoot.watchos_arm64 = target-sysroot-xcode_13_1-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 = apple-s4
|
||||||
targetCpu.watchos_arm64 = cortex-a7
|
|
||||||
clangFlags.watchos_arm64 = -cc1 -emit-obj -disable-llvm-passes -x ir -mllvm -aarch64-watch-bitcode-compatibility \
|
clangFlags.watchos_arm64 = -cc1 -emit-obj -disable-llvm-passes -x ir -mllvm -aarch64-watch-bitcode-compatibility \
|
||||||
-mllvm -arm-bitcode-compatibility
|
-mllvm -arm-bitcode-compatibility
|
||||||
clangNooptFlags.watchos_arm64 = -O1
|
clangNooptFlags.watchos_arm64 = -O1
|
||||||
|
|||||||
Reference in New Issue
Block a user