Added explanation

This commit is contained in:
Sergey Bogolepov
2018-02-02 15:02:41 +03:00
committed by Sergey Bogolepov
parent 96afe7a274
commit 8b351078e6
@@ -386,6 +386,13 @@ internal class Context(config: KonanConfig) : KonanBackendContext(config) {
config.configuration.get(KonanConfigKeys.PRODUCE) == CompilerOutputKind.DYNAMIC
}
// For wasm32 target we use `llvm-link -internalize` which is kinda broken.
// llvm-link links modules one by one and can't see usages
// of symbol in subsequent modules. So it will mangle such symbol if
// -internalize flag (which is needed for DCE) is provided
// That's the case for the stdlib and runtime modules
// The solution is to add such symbols to llvm.used array to preserve them from
// mangling.
fun shouldPreserveRuntimeSymbols(): Boolean =
config.targetManager.target == KonanTarget.WASM32
}