[link][debug] when build debug build, it's better to use -O0 opt flags

This commit is contained in:
Vasily Levchenko
2017-07-05 11:46:41 +03:00
committed by vvlevchenko
parent 27517b0db1
commit addb6e08d8
2 changed files with 8 additions and 4 deletions
@@ -48,6 +48,8 @@ internal abstract class PlatformFlags(val distribution: Distribution) {
= propertyTargetList("linkerKonanFlags") = propertyTargetList("linkerKonanFlags")
open val linkerDebugFlags open val linkerDebugFlags
= propertyTargetList("linkerDebugFlags") = propertyTargetList("linkerDebugFlags")
open val llvmDebugOptFlags
= propertyTargetList("llvmDebugOptFlags")
open val useCompilerDriverAsLinker: Boolean get() = false // TODO: refactor. open val useCompilerDriverAsLinker: Boolean get() = false // TODO: refactor.
@@ -198,6 +200,7 @@ internal class LinkStage(val context: Context) {
} }
val optimize = config.get(KonanConfigKeys.OPTIMIZATION) ?: false val optimize = config.get(KonanConfigKeys.OPTIMIZATION) ?: false
val debug = config.get(KonanConfigKeys.DEBUG) ?: false
val nomain = config.get(KonanConfigKeys.NOMAIN) ?: false val nomain = config.get(KonanConfigKeys.NOMAIN) ?: false
val emitted = context.bitcodeFileName val emitted = context.bitcodeFileName
val libraries = context.config.libraries val libraries = context.config.libraries
@@ -210,10 +213,10 @@ internal class LinkStage(val context: Context) {
val tool = distribution.llvmLto val tool = distribution.llvmLto
val command = mutableListOf(tool, "-o", combined) val command = mutableListOf(tool, "-o", combined)
command.addAll(platform.llvmLtoFlags) command.addAll(platform.llvmLtoFlags)
if (optimize) { when {
command.addAll(platform.llvmLtoOptFlags) optimize -> command.addAll(platform.llvmLtoOptFlags)
} else { debug -> command.addAll(platform.llvmDebugOptFlags)
command.addAll(platform.llvmLtoNooptFlags) else -> command.addAll(platform.llvmLtoNooptFlags)
} }
command.addAll(files) command.addAll(files)
runTool(*command.toTypedArray()) runTool(*command.toTypedArray())
+1
View File
@@ -20,6 +20,7 @@ dependenciesUrl = http://download.jetbrains.com/kotlin/native
# Don't check dependencies on a server. # Don't check dependencies on a server.
# If true, dependency downloader will throw an exception if a dependency isn't found in konan.home. # If true, dependency downloader will throw an exception if a dependency isn't found in konan.home.
airplaneMode = false airplaneMode = false
llvmDebugOptFlags = -O0
# Mac OS X. # Mac OS X.
llvmVersion.osx = 3.9.0 llvmVersion.osx = 3.9.0