[K/N] Introduce LLD compatibility checker for MinGW

We are going to switch to LLD linker for MinGW targets.
Right now LLD for MinGW doesn't support all features
of ld.bfd and thus this change might be breaking for some users.
To make transition smoother, we run lld -### to show a warning to user
so they can update their compilation options before LLD will be turned
on by default.

More details: https://youtrack.jetbrains.com/issue/KT-47605
This commit is contained in:
Sergey Bogolepov
2021-07-06 14:53:59 +07:00
committed by Space
parent 30d0fea003
commit 9ed97a27f1
7 changed files with 78 additions and 10 deletions
@@ -298,6 +298,15 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
configuration.report(ERROR, "-Xgc-aggressive is only supported for -memory-model experimental")
}
put(GARBAGE_COLLECTOR_AGRESSIVE, arguments.gcAggressive)
put(CHECK_LLD_COMPATIBILITY, when (val it = arguments.checkLldCompatibility) {
"enable" -> true
"disable" -> false
null -> true
else -> {
configuration.report(ERROR, "Unsupported '-Xcheck-compatibility-with-lld' value: $it. Possible values are 'enable'/'disable'")
true
}
})
}
}
}
@@ -314,6 +314,13 @@ class K2NativeCompilerArguments : CommonCompilerArguments() {
@Argument(value="-Xgc-aggressive", description = "Make GC agressive. Works only with -memory-model experimental")
var gcAggressive: Boolean = false
@Argument(
value = "-Xcheck-compatibility-with-lld",
valueDescription = "{disable|enable}",
description = "Check that linker flags are compatible with LLD."
)
var checkLldCompatibility: String? = null
override fun configureAnalysisFlags(collector: MessageCollector, languageVersion: LanguageVersion): MutableMap<AnalysisFlag<*>, Any> =
super.configureAnalysisFlags(collector, languageVersion).also {
val useExperimental = it[AnalysisFlags.useExperimental] as List<*>