From c5a09c9deba5beaf56323e1fa63f8c29ebbf22b6 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Sat, 28 Mar 2009 20:01:37 +0100 Subject: [PATCH] Force initialize the runtime module in Module::genLLVMModule. It is required for all non-trivial D modules anyway, so why load it lazily? This fixes run/typeid_83.d (DtoDeclareTypeInfo expects runtime to be initialized) --- gen/runtime.cpp | 4 +++- gen/toir.cpp | 4 ++-- gen/toobj.cpp | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/gen/runtime.cpp b/gen/runtime.cpp index 5c59b25a..88c4f377 100644 --- a/gen/runtime.cpp +++ b/gen/runtime.cpp @@ -36,7 +36,9 @@ bool LLVM_D_InitRuntime() Logger::println("*** Initializing D runtime declarations ***"); LOG_SCOPE; - LLVM_D_BuildRuntimeModule(); + if (!M) + LLVM_D_BuildRuntimeModule(); + return true; } diff --git a/gen/toir.cpp b/gen/toir.cpp index 8270fbc0..5cd18f4f 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -2585,8 +2585,8 @@ void obj_includelib(const char* lib) void backend_init() { - // now lazily loaded - //LLVM_D_InitRuntime(); + // LLVM_D_InitRuntime is done in Module::genLLVMModule + // since it requires the semantic pass to be done } void backend_term() diff --git a/gen/toobj.cpp b/gen/toobj.cpp index f1306988..e459d1bc 100644 --- a/gen/toobj.cpp +++ b/gen/toobj.cpp @@ -134,6 +134,8 @@ llvm::Module* Module::genLLVMModule(Ir* sir) error("is missing 'class ClassInfo'"); fatal(); } + + LLVM_D_InitRuntime(); // process module members for (int k=0; k < members->dim; k++) {