diff --git a/kotlin-native/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt b/kotlin-native/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt index 5f995b9a0cc..b59a1ab69ad 100644 --- a/kotlin-native/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt +++ b/kotlin-native/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt @@ -137,6 +137,9 @@ class K2Native : CLICompiler() { spawnedConfiguration.setupCommonArguments(spawnedArguments, this@K2Native::createMetadataVersion) spawnedConfiguration.setupFromArguments(spawnedArguments) spawnedConfiguration.setupPartialLinkageConfig(configuration.partialLinkageConfig) + configuration.get(CommonConfigurationKeys.USE_FIR)?.let { + spawnedConfiguration.put(CommonConfigurationKeys.USE_FIR, it) + } configuration.get(CommonConfigurationKeys.LANGUAGE_VERSION_SETTINGS)?.let { spawnedConfiguration.put(CommonConfigurationKeys.LANGUAGE_VERSION_SETTINGS, it) } diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanDriver.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanDriver.kt index 8048d8e784a..57896646187 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanDriver.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanDriver.kt @@ -166,6 +166,8 @@ class KonanDriver( // For the second stage, remove already compiled source files from the configuration. configuration.put(CLIConfigurationKeys.CONTENT_ROOTS, listOf()) + // Frontend version must not be passed to 2nd stage (same as Gradle plugin does when calling CLI compiler), since there are no sources anymore + configuration.put(CommonConfigurationKeys.USE_FIR, false) // For the second stage, provide just compiled intermediate KLib as "-Xinclude=" param. require(intermediateKLib.exists) { "Intermediate KLib $intermediateKLib must have been created by successful first compilation stage" } configuration.put(KonanConfigKeys.INCLUDED_LIBRARIES,