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

@ -605,7 +605,8 @@ static LLConstant* build_offti_array(ClassDeclaration* cd, LLType* arrayT)
name.append("__OffsetTypeInfos");
// create symbol
llvm::GlobalVariable* gvar = new llvm::GlobalVariable(arrTy,true,DtoInternalLinkage(cd),arrInit,name,gIR->module);
llvm::GlobalVariable* gvar = getOrCreateGlobal(cd->loc, *gIR->module, arrTy,
true,DtoInternalLinkage(cd),arrInit,name);
ptr = DtoBitCast(gvar, getPtrToType(arrTy->getElementType()));
return DtoConstSlice(size, ptr);