From be185263baf841d97a8eb440018e6c93a7db9f40 Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Thu, 26 Dec 2013 13:24:41 +0100 Subject: [PATCH] Disable internalizing of nested functions. This works around linking problems such as rejectedsoftware/vibe.d#338, caused by the frontend appending template instances to the wrong module. GitHub: Fixes #558. --- gen/tollvm.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gen/tollvm.cpp b/gen/tollvm.cpp index 10241e71..c3a7d31b 100644 --- a/gen/tollvm.cpp +++ b/gen/tollvm.cpp @@ -382,6 +382,10 @@ LLGlobalValue::LinkageTypes DtoLinkage(Dsymbol* sym) llvm_unreachable("not global/function"); } + // The logic here should be sound in theory, but as long as the frontend + // keeps inserting templates into wrong modules, this yields to linking + // errors (see e.g. GitHub issue #558). +#if 0 // Check if sym is a nested function and we can declare it as internal. // // Nested naked functions and the implicitly generated __require/__ensure @@ -427,7 +431,7 @@ LLGlobalValue::LinkageTypes DtoLinkage(Dsymbol* sym) } } } - +#endif // default to external linkage return llvm::GlobalValue::ExternalLinkage; }