From 343003cfdce6111155031f22f31e53230f87660c Mon Sep 17 00:00:00 2001 From: Tomas Lindquist Olsen Date: Thu, 22 Jan 2009 17:26:50 +0100 Subject: [PATCH] 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 --- gen/tollvm.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gen/tollvm.cpp b/gen/tollvm.cpp index ecf40b4a..1f98e2c9 100644 --- a/gen/tollvm.cpp +++ b/gen/tollvm.cpp @@ -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)