xref: /freebsd/contrib/llvm-project/llvm/include/llvm/DWARFLinker/Classic/DWARFStreamer.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
11db9f3b2SDimitry Andric //===- DwarfStreamer.h ------------------------------------------*- C++ -*-===//
21db9f3b2SDimitry Andric //
31db9f3b2SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
41db9f3b2SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
51db9f3b2SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
61db9f3b2SDimitry Andric //
71db9f3b2SDimitry Andric //===----------------------------------------------------------------------===//
81db9f3b2SDimitry Andric 
91db9f3b2SDimitry Andric #ifndef LLVM_DWARFLINKER_CLASSIC_DWARFSTREAMER_H
101db9f3b2SDimitry Andric #define LLVM_DWARFLINKER_CLASSIC_DWARFSTREAMER_H
111db9f3b2SDimitry Andric 
121db9f3b2SDimitry Andric #include "DWARFLinker.h"
131db9f3b2SDimitry Andric #include "llvm/BinaryFormat/Swift.h"
141db9f3b2SDimitry Andric #include "llvm/CodeGen/AsmPrinter.h"
151db9f3b2SDimitry Andric #include "llvm/MC/MCAsmInfo.h"
161db9f3b2SDimitry Andric #include "llvm/MC/MCContext.h"
171db9f3b2SDimitry Andric #include "llvm/MC/MCInstrInfo.h"
181db9f3b2SDimitry Andric #include "llvm/MC/MCObjectFileInfo.h"
191db9f3b2SDimitry Andric #include "llvm/MC/MCRegisterInfo.h"
201db9f3b2SDimitry Andric #include "llvm/MC/MCSubtargetInfo.h"
211db9f3b2SDimitry Andric #include "llvm/Target/TargetMachine.h"
221db9f3b2SDimitry Andric 
231db9f3b2SDimitry Andric namespace llvm {
241db9f3b2SDimitry Andric template <typename DataT> class AccelTable;
251db9f3b2SDimitry Andric 
261db9f3b2SDimitry Andric class MCCodeEmitter;
271db9f3b2SDimitry Andric class DWARFDebugMacro;
281db9f3b2SDimitry Andric 
291db9f3b2SDimitry Andric namespace dwarf_linker {
301db9f3b2SDimitry Andric namespace classic {
311db9f3b2SDimitry Andric 
321db9f3b2SDimitry Andric ///   User of DwarfStreamer should call initialization code
331db9f3b2SDimitry Andric ///   for AsmPrinter:
341db9f3b2SDimitry Andric ///
351db9f3b2SDimitry Andric ///   InitializeAllTargetInfos();
361db9f3b2SDimitry Andric ///   InitializeAllTargetMCs();
371db9f3b2SDimitry Andric ///   InitializeAllTargets();
381db9f3b2SDimitry Andric ///   InitializeAllAsmPrinters();
391db9f3b2SDimitry Andric 
401db9f3b2SDimitry Andric /// The Dwarf streaming logic.
411db9f3b2SDimitry Andric ///
421db9f3b2SDimitry Andric /// All interactions with the MC layer that is used to build the debug
431db9f3b2SDimitry Andric /// information binary representation are handled in this class.
441db9f3b2SDimitry Andric class DwarfStreamer : public DwarfEmitter {
451db9f3b2SDimitry Andric public:
DwarfStreamer(DWARFLinkerBase::OutputFileType OutFileType,raw_pwrite_stream & OutFile,DWARFLinkerBase::MessageHandlerTy Warning)461db9f3b2SDimitry Andric   DwarfStreamer(DWARFLinkerBase::OutputFileType OutFileType,
471db9f3b2SDimitry Andric                 raw_pwrite_stream &OutFile,
481db9f3b2SDimitry Andric                 DWARFLinkerBase::MessageHandlerTy Warning)
49*0fca6ea1SDimitry Andric       : OutFile(OutFile), OutFileType(OutFileType), WarningHandler(Warning) {}
501db9f3b2SDimitry Andric   virtual ~DwarfStreamer() = default;
511db9f3b2SDimitry Andric 
527a6dacacSDimitry Andric   static Expected<std::unique_ptr<DwarfStreamer>> createStreamer(
537a6dacacSDimitry Andric       const Triple &TheTriple, DWARFLinkerBase::OutputFileType FileType,
54*0fca6ea1SDimitry Andric       raw_pwrite_stream &OutFile, DWARFLinkerBase::MessageHandlerTy Warning);
557a6dacacSDimitry Andric 
561db9f3b2SDimitry Andric   Error init(Triple TheTriple, StringRef Swift5ReflectionSegmentName);
571db9f3b2SDimitry Andric 
581db9f3b2SDimitry Andric   /// Dump the file to the disk.
591db9f3b2SDimitry Andric   void finish() override;
601db9f3b2SDimitry Andric 
getAsmPrinter()617a6dacacSDimitry Andric   AsmPrinter &getAsmPrinter() const { return *Asm; }
621db9f3b2SDimitry Andric 
631db9f3b2SDimitry Andric   /// Set the current output section to debug_info and change
641db9f3b2SDimitry Andric   /// the MC Dwarf version to \p DwarfVersion.
651db9f3b2SDimitry Andric   void switchToDebugInfoSection(unsigned DwarfVersion);
661db9f3b2SDimitry Andric 
671db9f3b2SDimitry Andric   /// Emit the compilation unit header for \p Unit in the
681db9f3b2SDimitry Andric   /// debug_info section.
691db9f3b2SDimitry Andric   ///
701db9f3b2SDimitry Andric   /// As a side effect, this also switches the current Dwarf version
711db9f3b2SDimitry Andric   /// of the MC layer to the one of U.getOrigUnit().
721db9f3b2SDimitry Andric   void emitCompileUnitHeader(CompileUnit &Unit, unsigned DwarfVersion) override;
731db9f3b2SDimitry Andric 
741db9f3b2SDimitry Andric   /// Recursively emit the DIE tree rooted at \p Die.
751db9f3b2SDimitry Andric   void emitDIE(DIE &Die) override;
761db9f3b2SDimitry Andric 
771db9f3b2SDimitry Andric   /// Emit the abbreviation table \p Abbrevs to the debug_abbrev section.
781db9f3b2SDimitry Andric   void emitAbbrevs(const std::vector<std::unique_ptr<DIEAbbrev>> &Abbrevs,
791db9f3b2SDimitry Andric                    unsigned DwarfVersion) override;
801db9f3b2SDimitry Andric 
811db9f3b2SDimitry Andric   /// Emit contents of section SecName From Obj.
827a6dacacSDimitry Andric   void emitSectionContents(StringRef SecData,
837a6dacacSDimitry Andric                            DebugSectionKind SecKind) override;
841db9f3b2SDimitry Andric 
851db9f3b2SDimitry Andric   /// Emit the string table described by \p Pool into .debug_str table.
861db9f3b2SDimitry Andric   void emitStrings(const NonRelocatableStringpool &Pool) override;
871db9f3b2SDimitry Andric 
881db9f3b2SDimitry Andric   /// Emit the debug string offset table described by \p StringOffsets into the
891db9f3b2SDimitry Andric   /// .debug_str_offsets table.
901db9f3b2SDimitry Andric   void emitStringOffsets(const SmallVector<uint64_t> &StringOffset,
911db9f3b2SDimitry Andric                          uint16_t TargetDWARFVersion) override;
921db9f3b2SDimitry Andric 
931db9f3b2SDimitry Andric   /// Emit the string table described by \p Pool into .debug_line_str table.
941db9f3b2SDimitry Andric   void emitLineStrings(const NonRelocatableStringpool &Pool) override;
951db9f3b2SDimitry Andric 
961db9f3b2SDimitry Andric   /// Emit the swift_ast section stored in \p Buffer.
977a6dacacSDimitry Andric   void emitSwiftAST(StringRef Buffer);
981db9f3b2SDimitry Andric 
991db9f3b2SDimitry Andric   /// Emit the swift reflection section stored in \p Buffer.
1001db9f3b2SDimitry Andric   void emitSwiftReflectionSection(
1011db9f3b2SDimitry Andric       llvm::binaryformat::Swift5ReflectionSectionKind ReflSectionKind,
1027a6dacacSDimitry Andric       StringRef Buffer, uint32_t Alignment, uint32_t Size);
1031db9f3b2SDimitry Andric 
1041db9f3b2SDimitry Andric   /// Emit debug ranges(.debug_ranges, .debug_rnglists) header.
1051db9f3b2SDimitry Andric   MCSymbol *emitDwarfDebugRangeListHeader(const CompileUnit &Unit) override;
1061db9f3b2SDimitry Andric 
1071db9f3b2SDimitry Andric   /// Emit debug ranges(.debug_ranges, .debug_rnglists) fragment.
1081db9f3b2SDimitry Andric   void emitDwarfDebugRangeListFragment(const CompileUnit &Unit,
1091db9f3b2SDimitry Andric                                        const AddressRanges &LinkedRanges,
1101db9f3b2SDimitry Andric                                        PatchLocation Patch,
1111db9f3b2SDimitry Andric                                        DebugDieValuePool &AddrPool) override;
1121db9f3b2SDimitry Andric 
1131db9f3b2SDimitry Andric   /// Emit debug ranges(.debug_ranges, .debug_rnglists) footer.
1141db9f3b2SDimitry Andric   void emitDwarfDebugRangeListFooter(const CompileUnit &Unit,
1151db9f3b2SDimitry Andric                                      MCSymbol *EndLabel) override;
1161db9f3b2SDimitry Andric 
1171db9f3b2SDimitry Andric   /// Emit debug locations(.debug_loc, .debug_loclists) header.
1181db9f3b2SDimitry Andric   MCSymbol *emitDwarfDebugLocListHeader(const CompileUnit &Unit) override;
1191db9f3b2SDimitry Andric 
1201db9f3b2SDimitry Andric   /// Emit .debug_addr header.
1211db9f3b2SDimitry Andric   MCSymbol *emitDwarfDebugAddrsHeader(const CompileUnit &Unit) override;
1221db9f3b2SDimitry Andric 
1231db9f3b2SDimitry Andric   /// Emit the addresses described by \p Addrs into .debug_addr table.
1241db9f3b2SDimitry Andric   void emitDwarfDebugAddrs(const SmallVector<uint64_t> &Addrs,
1251db9f3b2SDimitry Andric                            uint8_t AddrSize) override;
1261db9f3b2SDimitry Andric 
1271db9f3b2SDimitry Andric   /// Emit .debug_addr footer.
1281db9f3b2SDimitry Andric   void emitDwarfDebugAddrsFooter(const CompileUnit &Unit,
1291db9f3b2SDimitry Andric                                  MCSymbol *EndLabel) override;
1301db9f3b2SDimitry Andric 
1311db9f3b2SDimitry Andric   /// Emit debug ranges(.debug_loc, .debug_loclists) fragment.
1321db9f3b2SDimitry Andric   void emitDwarfDebugLocListFragment(
1331db9f3b2SDimitry Andric       const CompileUnit &Unit,
1341db9f3b2SDimitry Andric       const DWARFLocationExpressionsVector &LinkedLocationExpression,
1351db9f3b2SDimitry Andric       PatchLocation Patch, DebugDieValuePool &AddrPool) override;
1361db9f3b2SDimitry Andric 
1371db9f3b2SDimitry Andric   /// Emit debug ranges(.debug_loc, .debug_loclists) footer.
1381db9f3b2SDimitry Andric   void emitDwarfDebugLocListFooter(const CompileUnit &Unit,
1391db9f3b2SDimitry Andric                                    MCSymbol *EndLabel) override;
1401db9f3b2SDimitry Andric 
1411db9f3b2SDimitry Andric   /// Emit .debug_aranges entries for \p Unit
1421db9f3b2SDimitry Andric   void emitDwarfDebugArangesTable(const CompileUnit &Unit,
1431db9f3b2SDimitry Andric                                   const AddressRanges &LinkedRanges) override;
1441db9f3b2SDimitry Andric 
getRangesSectionSize()1451db9f3b2SDimitry Andric   uint64_t getRangesSectionSize() const override { return RangesSectionSize; }
1461db9f3b2SDimitry Andric 
getRngListsSectionSize()1471db9f3b2SDimitry Andric   uint64_t getRngListsSectionSize() const override {
1481db9f3b2SDimitry Andric     return RngListsSectionSize;
1491db9f3b2SDimitry Andric   }
1501db9f3b2SDimitry Andric 
1511db9f3b2SDimitry Andric   /// Emit .debug_line table entry for specified \p LineTable
1521db9f3b2SDimitry Andric   void emitLineTableForUnit(const DWARFDebugLine::LineTable &LineTable,
1531db9f3b2SDimitry Andric                             const CompileUnit &Unit,
1541db9f3b2SDimitry Andric                             OffsetsStringPool &DebugStrPool,
1551db9f3b2SDimitry Andric                             OffsetsStringPool &DebugLineStrPool) override;
1561db9f3b2SDimitry Andric 
getLineSectionSize()1571db9f3b2SDimitry Andric   uint64_t getLineSectionSize() const override { return LineSectionSize; }
1581db9f3b2SDimitry Andric 
1591db9f3b2SDimitry Andric   /// Emit the .debug_pubnames contribution for \p Unit.
1601db9f3b2SDimitry Andric   void emitPubNamesForUnit(const CompileUnit &Unit) override;
1611db9f3b2SDimitry Andric 
1621db9f3b2SDimitry Andric   /// Emit the .debug_pubtypes contribution for \p Unit.
1631db9f3b2SDimitry Andric   void emitPubTypesForUnit(const CompileUnit &Unit) override;
1641db9f3b2SDimitry Andric 
1651db9f3b2SDimitry Andric   /// Emit a CIE.
1661db9f3b2SDimitry Andric   void emitCIE(StringRef CIEBytes) override;
1671db9f3b2SDimitry Andric 
1681db9f3b2SDimitry Andric   /// Emit an FDE with data \p Bytes.
1691db9f3b2SDimitry Andric   void emitFDE(uint32_t CIEOffset, uint32_t AddreSize, uint64_t Address,
1701db9f3b2SDimitry Andric                StringRef Bytes) override;
1711db9f3b2SDimitry Andric 
1721db9f3b2SDimitry Andric   /// Emit DWARF debug names.
1731db9f3b2SDimitry Andric   void emitDebugNames(DWARF5AccelTable &Table) override;
1741db9f3b2SDimitry Andric 
1751db9f3b2SDimitry Andric   /// Emit Apple namespaces accelerator table.
1761db9f3b2SDimitry Andric   void emitAppleNamespaces(
1771db9f3b2SDimitry Andric       AccelTable<AppleAccelTableStaticOffsetData> &Table) override;
1781db9f3b2SDimitry Andric 
1791db9f3b2SDimitry Andric   /// Emit Apple names accelerator table.
1801db9f3b2SDimitry Andric   void
1811db9f3b2SDimitry Andric   emitAppleNames(AccelTable<AppleAccelTableStaticOffsetData> &Table) override;
1821db9f3b2SDimitry Andric 
1831db9f3b2SDimitry Andric   /// Emit Apple Objective-C accelerator table.
1841db9f3b2SDimitry Andric   void
1851db9f3b2SDimitry Andric   emitAppleObjc(AccelTable<AppleAccelTableStaticOffsetData> &Table) override;
1861db9f3b2SDimitry Andric 
1871db9f3b2SDimitry Andric   /// Emit Apple type accelerator table.
1881db9f3b2SDimitry Andric   void
1891db9f3b2SDimitry Andric   emitAppleTypes(AccelTable<AppleAccelTableStaticTypeData> &Table) override;
1901db9f3b2SDimitry Andric 
getFrameSectionSize()1911db9f3b2SDimitry Andric   uint64_t getFrameSectionSize() const override { return FrameSectionSize; }
1921db9f3b2SDimitry Andric 
getDebugInfoSectionSize()1931db9f3b2SDimitry Andric   uint64_t getDebugInfoSectionSize() const override {
1941db9f3b2SDimitry Andric     return DebugInfoSectionSize;
1951db9f3b2SDimitry Andric   }
1961db9f3b2SDimitry Andric 
getDebugMacInfoSectionSize()1971db9f3b2SDimitry Andric   uint64_t getDebugMacInfoSectionSize() const override {
1981db9f3b2SDimitry Andric     return MacInfoSectionSize;
1991db9f3b2SDimitry Andric   }
2001db9f3b2SDimitry Andric 
getDebugMacroSectionSize()2011db9f3b2SDimitry Andric   uint64_t getDebugMacroSectionSize() const override {
2021db9f3b2SDimitry Andric     return MacroSectionSize;
2031db9f3b2SDimitry Andric   }
2041db9f3b2SDimitry Andric 
getLocListsSectionSize()2051db9f3b2SDimitry Andric   uint64_t getLocListsSectionSize() const override {
2061db9f3b2SDimitry Andric     return LocListsSectionSize;
2071db9f3b2SDimitry Andric   }
2081db9f3b2SDimitry Andric 
getDebugAddrSectionSize()2091db9f3b2SDimitry Andric   uint64_t getDebugAddrSectionSize() const override { return AddrSectionSize; }
2101db9f3b2SDimitry Andric 
2111db9f3b2SDimitry Andric   void emitMacroTables(DWARFContext *Context,
2121db9f3b2SDimitry Andric                        const Offset2UnitMap &UnitMacroMap,
2131db9f3b2SDimitry Andric                        OffsetsStringPool &StringPool) override;
2141db9f3b2SDimitry Andric 
2151db9f3b2SDimitry Andric private:
2161db9f3b2SDimitry Andric   inline void warn(const Twine &Warning, StringRef Context = "") {
2171db9f3b2SDimitry Andric     if (WarningHandler)
2181db9f3b2SDimitry Andric       WarningHandler(Warning, Context, nullptr);
2191db9f3b2SDimitry Andric   }
2201db9f3b2SDimitry Andric 
2217a6dacacSDimitry Andric   MCSection *getMCSection(DebugSectionKind SecKind);
2227a6dacacSDimitry Andric 
2231db9f3b2SDimitry Andric   void emitMacroTableImpl(const DWARFDebugMacro *MacroTable,
2241db9f3b2SDimitry Andric                           const Offset2UnitMap &UnitMacroMap,
2251db9f3b2SDimitry Andric                           OffsetsStringPool &StringPool, uint64_t &OutOffset);
2261db9f3b2SDimitry Andric 
2271db9f3b2SDimitry Andric   /// Emit piece of .debug_ranges for \p LinkedRanges.
2281db9f3b2SDimitry Andric   void emitDwarfDebugRangesTableFragment(const CompileUnit &Unit,
2291db9f3b2SDimitry Andric                                          const AddressRanges &LinkedRanges,
2301db9f3b2SDimitry Andric                                          PatchLocation Patch);
2311db9f3b2SDimitry Andric 
2321db9f3b2SDimitry Andric   /// Emit piece of .debug_rnglists for \p LinkedRanges.
2331db9f3b2SDimitry Andric   void emitDwarfDebugRngListsTableFragment(const CompileUnit &Unit,
2341db9f3b2SDimitry Andric                                            const AddressRanges &LinkedRanges,
2351db9f3b2SDimitry Andric                                            PatchLocation Patch,
2361db9f3b2SDimitry Andric                                            DebugDieValuePool &AddrPool);
2371db9f3b2SDimitry Andric 
2381db9f3b2SDimitry Andric   /// Emit piece of .debug_loc for \p LinkedRanges.
2391db9f3b2SDimitry Andric   void emitDwarfDebugLocTableFragment(
2401db9f3b2SDimitry Andric       const CompileUnit &Unit,
2411db9f3b2SDimitry Andric       const DWARFLocationExpressionsVector &LinkedLocationExpression,
2421db9f3b2SDimitry Andric       PatchLocation Patch);
2431db9f3b2SDimitry Andric 
2441db9f3b2SDimitry Andric   /// Emit piece of .debug_loclists for \p LinkedRanges.
2451db9f3b2SDimitry Andric   void emitDwarfDebugLocListsTableFragment(
2461db9f3b2SDimitry Andric       const CompileUnit &Unit,
2471db9f3b2SDimitry Andric       const DWARFLocationExpressionsVector &LinkedLocationExpression,
2481db9f3b2SDimitry Andric       PatchLocation Patch, DebugDieValuePool &AddrPool);
2491db9f3b2SDimitry Andric 
2501db9f3b2SDimitry Andric   /// \defgroup Line table emission
2511db9f3b2SDimitry Andric   /// @{
2521db9f3b2SDimitry Andric   void emitLineTablePrologue(const DWARFDebugLine::Prologue &P,
2531db9f3b2SDimitry Andric                              OffsetsStringPool &DebugStrPool,
2541db9f3b2SDimitry Andric                              OffsetsStringPool &DebugLineStrPool);
2551db9f3b2SDimitry Andric   void emitLineTableString(const DWARFDebugLine::Prologue &P,
2561db9f3b2SDimitry Andric                            const DWARFFormValue &String,
2571db9f3b2SDimitry Andric                            OffsetsStringPool &DebugStrPool,
2581db9f3b2SDimitry Andric                            OffsetsStringPool &DebugLineStrPool);
2591db9f3b2SDimitry Andric   void emitLineTableProloguePayload(const DWARFDebugLine::Prologue &P,
2601db9f3b2SDimitry Andric                                     OffsetsStringPool &DebugStrPool,
2611db9f3b2SDimitry Andric                                     OffsetsStringPool &DebugLineStrPool);
2621db9f3b2SDimitry Andric   void emitLineTablePrologueV2IncludeAndFileTable(
2631db9f3b2SDimitry Andric       const DWARFDebugLine::Prologue &P, OffsetsStringPool &DebugStrPool,
2641db9f3b2SDimitry Andric       OffsetsStringPool &DebugLineStrPool);
2651db9f3b2SDimitry Andric   void emitLineTablePrologueV5IncludeAndFileTable(
2661db9f3b2SDimitry Andric       const DWARFDebugLine::Prologue &P, OffsetsStringPool &DebugStrPool,
2671db9f3b2SDimitry Andric       OffsetsStringPool &DebugLineStrPool);
2681db9f3b2SDimitry Andric   void emitLineTableRows(const DWARFDebugLine::LineTable &LineTable,
2691db9f3b2SDimitry Andric                          MCSymbol *LineEndSym, unsigned AddressByteSize);
2701db9f3b2SDimitry Andric   void emitIntOffset(uint64_t Offset, dwarf::DwarfFormat Format,
2711db9f3b2SDimitry Andric                      uint64_t &SectionSize);
2721db9f3b2SDimitry Andric   void emitLabelDifference(const MCSymbol *Hi, const MCSymbol *Lo,
2731db9f3b2SDimitry Andric                            dwarf::DwarfFormat Format, uint64_t &SectionSize);
2741db9f3b2SDimitry Andric   /// @}
2751db9f3b2SDimitry Andric 
2761db9f3b2SDimitry Andric   /// \defgroup MCObjects MC layer objects constructed by the streamer
2771db9f3b2SDimitry Andric   /// @{
2781db9f3b2SDimitry Andric   std::unique_ptr<MCRegisterInfo> MRI;
2791db9f3b2SDimitry Andric   std::unique_ptr<MCAsmInfo> MAI;
2801db9f3b2SDimitry Andric   std::unique_ptr<MCObjectFileInfo> MOFI;
2811db9f3b2SDimitry Andric   std::unique_ptr<MCContext> MC;
2821db9f3b2SDimitry Andric   MCAsmBackend *MAB; // Owned by MCStreamer
2831db9f3b2SDimitry Andric   std::unique_ptr<MCInstrInfo> MII;
2841db9f3b2SDimitry Andric   std::unique_ptr<MCSubtargetInfo> MSTI;
2851db9f3b2SDimitry Andric   MCInstPrinter *MIP; // Owned by AsmPrinter
2861db9f3b2SDimitry Andric   MCCodeEmitter *MCE; // Owned by MCStreamer
2871db9f3b2SDimitry Andric   MCStreamer *MS;     // Owned by AsmPrinter
2881db9f3b2SDimitry Andric   std::unique_ptr<TargetMachine> TM;
2891db9f3b2SDimitry Andric   std::unique_ptr<AsmPrinter> Asm;
2901db9f3b2SDimitry Andric   /// @}
2911db9f3b2SDimitry Andric 
2921db9f3b2SDimitry Andric   /// The output file we stream the linked Dwarf to.
2931db9f3b2SDimitry Andric   raw_pwrite_stream &OutFile;
2941db9f3b2SDimitry Andric   DWARFLinker::OutputFileType OutFileType = DWARFLinker::OutputFileType::Object;
2951db9f3b2SDimitry Andric 
2961db9f3b2SDimitry Andric   uint64_t RangesSectionSize = 0;
2971db9f3b2SDimitry Andric   uint64_t RngListsSectionSize = 0;
2981db9f3b2SDimitry Andric   uint64_t LocSectionSize = 0;
2991db9f3b2SDimitry Andric   uint64_t LocListsSectionSize = 0;
3001db9f3b2SDimitry Andric   uint64_t LineSectionSize = 0;
3011db9f3b2SDimitry Andric   uint64_t FrameSectionSize = 0;
3021db9f3b2SDimitry Andric   uint64_t DebugInfoSectionSize = 0;
3031db9f3b2SDimitry Andric   uint64_t MacInfoSectionSize = 0;
3041db9f3b2SDimitry Andric   uint64_t MacroSectionSize = 0;
3051db9f3b2SDimitry Andric   uint64_t AddrSectionSize = 0;
3061db9f3b2SDimitry Andric   uint64_t StrOffsetSectionSize = 0;
3071db9f3b2SDimitry Andric 
3081db9f3b2SDimitry Andric   /// Keep track of emitted CUs and their Unique ID.
3091db9f3b2SDimitry Andric   struct EmittedUnit {
3101db9f3b2SDimitry Andric     unsigned ID;
3111db9f3b2SDimitry Andric     MCSymbol *LabelBegin;
3121db9f3b2SDimitry Andric   };
3131db9f3b2SDimitry Andric   std::vector<EmittedUnit> EmittedUnits;
3141db9f3b2SDimitry Andric 
3151db9f3b2SDimitry Andric   /// Emit the pubnames or pubtypes section contribution for \p
3161db9f3b2SDimitry Andric   /// Unit into \p Sec. The data is provided in \p Names.
3171db9f3b2SDimitry Andric   void emitPubSectionForUnit(MCSection *Sec, StringRef Name,
3181db9f3b2SDimitry Andric                              const CompileUnit &Unit,
3191db9f3b2SDimitry Andric                              const std::vector<CompileUnit::AccelInfo> &Names);
3201db9f3b2SDimitry Andric 
3211db9f3b2SDimitry Andric   DWARFLinkerBase::MessageHandlerTy WarningHandler = nullptr;
3221db9f3b2SDimitry Andric };
3231db9f3b2SDimitry Andric 
3241db9f3b2SDimitry Andric } // end of namespace classic
3251db9f3b2SDimitry Andric } // end of namespace dwarf_linker
3261db9f3b2SDimitry Andric } // end of namespace llvm
3271db9f3b2SDimitry Andric 
3281db9f3b2SDimitry Andric #endif // LLVM_DWARFLINKER_CLASSIC_DWARFSTREAMER_H
329