Makes sure only function definitions inside templates get weak linkage, llvm doesn't allow weak linkage on just declarations, so we use external linkage for those. Fixes #162

This commit is contained in:
Tomas Lindquist Olsen
2009-01-22 17:26:50 +01:00
parent 8ac2aecf42
commit 343003cfdc

View File

@@ -294,7 +294,8 @@ LLGlobalValue::LinkageTypes DtoLinkage(Dsymbol* sym)
if (fdecl->llvmInternal == LLVMintrinsic)
return llvm::GlobalValue::ExternalLinkage;
// template instances should have weak linkage
else if (DtoIsTemplateInstance(fdecl))
// but only if there's a body, otherwise we make it external
else if (DtoIsTemplateInstance(fdecl) && fdecl->fbody)
return llvm::GlobalValue::WeakLinkage;
// extern(C) functions are always external
else if (ft->linkage == LINKc)