Review fixes

This commit is contained in:
Sergey Bogolepov
2018-01-31 17:09:51 +07:00
committed by Sergey Bogolepov
parent a3c7dc8919
commit cff142a617
3 changed files with 4 additions and 5 deletions
@@ -386,8 +386,7 @@ internal class Context(config: KonanConfig) : KonanBackendContext(config) {
config.configuration.get(KonanConfigKeys.PRODUCE) == CompilerOutputKind.DYNAMIC
}
val isWasmTarget: Boolean by lazy {
config.targetManager.target == KonanTarget.WASM32
}
fun shouldPreserveRuntimeSymbols(): Boolean =
config.targetManager.target == KonanTarget.WASM32
}
@@ -659,7 +659,7 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
// Preserve symbol from deletion if needed
if (descriptor.usedAnnotation
|| (context.isWasmTarget && descriptor.isExportedForCppRuntime())) {
|| (context.shouldPreserveRuntimeSymbols() && descriptor.isExportedForCppRuntime())) {
context.llvm.usedFunctions += codegen.llvmFunction(descriptor)
}
@@ -90,7 +90,7 @@ internal class RTTIGenerator(override val context: Context) : ContextUtils {
// TODO: use LLVMAddAlias?
val global = addGlobal(nameValue.value, pointerType(runtime.typeInfoType), isExported = true)
if (context.isWasmTarget) {
if (context.shouldPreserveRuntimeSymbols()) {
context.llvm.usedGlobals += global
}