1//===-- llvm-dwp.cpp - Split DWARF merging tool for llvm ------------------===// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7//===----------------------------------------------------------------------===// 9// A utility for merging DWARF 5 Split DWARF .dwo files into .dwp (DWARF 12//===----------------------------------------------------------------------===// 30// Returns the size of debug_str_offsets section headers in bytes. 34return 0;
// There is no header before dwarf 5. 38return 16;
// unit length: 12 bytes, version: 2 bytes, padding: 2 bytes. 39return 8;
// unit length: 4 bytes, version: 2 bytes, padding: 2 bytes. 60if (Form == dwarf::DW_FORM_string)
61return InfoData.
getCStr(&InfoOffset);
64case dwarf::DW_FORM_strx1:
65 StrIndex = InfoData.
getU8(&InfoOffset);
67case dwarf::DW_FORM_strx2:
68 StrIndex = InfoData.
getU16(&InfoOffset);
70case dwarf::DW_FORM_strx3:
71 StrIndex = InfoData.
getU24(&InfoOffset);
73case dwarf::DW_FORM_strx4:
74 StrIndex = InfoData.
getU32(&InfoOffset);
76case dwarf::DW_FORM_strx:
77case dwarf::DW_FORM_GNU_str_index:
81return make_error<DWPError>(
82"string field must be encoded with one of the following: " 83"DW_FORM_string, DW_FORM_strx, DW_FORM_strx1, DW_FORM_strx2, " 84"DW_FORM_strx3, DW_FORM_strx4, or DW_FORM_GNU_str_index.");
87uint64_t StrOffsetsOffset = 4 * StrIndex;
92return StrData.
getCStr(&StrOffset);
100if (Header.Version >= 5 && Header.UnitType != dwarf::DW_UT_split_compile)
101return make_error<DWPError>(
102 std::string(
"unit type DW_UT_split_compile type not found in " 103"debug_info header. Unexpected unit type 0x" +
104 utostr(Header.UnitType) +
" found"));
112if (Tag != dwarf::DW_TAG_compile_unit)
113return make_error<DWPError>(
"top level DIE is not a compile unit");
115 AbbrevData.
getU8(&AbbrevOffset);
121 (
Name != 0 || Form != 0)) {
123case dwarf::DW_AT_name: {
125 Form, InfoData,
Offset, StrOffsets, Str, Header.Version);
131case dwarf::DW_AT_GNU_dwo_name:
132case dwarf::DW_AT_dwo_name: {
134 Form, InfoData,
Offset, StrOffsets, Str, Header.Version);
140case dwarf::DW_AT_GNU_dwo_id:
149if (!Header.Signature)
150return make_error<DWPError>(
"compile unit missing dwo_id");
151ID.Signature = *Header.Signature;
160// Convert an internal section identifier into the index to use with 161// UnitIndexEntry::Contributions. 168// Convert a UnitIndexEntry::Contributions index to the corresponding on-disk 169// value of the section identifier. 171return Index + DW_SECT_INFO;
177constauto *Off = Entry.getContribution(
Kind);
180return Section.substr(Off->getOffset(), Off->getLength());
187bool &AnySectionOverflow) {
190Twine(
" Section Contribution Offset overflow 4G. Previous Offset ") +
191Twine(PrevOffset) +
Twine(
", After overflow offset ") +
194if (OverflowOptValue == OnCuIndexOverflow::Continue) {
197 }
elseif (OverflowOptValue == OnCuIndexOverflow::SoftStop) {
198 AnySectionOverflow =
true;
202return make_error<DWPError>(Msg);
210bool &AnySectionOverflow) {
213auto *
I = E.getContributions();
216autoP = TypeIndexEntries.
insert(std::make_pair(E.getSignature(), TUEntry));
219auto &Entry =
P.first->second;
220// Zero out the debug_info contribution 221 Entry.Contributions[0] = {};
227C.setOffset(
C.getOffset() +
I->getOffset());
228C.setLength(
I->getLength());
231auto &
C = Entry.Contributions[TypesContributionIndex];
236C.setOffset(TypesOffset);
238static_assert(
sizeof(OldOffset) ==
sizeof(TypesOffset));
239 TypesOffset +=
C.getLength();
240if (OldOffset > TypesOffset) {
242"Types", OverflowOptValue,
245if (AnySectionOverflow) {
246 TypesOffset = OldOffset;
256MCSection *OutputTypes,
const std::vector<StringRef> &TypesSections,
263while (Data.isValidOffset(
Offset)) {
265// Zero out the debug_info contribution 266 Entry.Contributions[0] = {};
268C.setOffset(TypesOffset);
270// Length of the unit, including the 4 byte length field. 271C.setLength(Data.getU32(&
Offset) + 4);
273 Data.getU16(&
Offset);
// Version 274 Data.getU32(&
Offset);
// Abbrev offset 275 Data.getU8(&
Offset);
// Address size 276auto Signature = Data.getU64(&
Offset);
277Offset = PrevOffset +
C.getLength32();
279autoP = TypeIndexEntries.
insert(std::make_pair(Signature, Entry));
283 Out.
emitBytes(Types.substr(PrevOffset,
C.getLength32()));
285 TypesOffset +=
C.getLength32();
286if (OldOffset > TypesOffset) {
288"Types", OverflowOptValue,
291if (AnySectionOverflow) {
292 TypesOffset = OldOffset;
303 std::string Text =
"\'";
306bool HasDWO = !DWOName.
empty();
307bool HasDWP = !DWPName.
empty();
308if (HasDWO || HasDWP) {
317if (!DWPName.
empty()) {
328return make_error<DWPError>(
329 (
"failure while decompressing compressed section: '" +
Name +
"', " +
337auto *Obj = dyn_cast<ELFObjectFileBase>(Sec.
getObject());
341bool IsLE = isa<object::ELF32LEObjectFile>(Obj) ||
342 isa<object::ELF64LEObjectFile>(Obj);
343bool Is64 = isa<object::ELF64LEObjectFile>(Obj) ||
344 isa<object::ELF64BEObjectFile>(Obj);
349 UncompressedSections.emplace_back();
350if (
Error E = Dec->resizeAndDecompress(UncompressedSections.back()))
353 Contents = UncompressedSections.
back();
358// Parse and return the header of an info section compile/type unit. 364 std::tie(Header.Length, Header.Format) =
367return make_error<DWPError>(
"cannot parse compile unit length: " +
371return make_error<DWPError>(
372"compile unit exceeds .debug_info section range: " +
373 utostr(
Offset + Header.Length) +
" >= " + utostr(InfoData.
size()));
378return make_error<DWPError>(
"cannot parse compile unit version: " +
382if (Header.Version >= 5) {
383// Size: Version (2), UnitType (1), AddrSize (1), DebugAbbrevOffset (4), 385 MinHeaderLength = 16;
387// Size: Version (2), DebugAbbrevOffset (4), AddrSize (1) 390if (Header.Length < MinHeaderLength) {
391return make_error<DWPError>(
"unit length is too small: expected at least " +
392 utostr(MinHeaderLength) +
" got " +
393 utostr(Header.Length) +
".");
395if (Header.Version >= 5) {
400if (Header.UnitType == dwarf::DW_UT_split_type) {
402 MinHeaderLength += 4;
403if (Header.Length < MinHeaderLength)
404return make_error<DWPError>(
"type unit is missing type offset");
408// Note that, address_size and debug_abbrev_offset fields have switched 409// places between dwarf version 4 and 5. 414 Header.HeaderSize =
Offset;
424auto NewOffset = OffsetRemapping[OldOffset];
433// Could possibly produce an error or warning if one of these was non-null but 434// the other was null. 435if (CurStrSection.
empty() || CurStrOffsetSection.
empty())
443while (
constchar *S =
Data.getCStr(&LocalOffset)) {
444 OffsetRemapping[PrevOffset] =
445 Strings.getOffset(S, LocalOffset - PrevOffset);
446 PrevOffset = LocalOffset;
459"StrOffsetSection size is less than its header");
464if (HeaderSize == 8) {
465 ContributionSize =
Data.getU32(&HeaderLengthOffset);
466 }
elseif (HeaderSize == 16) {
467 HeaderLengthOffset += 4;
// skip the dwarf64 marker 468 ContributionSize =
Data.getU64(&HeaderLengthOffset);
470 ContributionEnd = ContributionSize + HeaderLengthOffset;
484for (
constauto &E : IndexEntries)
485for (
size_tI = 0;
I != std::size(E.second.Contributions); ++
I)
486if (ContributionOffsets[
I])
488 ? E.second.Contributions[
I].getOffset32()
489 : E.second.Contributions[
I].getLength32()),
497if (IndexEntries.
empty())
501for (
auto &
C : ContributionOffsets)
508for (
constauto &
P : IndexEntries) {
511auto HP = ((S >> 32) & Mask) | 1;
513assert(S != IndexEntries.
begin()[Buckets[
H] - 1].first &&
527// Write the signatures. 528for (
constauto &
I : Buckets)
532for (
constauto &
I : Buckets)
535// Write the column headers (which sections will appear in the table) 536for (
size_tI = 0;
I != ContributionOffsets.
size(); ++
I)
537if (ContributionOffsets[
I])
549return make_error<DWPError>(
550 std::string(
"duplicate DWO ID (") + utohexstr(PrevE.first) +
") in " +
552 PrevE.second.DWOName) +
557constStringMap<std::pair<MCSection *, DWARFSectionKind>> &KnownSections,
565 std::vector<StringRef> &CurTypesSection,
566 std::vector<StringRef> &CurInfoSection,
StringRef &AbbrevSection,
568 std::vector<std::pair<DWARFSectionKind, uint32_t>> &SectionLength) {
572if (Section.isVirtual())
591auto SectionPair = KnownSections.find(
Name);
592if (SectionPair == KnownSections.end())
597 SectionLength.push_back(std::make_pair(
Kind, Contents.
size()));
600if (
Kind == DW_SECT_ABBREV) {
601 AbbrevSection = Contents;
605MCSection *OutSection = SectionPair->second.first;
606if (OutSection == StrOffsetSection)
607 CurStrOffsetSection = Contents;
608elseif (OutSection == StrSection)
609 CurStrSection = Contents;
610elseif (OutSection == TypesSection)
611 CurTypesSection.push_back(Contents);
612elseif (OutSection == CUIndexSection)
613 CurCUIndexSection = Contents;
614elseif (OutSection == TUIndexSection)
615 CurTUIndexSection = Contents;
616elseif (OutSection == InfoSection)
617 CurInfoSection.push_back(Contents);
628MCSection *
const StrSection = MCOFI.getDwarfStrDWOSection();
629MCSection *
const StrOffsetSection = MCOFI.getDwarfStrOffDWOSection();
630MCSection *
const TypesSection = MCOFI.getDwarfTypesDWOSection();
631MCSection *
const CUIndexSection = MCOFI.getDwarfCUIndexSection();
632MCSection *
const TUIndexSection = MCOFI.getDwarfTUIndexSection();
633MCSection *
const InfoSection = MCOFI.getDwarfInfoDWOSection();
635 {
"debug_info.dwo", {InfoSection, DW_SECT_INFO}},
637 {
"debug_str_offsets.dwo", {StrOffsetSection, DW_SECT_STR_OFFSETS}},
640 {
"debug_line.dwo", {MCOFI.getDwarfLineDWOSection(), DW_SECT_LINE}},
641 {
"debug_macro.dwo", {MCOFI.getDwarfMacroDWOSection(), DW_SECT_MACRO}},
642 {
"debug_abbrev.dwo", {MCOFI.getDwarfAbbrevDWOSection(), DW_SECT_ABBREV}},
643 {
"debug_loclists.dwo",
644 {MCOFI.getDwarfLoclistsDWOSection(), DW_SECT_LOCLISTS}},
645 {
"debug_rnglists.dwo",
646 {MCOFI.getDwarfRnglistsDWOSection(), DW_SECT_RNGLISTS}},
653uint32_t ContributionOffsets[8] = {};
656bool AnySectionOverflow =
false;
663 std::deque<SmallString<32>> UncompressedSections;
665for (
constauto &Input : Inputs) {
669 [&](std::unique_ptr<ECError> EC) ->
Error {
670 return createFileError(Input, Error(std::move(EC)));
674auto &Obj = *ErrOrObj->getBinary();
681 std::vector<StringRef> CurTypesSection;
682 std::vector<StringRef> CurInfoSection;
687// This maps each section contained in this file to its length. 688// This information is later on used to calculate the contributions, 689// i.e. offset and length, of each compile/type unit to a section. 690 std::vector<std::pair<DWARFSectionKind, uint32_t>> SectionLength;
692for (
constauto &Section : Obj.sections())
694 KnownSections, StrSection, StrOffsetSection, TypesSection,
695 CUIndexSection, TUIndexSection, InfoSection, Section, Out,
696 UncompressedSections, ContributionOffsets, CurEntry,
697 CurStrSection, CurStrOffsetSection, CurTypesSection,
698 CurInfoSection, AbbrevSection, CurCUIndexSection,
699 CurTUIndexSection, SectionLength))
702if (CurInfoSection.empty())
713 IndexVersion =
Version < 5 ? 2 : 5;
714 }
elseif (
Version != Header.Version) {
715return make_error<DWPError>(
"incompatible DWARF compile unit versions.");
719 CurStrOffsetSection, Header.Version);
721for (
auto Pair : SectionLength) {
725uint32_t OldOffset = ContributionOffsets[Index];
727if (OldOffset > ContributionOffsets[Index]) {
729for (
auto &Section : Obj.sections()) {
730if (SectionIndex == Index) {
732 OldOffset, ContributionOffsets[Index], *Section.getName(),
733 OverflowOptValue, AnySectionOverflow))
738if (AnySectionOverflow)
745if (CurCUIndexSection.
empty()) {
746bool FoundCUUnit =
false;
750while (
Info.size() > UnitOffset) {
760C.setOffset(InfoSectionOffset);
761C.setLength(Header.Length + 4);
763if (std::numeric_limits<uint32_t>::max() - InfoSectionOffset <
766 InfoSectionOffset, InfoSectionOffset +
C.getLength32(),
767"debug_info", OverflowOptValue, AnySectionOverflow))
769if (AnySectionOverflow) {
770if (Header.Version < 5 ||
771 Header.UnitType == dwarf::DW_UT_split_compile)
777 UnitOffset +=
C.getLength32();
778if (Header.Version < 5 ||
779 Header.UnitType == dwarf::DW_UT_split_compile) {
781 Header, AbbrevSection,
782Info.substr(UnitOffset -
C.getLength32(),
C.getLength32()),
783 CurStrOffsetSection, CurStrSection);
788autoP = IndexEntries.
insert(std::make_pair(
ID.Signature, Entry));
791P.first->second.Name =
ID.Name;
792P.first->second.DWOName =
ID.DWOName;
795 }
elseif (Header.UnitType == dwarf::DW_UT_split_type) {
796autoP = TypeIndexEntries.
insert(
797 std::make_pair(*Header.Signature, Entry));
802Info.substr(UnitOffset -
C.getLength32(),
C.getLength32()));
803 InfoSectionOffset +=
C.getLength32();
805if (AnySectionOverflow)
810return make_error<DWPError>(
"no compile unit found in file: " + Input);
812if (IndexVersion == 2) {
813// Add types from the .debug_types section from DWARF < 5. 815 Out, TypeIndexEntries, TypesSection, CurTypesSection, CurEntry,
817 OverflowOptValue, AnySectionOverflow))
820if (AnySectionOverflow)
825if (CurInfoSection.size() != 1)
826return make_error<DWPError>(
"expected exactly one occurrence of a debug " 827"info section in a .dwp file");
831DataExtractor CUIndexData(CurCUIndexSection, Obj.isLittleEndian(), 0);
832if (!CUIndex.
parse(CUIndexData))
833return make_error<DWPError>(
"failed to parse cu_index");
835return make_error<DWPError>(
"incompatible cu_index versions, found " +
837" and expecting " + utostr(IndexVersion));
841auto *
I = E.getContributions();
844autoP = IndexEntries.
insert(std::make_pair(E.getSignature(), CurEntry));
863auto &NewEntry =
P.first->second;
864 NewEntry.Name =
ID.Name;
865 NewEntry.DWOName =
ID.DWOName;
866 NewEntry.DWPName = Input;
872C.setOffset(
C.getOffset() +
I->getOffset());
873C.setLength(
I->getLength());
877auto &
C = NewEntry.Contributions[Index];
879C.setOffset(InfoSectionOffset);
880 InfoSectionOffset +=
C.getLength32();
883if (!CurTUIndexSection.
empty()) {
887// Write type units into debug info section for DWARFv5. 889 TUSectionKind = DW_SECT_INFO;
890 OutSection = InfoSection;
891 TypeInputSection = DwpSingleInfoSection;
893// Write type units into debug types section for DWARF < 5. 894if (CurTypesSection.size() != 1)
895return make_error<DWPError>(
896"multiple type unit sections in .dwp file");
899 OutSection = TypesSection;
900 TypeInputSection = CurTypesSection.
front();
904DataExtractor TUIndexData(CurTUIndexSection, Obj.isLittleEndian(), 0);
905if (!TUIndex.
parse(TUIndexData))
906return make_error<DWPError>(
"failed to parse tu_index");
908return make_error<DWPError>(
"incompatible tu_index versions, found " +
910" and expecting " + utostr(IndexVersion));
912unsigned TypesContributionIndex =
915 Out, TypeIndexEntries, TUIndex, OutSection, TypeInputSection,
916 CurEntry, ContributionOffsets[TypesContributionIndex],
917 TypesContributionIndex, OverflowOptValue, AnySectionOverflow))
920if (AnySectionOverflow)
925// Lie about there being no info contributions so the TU index only includes 926// the type unit contribution for DWARF < 5. In DWARFv5 the TU index has a 927// contribution to the info section, so we do not want to lie about it. 928 ContributionOffsets[0] = 0;
930writeIndex(Out, MCOFI.getDwarfTUIndexSection(), ContributionOffsets,
931 TypeIndexEntries, IndexVersion);
934// Lie about the type contribution for DWARF < 5. In DWARFv5 the type 935// section does not exist, so no need to do anything about this. 937// Unlie about the info contribution 938 ContributionOffsets[0] = 1;
941writeIndex(Out, MCOFI.getDwarfCUIndexSection(), ContributionOffsets,
942 IndexEntries, IndexVersion);
Analysis containing CSE Info
static uint64_t getCUAbbrev(StringRef Abbrev, uint64_t AbbrCode)
static Error handleCompressedSection(std::deque< SmallString< 32 > > &UncompressedSections, SectionRef Sec, StringRef Name, StringRef &Contents)
static std::string buildDWODescription(StringRef Name, StringRef DWPName, StringRef DWOName)
static uint64_t debugStrOffsetsHeaderSize(DataExtractor StrOffsetsData, uint16_t DwarfVersion)
static Expected< const char * > getIndexedString(dwarf::Form Form, DataExtractor InfoData, uint64_t &InfoOffset, StringRef StrOffsets, StringRef Str, uint16_t Version)
static Error addAllTypesFromTypesSection(MCStreamer &Out, MapVector< uint64_t, UnitIndexEntry > &TypeIndexEntries, MCSection *OutputTypes, const std::vector< StringRef > &TypesSections, const UnitIndexEntry &CUEntry, uint32_t &TypesOffset, OnCuIndexOverflow OverflowOptValue, bool &AnySectionOverflow)
static unsigned getOnDiskSectionId(unsigned Index)
static Expected< CompileUnitIdentifiers > getCUIdentifiers(InfoSectionUnitHeader &Header, StringRef Abbrev, StringRef Info, StringRef StrOffsets, StringRef Str)
static Error sectionOverflowErrorOrWarning(uint32_t PrevOffset, uint32_t OverflowedOffset, StringRef SectionName, OnCuIndexOverflow OverflowOptValue, bool &AnySectionOverflow)
static mc::RegisterMCTargetOptionsFlags MCTargetOptionsFlags
static StringRef getSubsection(StringRef Section, const DWARFUnitIndex::Entry &Entry, DWARFSectionKind Kind)
static Error createError(StringRef Name, Error E)
static bool isSupportedSectionKind(DWARFSectionKind Kind)
static Error addAllTypesFromDWP(MCStreamer &Out, MapVector< uint64_t, UnitIndexEntry > &TypeIndexEntries, const DWARFUnitIndex &TUIndex, MCSection *OutputTypes, StringRef Types, const UnitIndexEntry &TUEntry, uint32_t &TypesOffset, unsigned TypesContributionIndex, OnCuIndexOverflow OverflowOptValue, bool &AnySectionOverflow)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static uint32_t getFlags(const Symbol *Sym)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
A DataExtractor (typically for an in-memory copy of an object-file section) plus a relocation map for...
std::pair< uint64_t, dwarf::DwarfFormat > getInitialLength(uint64_t *Off, Error *Err=nullptr) const
Extracts the DWARF "initial length" field, which can either be a 32-bit value smaller than 0xfffffff0...
bool skipValue(DataExtractor DebugInfoData, uint64_t *OffsetPtr, const dwarf::FormParams Params) const
Skip a form's value in DebugInfoData at the offset specified by OffsetPtr.
void setOffset(uint64_t Value)
void setLength(uint64_t Value)
uint32_t getLength32() const
uint64_t getOffset() const
uint32_t getVersion() const
bool parse(DataExtractor IndexData)
ArrayRef< DWARFSectionKind > getColumnKinds() const
ArrayRef< Entry > getRows() const
uint32_t getU32(uint64_t *offset_ptr, Error *Err=nullptr) const
Extract a uint32_t value from *offset_ptr.
size_t size() const
Return the number of bytes in the underlying buffer.
const char * getCStr(uint64_t *OffsetPtr, Error *Err=nullptr) const
Extract a C string from *offset_ptr.
uint8_t getU8(uint64_t *offset_ptr, Error *Err=nullptr) const
Extract a uint8_t value from *offset_ptr.
uint64_t getULEB128(uint64_t *offset_ptr, llvm::Error *Err=nullptr) const
Extract a unsigned LEB128 value from *offset_ptr.
uint16_t getU16(uint64_t *offset_ptr, Error *Err=nullptr) const
Extract a uint16_t value from *offset_ptr.
uint64_t getU64(uint64_t *offset_ptr, Error *Err=nullptr) const
Extract a uint64_t value from *offset_ptr.
bool isValidOffset(uint64_t offset) const
Test the validity of offset.
uint32_t getU24(uint64_t *OffsetPtr, Error *Err=nullptr) const
Extract a 24-bit unsigned value from *offset_ptr and return it in a uint32_t.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
Error takeError()
Take ownership of the stored error.
const MCObjectFileInfo * getObjectFileInfo() const
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Streaming machine code generation interface.
MCContext & getContext() const
virtual void emitIntValue(uint64_t Value, unsigned Size)
Special case of EmitValue that avoids the client having to pass in a MCExpr for constant integers.
virtual void switchSection(MCSection *Section, uint32_t Subsec=0)
Set the current section where code is being emitted to Section.
virtual void emitBytes(StringRef Data)
Emit the bytes in Data into the output.
This class implements a map that also provides access to all stored values in a deterministic order.
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
void reserve(size_type N)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
StringRef - Represent a constant reference to a string, i.e.
constexpr bool empty() const
empty - Check if the string is empty.
char back() const
back - Get the last character in the string.
constexpr size_t size() const
size - Get the string size.
char front() const
front - Get the first character in the string.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
static void defaultWarningHandler(Error Warning)
Implement default handling for Warning.
static Expected< Decompressor > create(StringRef Name, StringRef Data, bool IsLE, bool Is64Bit)
Create decompressor object.
static Expected< OwningBinary< ObjectFile > > createObjectFile(StringRef ObjectPath)
This is a value type class that represents a single section in the list of sections in the object fil...
const ObjectFile * getObject() const
@ C
The default llvm calling convention, compatible with C.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ DW_LENGTH_DWARF64
Indicator of 64-bit DWARF format.
This is an optimization pass for GlobalISel generic memory operations.
Error createFileError(const Twine &F, Error E)
Concatenate a source file path and/or name with an Error.
Error buildDuplicateError(const std::pair< uint64_t, UnitIndexEntry > &PrevE, const CompileUnitIdentifiers &ID, StringRef DWPName)
void writeIndex(MCStreamer &Out, MCSection *Section, ArrayRef< unsigned > ContributionOffsets, const MapVector< uint64_t, UnitIndexEntry > &IndexEntries, uint32_t IndexVersion)
Error handleErrors(Error E, HandlerTs &&... Hs)
Pass the ErrorInfo(s) contained in E to their respective handlers.
static void writeNewOffsetsTo(MCStreamer &Out, DataExtractor &Data, DenseMap< uint64_t, uint32_t > &OffsetRemapping, uint64_t &Offset, uint64_t &Size)
void writeStringsAndOffsets(MCStreamer &Out, DWPStringPool &Strings, MCSection *StrOffsetSection, StringRef CurStrSection, StringRef CurStrOffsetSection, uint16_t Version)
DWARFSectionKind
The enum of section identifiers to be used in internal interfaces.
@ DW_SECT_EXT_unknown
Denotes a value read from an index section that does not correspond to any of the supported standards...
uint32_t serializeSectionKind(DWARFSectionKind Kind, unsigned IndexVersion)
Convert the internal value for a section kind to an on-disk value.
Error write(MCStreamer &Out, ArrayRef< std::string > Inputs, OnCuIndexOverflow OverflowOptValue)
Error handleSection(const StringMap< std::pair< MCSection *, DWARFSectionKind > > &KnownSections, const MCSection *StrSection, const MCSection *StrOffsetSection, const MCSection *TypesSection, const MCSection *CUIndexSection, const MCSection *TUIndexSection, const MCSection *InfoSection, const object::SectionRef &Section, MCStreamer &Out, std::deque< SmallString< 32 > > &UncompressedSections, uint32_t(&ContributionOffsets)[8], UnitIndexEntry &CurEntry, StringRef &CurStrSection, StringRef &CurStrOffsetSection, std::vector< StringRef > &CurTypesSection, std::vector< StringRef > &CurInfoSection, StringRef &AbbrevSection, StringRef &CurCUIndexSection, StringRef &CurTUIndexSection, std::vector< std::pair< DWARFSectionKind, uint32_t > > &SectionLength)
void writeIndexTable(MCStreamer &Out, ArrayRef< unsigned > ContributionOffsets, const MapVector< uint64_t, UnitIndexEntry > &IndexEntries, const AccessField &Field)
unsigned getContributionIndex(DWARFSectionKind Kind, uint32_t IndexVersion)
Expected< InfoSectionUnitHeader > parseInfoSectionUnitHeader(StringRef Info)
const char * toString(DWARFSectionKind Kind)
constexpr uint64_t NextPowerOf2(uint64_t A)
Returns the next power of two (in 64-bits) that is strictly greater than A.
DWARFUnitIndex::Entry::SectionContribution Contributions[8]
A helper struct providing information about the byte size of DW_FORM values that vary in size dependi...
Create this object with static storage to register mc-related command line options.