[native] Drop deprecated Kotlin/Native targets (3/8)

This commit inlines some helper-APIs that became redundant after
dropping deprecated targets.

Full list:
- 'threadsAreAllowed' is always 'true' now
- 'indirectBranchesAreAllowed' is always 'true' now
- 'supportsThreads' is always 'true' now
- 'isMips' is always 'false' now
- 'tlsMode' is always 'LLVMGeneralDynamicTLSModel' now
- 'getBoxRange' is always equal to 'cache.defaultRange' now
-  `targetHasAddressDependency` is always true now, so memory order
   is always LLVMAtomicOrderingMonotonic now

^KT-64517
This commit is contained in:
Dmitry Savvinov
2024-01-16 14:53:50 +01:00
committed by Space Team
parent 85bcc8443d
commit 29e90d70c6
13 changed files with 72 additions and 139 deletions
@@ -65,18 +65,6 @@ fun KonanTarget.supportsGccUnwind(): Boolean = family == Family.ANDROID || famil
// MINGW_X64 target does not support GCC unwind, since its sysroot contains libgcc version < 12 having misfeature, see KT-49240
fun KonanTarget.supportsWinAPIUnwind(): Boolean = this is KonanTarget.MINGW_X64
fun KonanTarget.supportsThreads(): Boolean = when(this) {
is KonanTarget.WASM32 -> false
is KonanTarget.ZEPHYR -> false
else -> true
}
fun KonanTarget.supportsExceptions(): Boolean = when(this) {
is KonanTarget.WASM32 -> false
is KonanTarget.ZEPHYR -> false
else -> true
}
fun KonanTarget.supportsObjcInterop(): Boolean = family.isAppleFamily
fun KonanTarget.hasFoundationFramework(): Boolean = family.isAppleFamily
fun KonanTarget.hasUIKitFramework(): Boolean = family == Family.IOS || family == Family.TVOS
@@ -130,12 +118,6 @@ fun KonanTarget.supportedSanitizers(): List<SanitizerKind> =
else -> listOf()
}
fun KonanTarget.hasAddressDependencyInMemoryModel(): Boolean =
when (this.architecture) {
Architecture.X86, Architecture.X64, Architecture.ARM32, Architecture.ARM64 -> true
Architecture.MIPS32, Architecture.MIPSEL32 -> false
}
val KonanTarget.supportsGrandCentralDispatch
get() = family.isAppleFamily
@@ -382,7 +382,6 @@ class GccBasedLinker(targetProperties: GccConfigurables)
}
return staticGnuArCommands(ar, executable, objectFiles, libraries)
}
val isMips = target == KonanTarget.LINUX_MIPS32 || target == KonanTarget.LINUX_MIPSEL32
val dynamic = kind == LinkerOutputKind.DYNAMIC_LIBRARY
val crtPrefix = "$absoluteTargetSysRoot/$crtFilesLocation"
// TODO: Can we extract more to the konan.configurables?
@@ -402,7 +401,7 @@ class GccBasedLinker(targetProperties: GccConfigurables)
+"$crtPrefix/crti.o"
+if (dynamic) "$libGcc/crtbeginS.o" else "$libGcc/crtbegin.o"
+"-L$libGcc"
if (!isMips) +"--hash-style=gnu" // MIPS doesn't support hash-style=gnu
+"--hash-style=gnu"
+specificLibs
if (optimize) +linkerOptimizationFlags
if (!debug) +linkerNoDebugFlags
@@ -599,4 +598,3 @@ fun linker(configurables: Configurables): LinkerFlags =
is ZephyrConfigurables -> ZephyrLinker(configurables)
else -> error("Unexpected target: ${configurables.target}")
}