DO_NOT_MERGE Break the order of static initializers evaluation
diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt
index 7f36e00..bff840f 100644
--- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt
+++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt
@@ -2715,7 +2715,7 @@
//-------------------------------------------------------------------------//
fun appendStaticInitializers() {
// Note: the list of libraries is topologically sorted (in order for initializers to be called correctly).
- val dependencies = (generationState.dependenciesTracker.allBitcodeDependencies + listOf(null)/* Null for "current" non-library module */)
+ val dependencies = (generationState.dependenciesTracker.allBitcodeDependencies.reversed() + listOf(null)/* Null for "current" non-library module */)
val libraryToInitializers = dependencies.associate { it?.library to mutableListOf<RuntimeInitializer>() }