diff --git a/gen/typinf.cpp b/gen/typinf.cpp index 44e2bb2041..1f4ecab2da 100644 --- a/gen/typinf.cpp +++ b/gen/typinf.cpp @@ -289,8 +289,13 @@ void DtoResolveTypeInfo(TypeInfoDeclaration* tid) LOG_SCOPE; IrGlobal* irg = new IrGlobal(tid); - irg->value = new llvm::GlobalVariable(irg->type.get(), true, - TYPEINFO_LINKAGE_TYPE, NULL, tid->mangle(), gIR->module); + + std::string mangle(tid->mangle()); + + irg->value = gIR->module->getGlobalVariable(mangle); + if (!irg->value) + irg->value = new llvm::GlobalVariable(irg->type.get(), true, + TYPEINFO_LINKAGE_TYPE, NULL, mangle, gIR->module); tid->ir.irGlobal = irg; diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 2df105475d..9c0b62feef 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -44,6 +44,7 @@ if(D_VERSION EQUAL 1) endmacro(imports_file) imports_file(import/ldc/cstdarg.di) imports_file(import/ldc/intrinsics.di) + imports_file(internal/ldc/llvmasm.di) imports_file(internal/ldc/bitmanip.d) imports_file(internal/ldc/vararg.d) # library names