Index: lld/trunk/ELF/InputFiles.h =================================================================== --- lld/trunk/ELF/InputFiles.h +++ lld/trunk/ELF/InputFiles.h @@ -24,6 +24,7 @@ #include "llvm/Object/Archive.h" #include "llvm/Object/ELF.h" #include "llvm/Object/IRObjectFile.h" +#include "llvm/Support/Threading.h" #include @@ -212,6 +213,7 @@ // single object file, so we cache debugging information in order to // parse it only once for each object file we link. std::unique_ptr DwarfLine; + llvm::once_flag InitDwarfLine; }; // LazyObjectFile is analogous to ArchiveFile in the sense that Index: lld/trunk/ELF/InputFiles.cpp =================================================================== --- lld/trunk/ELF/InputFiles.cpp +++ lld/trunk/ELF/InputFiles.cpp @@ -80,8 +80,7 @@ template Optional elf::ObjectFile::getDILineInfo(InputSectionBase *S, uint64_t Offset) { - if (!DwarfLine) - initializeDwarfLine(); + llvm::call_once(InitDwarfLine, [this]() { initializeDwarfLine(); }); // The offset to CU is 0. const DWARFDebugLine::LineTable *Tbl = DwarfLine->getLineTable(0);