diff --git a/llvm/include/llvm/DWARFLinker/DWARFLinker.h b/llvm/include/llvm/DWARFLinker/DWARFLinker.h --- a/llvm/include/llvm/DWARFLinker/DWARFLinker.h +++ b/llvm/include/llvm/DWARFLinker/DWARFLinker.h @@ -96,7 +96,7 @@ virtual ~DwarfEmitter(); /// Emit DIE containing warnings. - virtual void emitPaperTrailWarningsDie(const Triple &Triple, DIE &Die) = 0; + virtual void emitPaperTrailWarningsDie(DIE &Die, bool IsArch64Bit) = 0; /// Emit section named SecName with content equals to /// corresponding section in Obj. @@ -243,9 +243,9 @@ /// processing a object file. class DWARFLinker { public: - DWARFLinker(const Triple &Triple, DwarfEmitter *Emitter, + DWARFLinker(bool IsArch64Bit, DwarfEmitter *Emitter, DwarfLinkerClient ClientID = DwarfLinkerClient::General) - : TheTriple(Triple), TheDwarfEmitter(Emitter), + : TheDwarfEmitter(Emitter), IsArch64Bit(IsArch64Bit), DwarfLinkerClientID(ClientID) {} /// Add object file to be linked. @@ -718,8 +718,6 @@ BumpPtrAllocator DIEAlloc; /// @} - Triple TheTriple; - DwarfEmitter *TheDwarfEmitter; std::vector ObjectContexts; @@ -729,6 +727,8 @@ bool AtLeastOneAppleAccelTable = false; bool AtLeastOneDwarfAccelTable = false; + bool IsArch64Bit; + /// The CIEs that have been emitted in the output section. The actual CIE /// data serves a the key to this StringMap, this takes care of comparing the /// semantics of CIEs defined in different object files. diff --git a/llvm/lib/DWARFLinker/DWARFLinker.cpp b/llvm/lib/DWARFLinker/DWARFLinker.cpp --- a/llvm/lib/DWARFLinker/DWARFLinker.cpp +++ b/llvm/lib/DWARFLinker/DWARFLinker.cpp @@ -2165,7 +2165,7 @@ Size += getULEB128Size(Abbrev.getNumber()); } CUDie->setSize(Size); - TheDwarfEmitter->emitPaperTrailWarningsDie(TheTriple, *CUDie); + TheDwarfEmitter->emitPaperTrailWarningsDie(*CUDie, IsArch64Bit); return true; } diff --git a/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp b/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp --- a/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp +++ b/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp @@ -287,7 +287,7 @@ DebugMap DebugMap(Map.getTriple(), Map.getBinaryPath()); - DWARFLinker GeneralLinker(Map.getTriple(), Streamer.get(), + DWARFLinker GeneralLinker(Map.getTriple().isArch64Bit(), Streamer.get(), DwarfLinkerClient::Dsymutil); remarks::RemarkLinker RL; diff --git a/llvm/tools/dsymutil/DwarfStreamer.h b/llvm/tools/dsymutil/DwarfStreamer.h --- a/llvm/tools/dsymutil/DwarfStreamer.h +++ b/llvm/tools/dsymutil/DwarfStreamer.h @@ -73,7 +73,7 @@ unsigned DwarfVersion) override; /// Emit DIE containing warnings. - void emitPaperTrailWarningsDie(const Triple &Triple, DIE &Die) override; + void emitPaperTrailWarningsDie(DIE &Die, bool IsArch64Bit) override; /// Emit contents of section SecName From Obj. void emitSectionContents(const object::ObjectFile &Obj, diff --git a/llvm/tools/dsymutil/DwarfStreamer.cpp b/llvm/tools/dsymutil/DwarfStreamer.cpp --- a/llvm/tools/dsymutil/DwarfStreamer.cpp +++ b/llvm/tools/dsymutil/DwarfStreamer.cpp @@ -220,13 +220,13 @@ } /// Emit DIE containing warnings. -void DwarfStreamer::emitPaperTrailWarningsDie(const Triple &Triple, DIE &Die) { +void DwarfStreamer::emitPaperTrailWarningsDie(DIE &Die, bool IsArch64Bit) { switchToDebugInfoSection(/* Version */ 2); auto &Asm = getAsmPrinter(); Asm.emitInt32(11 + Die.getSize() - 4); Asm.emitInt16(2); Asm.emitInt32(0); - Asm.emitInt8(Triple.isArch64Bit() ? 8 : 4); + Asm.emitInt8(IsArch64Bit ? 8 : 4); DebugInfoSectionSize += 11; emitDIE(Die); }