From 14b8aff80975d534cb0958d9b4a8d79f7eaad7a0 Mon Sep 17 00:00:00 2001 From: Tomas Lindquist Olsen Date: Sat, 28 Mar 2009 09:45:33 +0100 Subject: [PATCH] Fixed issue with runtime supplied typeinfo generating multiple symbols. Added new ldc.llvmasm import in runtime cmake file. --- gen/typinf.cpp | 9 +++++++-- runtime/CMakeLists.txt | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) 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