diff gen/todebug.cpp @ 1068:7db4bb9602ed

Automated merge with http://hg.dsource.org/projects/ldc
author Christian Kamm <kamm incasoftware de>
date Sun, 08 Mar 2009 16:22:06 +0100
parents f0b6549055ab 186d44690036
children 8038b106c458
line wrap: on
line diff
--- a/gen/todebug.cpp	Sun Mar 08 16:13:10 2009 +0100
+++ b/gen/todebug.cpp	Sun Mar 08 16:22:06 2009 +0100
@@ -503,6 +503,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;
 }