Commit d9bbfe9d authored by Rui Ueyama's avatar Rui Ueyama
Browse files

Merging r308728:

------------------------------------------------------------------------
r308728 | ikudrin | 2017-07-21 04:26:08 -0700 (Fri, 21 Jul 2017) | 3 lines

[ELF] Avoid data race in ObjectFile<ELFT>::getDILineInfo().

Differential Revision: https://reviews.llvm.org/D35537
------------------------------------------------------------------------

llvm-svn: 308786
parent 0f8b85b5
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -91,8 +91,7 @@ template <class ELFT> void elf::ObjectFile<ELFT>::initializeDwarfLine() {
template <class ELFT>
Optional<DILineInfo> elf::ObjectFile<ELFT>::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);
+2 −0
Original line number Diff line number Diff line
@@ -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 <map>

@@ -211,6 +212,7 @@ private:
  // single object file, so we cache debugging information in order to
  // parse it only once for each object file we link.
  std::unique_ptr<llvm::DWARFDebugLine> DwarfLine;
  llvm::once_flag InitDwarfLine;
};

// LazyObjectFile is analogous to ArchiveFile in the sense that