Mercurial > projects > ldc
diff gen/typinf.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 | 2dfd05525e2e |
children | f0b6549055ab |
line wrap: on
line diff
--- a/gen/typinf.cpp Mon Feb 02 00:58:36 2009 +0100 +++ b/gen/typinf.cpp Mon Feb 02 01:44:51 2009 +0100 @@ -379,7 +379,7 @@ const LLStructType* stype = isaStruct(base->type->ir.type->get()); // create the symbol - ir.irGlobal->value = new llvm::GlobalVariable(ir.irGlobal->type.get(), true,llvm::GlobalValue::WeakLinkage,NULL,toChars(),gIR->module); + ir.irGlobal->value = new llvm::GlobalVariable(ir.irGlobal->type.get(), true, TYPEINFO_LINKAGE_TYPE, NULL, toChars(), gIR->module); } void TypeInfoTypedefDeclaration::llvmDefine() @@ -453,7 +453,7 @@ DtoResolveClass(base); // create the symbol - ir.irGlobal->value = new llvm::GlobalVariable(ir.irGlobal->type.get(), true,llvm::GlobalValue::WeakLinkage,NULL,toChars(),gIR->module); + ir.irGlobal->value = new llvm::GlobalVariable(ir.irGlobal->type.get(), true, TYPEINFO_LINKAGE_TYPE, NULL, toChars(), gIR->module); } void TypeInfoEnumDeclaration::llvmDefine() @@ -528,7 +528,7 @@ DtoResolveClass(base); // create the symbol - tid->ir.irGlobal->value = new llvm::GlobalVariable(tid->ir.irGlobal->type.get(), true,llvm::GlobalValue::WeakLinkage,NULL,tid->toChars(),gIR->module); + tid->ir.irGlobal->value = new llvm::GlobalVariable(tid->ir.irGlobal->type.get(), true, TYPEINFO_LINKAGE_TYPE, NULL, tid->toChars(), gIR->module); } static void LLVM_D_Define_TypeInfoBase(Type* basetype, TypeInfoDeclaration* tid, ClassDeclaration* cd) @@ -627,7 +627,7 @@ DtoResolveClass(base); // create the symbol - ir.irGlobal->value = new llvm::GlobalVariable(ir.irGlobal->type.get(), true,llvm::GlobalValue::WeakLinkage,NULL,toChars(),gIR->module); + ir.irGlobal->value = new llvm::GlobalVariable(ir.irGlobal->type.get(), true, TYPEINFO_LINKAGE_TYPE, NULL, toChars(), gIR->module); } void TypeInfoStaticArrayDeclaration::llvmDefine() @@ -687,7 +687,7 @@ DtoResolveClass(base); // create the symbol - ir.irGlobal->value = new llvm::GlobalVariable(ir.irGlobal->type.get(), true,llvm::GlobalValue::WeakLinkage,NULL,toChars(),gIR->module); + ir.irGlobal->value = new llvm::GlobalVariable(ir.irGlobal->type.get(), true, TYPEINFO_LINKAGE_TYPE, NULL, toChars(), gIR->module); } void TypeInfoAssociativeArrayDeclaration::llvmDefine() @@ -808,7 +808,7 @@ DtoResolveClass(base); // create the symbol - ir.irGlobal->value = new llvm::GlobalVariable(ir.irGlobal->type.get(), true,llvm::GlobalValue::WeakLinkage,NULL,toChars(),gIR->module); + ir.irGlobal->value = new llvm::GlobalVariable(ir.irGlobal->type.get(), true, TYPEINFO_LINKAGE_TYPE, NULL, toChars(), gIR->module); } void TypeInfoStructDeclaration::llvmDefine() @@ -1024,7 +1024,7 @@ DtoResolveClass(base); // create the symbol - ir.irGlobal->value = new llvm::GlobalVariable(ir.irGlobal->type.get(), true, llvm::GlobalValue::WeakLinkage, NULL, toChars(), gIR->module); + ir.irGlobal->value = new llvm::GlobalVariable(ir.irGlobal->type.get(), true, TYPEINFO_LINKAGE_TYPE, NULL, toChars(), gIR->module); } void TypeInfoClassDeclaration::llvmDefine() @@ -1080,7 +1080,7 @@ DtoResolveClass(base); // create the symbol - ir.irGlobal->value = new llvm::GlobalVariable(ir.irGlobal->type.get(), true,llvm::GlobalValue::WeakLinkage,NULL,toChars(),gIR->module); + ir.irGlobal->value = new llvm::GlobalVariable(ir.irGlobal->type.get(), true, TYPEINFO_LINKAGE_TYPE, NULL, toChars(), gIR->module); } void TypeInfoInterfaceDeclaration::llvmDefine() @@ -1138,7 +1138,7 @@ DtoResolveClass(base); // create the symbol - ir.irGlobal->value = new llvm::GlobalVariable(ir.irGlobal->type.get(), true,llvm::GlobalValue::WeakLinkage,NULL,toChars(),gIR->module); + ir.irGlobal->value = new llvm::GlobalVariable(ir.irGlobal->type.get(), true, TYPEINFO_LINKAGE_TYPE, NULL, toChars(), gIR->module); } void TypeInfoTupleDeclaration::llvmDefine() @@ -1185,7 +1185,7 @@ LLConstant* arrC = llvm::ConstantArray::get(arrTy, arrInits); // need the pointer to the first element of arrC, so create a global for it - llvm::GlobalValue::LinkageTypes _linkage = llvm::GlobalValue::InternalLinkage;//WeakLinkage; + llvm::GlobalValue::LinkageTypes _linkage = llvm::GlobalValue::InternalLinkage; llvm::GlobalVariable* gvar = new llvm::GlobalVariable(arrTy,true,_linkage,arrC,".tupleelements",gIR->module); // get pointer to first element