Introduce property for relocation mode
This commit is contained in:
committed by
Stanislav Erokhin
parent
3068c230f9
commit
e8e705bf68
+21
-3
@@ -18,19 +18,37 @@ package org.jetbrains.kotlin.konan.target
|
||||
|
||||
import org.jetbrains.kotlin.konan.properties.*
|
||||
|
||||
interface ClangFlags : TargetableExternalStorage {
|
||||
interface RelocationModeFlags : TargetableExternalStorage {
|
||||
val dynamicLibraryRelocationMode get() = targetString("dynamicLibraryRelocationMode").mode()
|
||||
val staticLibraryRelocationMode get() = targetString("staticLibraryRelocationMode").mode()
|
||||
val executableRelocationMode get() = targetString("executableRelocationMode").mode()
|
||||
|
||||
private fun String?.mode(): Mode = when (this?.toLowerCase()) {
|
||||
null -> Mode.DEFAULT
|
||||
"pic" -> Mode.PIC
|
||||
"static" -> Mode.STATIC
|
||||
else -> error("Unknown relocation mode: $this")
|
||||
}
|
||||
|
||||
enum class Mode {
|
||||
PIC,
|
||||
STATIC,
|
||||
DEFAULT
|
||||
}
|
||||
}
|
||||
|
||||
interface ClangFlags : TargetableExternalStorage, RelocationModeFlags {
|
||||
val clangFlags get() = targetList("clangFlags")
|
||||
val clangNooptFlags get() = targetList("clangNooptFlags")
|
||||
val clangOptFlags get() = targetList("clangOptFlags")
|
||||
val clangDebugFlags get() = targetList("clangDebugFlags")
|
||||
val clangDynamicFlags get() = targetList("clangDynamicFlags")
|
||||
}
|
||||
|
||||
interface LldFlags : TargetableExternalStorage {
|
||||
val lldFlags get() = targetList("lld")
|
||||
}
|
||||
|
||||
interface Configurables : TargetableExternalStorage {
|
||||
interface Configurables : TargetableExternalStorage, RelocationModeFlags {
|
||||
|
||||
val target: KonanTarget
|
||||
|
||||
|
||||
Reference in New Issue
Block a user