[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")
open val linkerDebugFlags
= propertyTargetList("linkerDebugFlags")
open val llvmDebugOptFlags
= propertyTargetList("llvmDebugOptFlags")
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 debug = config.get(KonanConfigKeys.DEBUG) ?: false
val nomain = config.get(KonanConfigKeys.NOMAIN) ?: false
val emitted = context.bitcodeFileName
val libraries = context.config.libraries
@@ -210,10 +213,10 @@ internal class LinkStage(val context: Context) {
val tool = distribution.llvmLto
val command = mutableListOf(tool, "-o", combined)
command.addAll(platform.llvmLtoFlags)
if (optimize) {
command.addAll(platform.llvmLtoOptFlags)
} else {
command.addAll(platform.llvmLtoNooptFlags)
when {
optimize -> command.addAll(platform.llvmLtoOptFlags)
debug -> command.addAll(platform.llvmDebugOptFlags)
else -> command.addAll(platform.llvmLtoNooptFlags)
}
command.addAll(files)
runTool(*command.toTypedArray())
+1
View File
@@ -20,6 +20,7 @@ dependenciesUrl = http://download.jetbrains.com/kotlin/native
# Don't check dependencies on a server.
# If true, dependency downloader will throw an exception if a dependency isn't found in konan.home.
airplaneMode = false
llvmDebugOptFlags = -O0
# Mac OS X.
llvmVersion.osx = 3.9.0