Move linker selection to konan.properties
This commit is contained in:
committed by
Stanislav Erokhin
parent
e8e705bf68
commit
0f733b6baf
+5
@@ -112,6 +112,11 @@ interface GccConfigurables : TargetableConfigurables, ClangFlags {
|
||||
val dynamicLinker get() = targetString("dynamicLinker")!!
|
||||
val abiSpecificLibraries get() = targetList("abiSpecificLibraries")
|
||||
val crtFilesLocation get() = targetString("crtFilesLocation")!!
|
||||
|
||||
val linker get() = hostTargetString("linker")
|
||||
val linkerHostSpecificFlags get() = hostTargetList("linkerHostSpecificFlags")
|
||||
val absoluteLinker get() = absolute(linker)
|
||||
|
||||
val linkerGccFlags get() = targetList("linkerGccFlags")
|
||||
}
|
||||
|
||||
|
||||
@@ -337,17 +337,11 @@ class GccBasedLinker(targetProperties: GccConfigurables)
|
||||
needsProfileLibrary: Boolean, mimallocEnabled: Boolean): List<Command> {
|
||||
if (kind == LinkerOutputKind.STATIC_LIBRARY)
|
||||
return staticGnuArCommands(ar, executable, objectFiles, libraries)
|
||||
// TODO: Control via properties.
|
||||
val (linker, linkerSpecificFlags) = when {
|
||||
HostManager.hostIsMac -> "$absoluteLlvmHome/bin/ld.lld" to listOf("--no-threads")
|
||||
else -> "$absoluteTargetToolchain/bin/ld.gold" to emptyList()
|
||||
}
|
||||
|
||||
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?
|
||||
return listOf(Command(linker).apply {
|
||||
return listOf(Command(absoluteLinker).apply {
|
||||
+"--sysroot=${absoluteTargetSysRoot}"
|
||||
+"-export-dynamic"
|
||||
+"-z"
|
||||
@@ -355,8 +349,8 @@ class GccBasedLinker(targetProperties: GccConfigurables)
|
||||
+"--build-id"
|
||||
+"--eh-frame-hdr"
|
||||
+"-dynamic-linker"
|
||||
linkerSpecificFlags.forEach { +it }
|
||||
+dynamicLinker
|
||||
linkerHostSpecificFlags.forEach { +it }
|
||||
+"-o"
|
||||
+executable
|
||||
if (!dynamic) +"$crtPrefix/crt1.o"
|
||||
|
||||
Reference in New Issue
Block a user