comparison gen/llvmhelpers.cpp @ 918:a4fcc13da3cd

Changed templates and typeinfo to use linkonce linkage instead of weak linkage, this should fix inlining problems, fixing bug #197 . If problems show up, it's easy to change it back by changing the define in mars.h . I'm 95% sure this is safe, given how we handle templates.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Mon, 02 Feb 2009 01:44:51 +0100
parents d128381e086e
children 545f54041d91
comparison
equal deleted inserted replaced
917:7e272f2b4fc3 918:a4fcc13da3cd
842 ////////////////////////////////////////////////////////////////////////////////////////*/ 842 ////////////////////////////////////////////////////////////////////////////////////////*/
843 843
844 void DtoLazyStaticInit(bool istempl, LLValue* gvar, Initializer* init, Type* t) 844 void DtoLazyStaticInit(bool istempl, LLValue* gvar, Initializer* init, Type* t)
845 { 845 {
846 // create a flag to make sure initialization only happens once 846 // create a flag to make sure initialization only happens once
847 llvm::GlobalValue::LinkageTypes gflaglink = istempl ? llvm::GlobalValue::WeakLinkage : llvm::GlobalValue::InternalLinkage; 847 llvm::GlobalValue::LinkageTypes gflaglink = istempl ? TEMPLATE_LINKAGE_TYPE : llvm::GlobalValue::InternalLinkage;
848 std::string gflagname(gvar->getName()); 848 std::string gflagname(gvar->getName());
849 gflagname.append("__initflag"); 849 gflagname.append("__initflag");
850 llvm::GlobalVariable* gflag = new llvm::GlobalVariable(LLType::Int1Ty,false,gflaglink,DtoConstBool(false),gflagname,gIR->module); 850 llvm::GlobalVariable* gflag = new llvm::GlobalVariable(LLType::Int1Ty,false,gflaglink,DtoConstBool(false),gflagname,gIR->module);
851 851
852 // check flag and do init if not already done 852 // check flag and do init if not already done