From b2ca861f64d9b3168ae9142469329cb35d0a4cb3 Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Sun, 12 May 2013 01:25:48 +0200 Subject: [PATCH] Fixed ModuleInfo module name emission. The name string is actually emitted inline, not as a pointer to a global. GitHub: Fixes #243. --- gen/module.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gen/module.cpp b/gen/module.cpp index 57127a94..5893de65 100644 --- a/gen/module.cpp +++ b/gen/module.cpp @@ -510,8 +510,12 @@ void Module::genmoduleinfo() b.push(localClasses); } - // Put out module name as a 0-terminated string, to save bytes - b.push(DtoConstStringPtr(toPrettyChars())); + // Put out module name as a 0-terminated string. + const char *name = toPrettyChars(); + const size_t len = strlen(name) + 1; + llvm::IntegerType *it = llvm::IntegerType::getInt8Ty(gIR->context()); + llvm::ArrayType *at = llvm::ArrayType::get(it, len); + b.push(toConstantArray(it, at, name, len, false)); // create and set initializer b.finalize(moduleInfoType, moduleInfoSymbol());