# HG changeset patch # User Tomas Lindquist Olsen # Date 1232641610 -3600 # Node ID fcab41e144c9c36405d8539eee94e9fd9b83d996 # Parent fb4853c469177058e324463538fe0980a6617ffb 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 diff -r fb4853c46917 -r fcab41e144c9 gen/tollvm.cpp --- a/gen/tollvm.cpp Mon Jan 19 19:42:00 2009 +0100 +++ b/gen/tollvm.cpp Thu Jan 22 17:26:50 2009 +0100 @@ -294,7 +294,8 @@ 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)