mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-14 11:53:13 +01:00
Give compile units LinkOnceLinkage to circumvent duplicate symbols with LLVM linking.
This commit is contained in:
@@ -500,6 +500,12 @@ llvm::DICompileUnit DtoDwarfCompileUnit(Module* m)
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user