changeset 896:fcab41e144c9

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
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Thu, 22 Jan 2009 17:26:50 +0100
parents fb4853c46917
children c6f16c3f377b
files gen/tollvm.cpp
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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)