# HG changeset patch # User Christian Kamm # Date 1236525671 -3600 # Node ID 186d44690036bcfb9f64dc43066926c5df9c6d00 # Parent 7f0e5ae75fcc741338a7586bcd572102989f8ca7 Give compile units LinkOnceLinkage to circumvent duplicate symbols with LLVM linking. diff -r 7f0e5ae75fcc -r 186d44690036 gen/todebug.cpp --- a/gen/todebug.cpp Sun Mar 08 04:23:44 2009 +0100 +++ b/gen/todebug.cpp Sun Mar 08 16:21:11 2009 +0100 @@ -500,6 +500,12 @@ false, // isMain, false // isOptimized ); + + // if the linkage stays internal, we can't llvm-link the generated modules together: + // llvm's DwarfWriter uses path and filename to determine the symbol name and we'd + // end up with duplicate symbols + m->ir.irModule->diCompileUnit.getGV()->setLinkage(llvm::GlobalValue::LinkOnceLinkage); + m->ir.irModule->diCompileUnit.getGV()->setName(std::string("llvm.dbg.compile_unit_") + srcpath + m->srcfile->name->toChars()); return m->ir.irModule->diCompileUnit; }