Allow multiple declarations to share the same mangled name/LLVM global.

This is necessary to enable aliasing compiler-generated
symbols with pragma(mangle, …).

Note that globals for internal use are still directly
created.
This commit is contained in:
David Nadlinger
2013-06-16 00:12:02 +02:00
parent 0305d3bce2
commit acd508945a
9 changed files with 63 additions and 34 deletions

View File

@@ -86,7 +86,7 @@ void RTTIBuilder::push_void_array(llvm::Constant* CI, Type* valtype, Dsymbol* ma
std::string initname(mangle_sym->mangle());
initname.append(".rtti.voidarr.data");
LLGlobalVariable* G = new llvm::GlobalVariable(
LLGlobalVariable* G = new LLGlobalVariable(
*gIR->module, CI->getType(), true, TYPEINFO_LINKAGE_TYPE, CI, initname);
G->setAlignment(valtype->alignsize());
@@ -105,7 +105,7 @@ void RTTIBuilder::push_array(llvm::Constant * CI, uint64_t dim, Type* valtype, D
initname.append(tmpStr);
initname.append(".data");
LLGlobalVariable* G = new llvm::GlobalVariable(
LLGlobalVariable* G = new LLGlobalVariable(
*gIR->module, CI->getType(), true, TYPEINFO_LINKAGE_TYPE, CI, initname);
G->setAlignment(valtype->alignsize());