diff --git a/gen/llvmhelpers.cpp b/gen/llvmhelpers.cpp index c9cba28e..749a0a55 100644 --- a/gen/llvmhelpers.cpp +++ b/gen/llvmhelpers.cpp @@ -1371,6 +1371,11 @@ bool mustDefineSymbol(Dsymbol* s) { if (fd->isArrayOp) return true; + + // we can't (and probably shouldn't?) define functions + // that weren't semantic3'ed + if (fd->semanticRun < 4) + return false; } TemplateInstance* tinst = DtoIsTemplateInstance(s); diff --git a/gen/main.cpp b/gen/main.cpp index dea29e56..deb0bb7b 100644 --- a/gen/main.cpp +++ b/gen/main.cpp @@ -811,7 +811,6 @@ int main(int argc, char** argv) */ if (!global.params.useArrayBounds && !global.params.useAssert) { -#endif // Do pass 3 semantic analysis on all imported modules, // since otherwise functions in them cannot be inlined for (int i = 0; i < Module::amodules.dim; i++) @@ -823,7 +822,6 @@ int main(int argc, char** argv) } if (global.errors) fatal(); -#if !IN_LLVM } for (int i = 0; i < modules.dim; i++) @@ -834,9 +832,9 @@ int main(int argc, char** argv) m->inlineScan(); } } -#endif if (global.errors) fatal(); +#endif // write module dependencies to file if requested if (global.params.moduleDepsFile != NULL) diff --git a/ir/irclass.cpp b/ir/irclass.cpp index 8754744e..b85972c8 100644 --- a/ir/irclass.cpp +++ b/ir/irclass.cpp @@ -120,7 +120,9 @@ LLGlobalVariable * IrStruct::getInterfaceArraySymbol() std::string name("_D"); name.append(cd->mangle()); name.append("16__interfaceInfosZ"); - classInterfacesArray = new llvm::GlobalVariable(array_type, true, DtoLinkage(cd), NULL, name, classInfo); + + llvm::GlobalValue::LinkageTypes _linkage = DtoExternalLinkage(aggrdecl); + classInterfacesArray = new llvm::GlobalVariable(array_type, true, _linkage, NULL, name, classInfo); return classInterfacesArray; }