LLVM 19.0.0git
DWP.cpp
Go to the documentation of this file.
1//===-- llvm-dwp.cpp - Split DWARF merging tool for llvm ------------------===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8//
9// A utility for merging DWARF 5 Split DWARF .dwo files into .dwp (DWARF
10// package files).
11//
12//===----------------------------------------------------------------------===//
13#include "llvm/DWP/DWP.h"
14#include "llvm/ADT/Twine.h"
15#include "llvm/DWP/DWPError.h"
16#include "llvm/MC/MCContext.h"
23#include <limits>
24
25using namespace llvm;
26using namespace llvm::object;
27
29
30// Returns the size of debug_str_offsets section headers in bytes.
32 uint16_t DwarfVersion) {
33 if (DwarfVersion <= 4)
34 return 0; // There is no header before dwarf 5.
35 uint64_t Offset = 0;
36 uint64_t Length = StrOffsetsData.getU32(&Offset);
38 return 16; // unit length: 12 bytes, version: 2 bytes, padding: 2 bytes.
39 return 8; // unit length: 4 bytes, version: 2 bytes, padding: 2 bytes.
40}
41
42static uint64_t getCUAbbrev(StringRef Abbrev, uint64_t AbbrCode) {
43 uint64_t Offset = 0;
44 DataExtractor AbbrevData(Abbrev, true, 0);
45 while (AbbrevData.getULEB128(&Offset) != AbbrCode) {
46 // Tag
47 AbbrevData.getULEB128(&Offset);
48 // DW_CHILDREN
49 AbbrevData.getU8(&Offset);
50 // Attributes
51 while (AbbrevData.getULEB128(&Offset) | AbbrevData.getULEB128(&Offset))
52 ;
53 }
54 return Offset;
55}
56
59 StringRef StrOffsets, StringRef Str, uint16_t Version) {
60 if (Form == dwarf::DW_FORM_string)
61 return InfoData.getCStr(&InfoOffset);
62 uint64_t StrIndex;
63 switch (Form) {
64 case dwarf::DW_FORM_strx1:
65 StrIndex = InfoData.getU8(&InfoOffset);
66 break;
67 case dwarf::DW_FORM_strx2:
68 StrIndex = InfoData.getU16(&InfoOffset);
69 break;
70 case dwarf::DW_FORM_strx3:
71 StrIndex = InfoData.getU24(&InfoOffset);
72 break;
73 case dwarf::DW_FORM_strx4:
74 StrIndex = InfoData.getU32(&InfoOffset);
75 break;
76 case dwarf::DW_FORM_strx:
77 case dwarf::DW_FORM_GNU_str_index:
78 StrIndex = InfoData.getULEB128(&InfoOffset);
79 break;
80 default:
81 return 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.");
85 }
86 DataExtractor StrOffsetsData(StrOffsets, true, 0);
87 uint64_t StrOffsetsOffset = 4 * StrIndex;
88 StrOffsetsOffset += debugStrOffsetsHeaderSize(StrOffsetsData, Version);
89
90 uint64_t StrOffset = StrOffsetsData.getU32(&StrOffsetsOffset);
91 DataExtractor StrData(Str, true, 0);
92 return StrData.getCStr(&StrOffset);
93}
94
97 StringRef Info, StringRef StrOffsets, StringRef Str) {
98 DataExtractor InfoData(Info, true, 0);
99 uint64_t Offset = Header.HeaderSize;
100 if (Header.Version >= 5 && Header.UnitType != dwarf::DW_UT_split_compile)
101 return 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"));
105
107
108 uint32_t AbbrCode = InfoData.getULEB128(&Offset);
109 DataExtractor AbbrevData(Abbrev, true, 0);
110 uint64_t AbbrevOffset = getCUAbbrev(Abbrev, AbbrCode);
111 auto Tag = static_cast<dwarf::Tag>(AbbrevData.getULEB128(&AbbrevOffset));
112 if (Tag != dwarf::DW_TAG_compile_unit)
113 return make_error<DWPError>("top level DIE is not a compile unit");
114 // DW_CHILDREN
115 AbbrevData.getU8(&AbbrevOffset);
118 while ((Name = AbbrevData.getULEB128(&AbbrevOffset)) |
119 (Form = static_cast<dwarf::Form>(
120 AbbrevData.getULEB128(&AbbrevOffset))) &&
121 (Name != 0 || Form != 0)) {
122 switch (Name) {
123 case dwarf::DW_AT_name: {
125 Form, InfoData, Offset, StrOffsets, Str, Header.Version);
126 if (!EName)
127 return EName.takeError();
128 ID.Name = *EName;
129 break;
130 }
131 case dwarf::DW_AT_GNU_dwo_name:
132 case dwarf::DW_AT_dwo_name: {
134 Form, InfoData, Offset, StrOffsets, Str, Header.Version);
135 if (!EName)
136 return EName.takeError();
137 ID.DWOName = *EName;
138 break;
139 }
140 case dwarf::DW_AT_GNU_dwo_id:
141 Header.Signature = InfoData.getU64(&Offset);
142 break;
143 default:
145 Form, InfoData, &Offset,
146 dwarf::FormParams({Header.Version, Header.AddrSize, Header.Format}));
147 }
148 }
149 if (!Header.Signature)
150 return make_error<DWPError>("compile unit missing dwo_id");
151 ID.Signature = *Header.Signature;
152 return ID;
153}
154
156 return Kind != DW_SECT_EXT_unknown;
157}
158
159namespace llvm {
160// Convert an internal section identifier into the index to use with
161// UnitIndexEntry::Contributions.
163 assert(serializeSectionKind(Kind, IndexVersion) >= DW_SECT_INFO);
164 return serializeSectionKind(Kind, IndexVersion) - DW_SECT_INFO;
165}
166} // namespace llvm
167
168// Convert a UnitIndexEntry::Contributions index to the corresponding on-disk
169// value of the section identifier.
170static unsigned getOnDiskSectionId(unsigned Index) {
171 return Index + DW_SECT_INFO;
172}
173
175 const DWARFUnitIndex::Entry &Entry,
177 const auto *Off = Entry.getContribution(Kind);
178 if (!Off)
179 return StringRef();
180 return Section.substr(Off->getOffset(), Off->getLength());
181}
182
184 uint32_t OverflowedOffset,
186 OnCuIndexOverflow OverflowOptValue,
187 bool &AnySectionOverflow) {
188 std::string Msg =
189 (SectionName +
190 Twine(" Section Contribution Offset overflow 4G. Previous Offset ") +
191 Twine(PrevOffset) + Twine(", After overflow offset ") +
192 Twine(OverflowedOffset) + Twine("."))
193 .str();
194 if (OverflowOptValue == OnCuIndexOverflow::Continue) {
195 WithColor::defaultWarningHandler(make_error<DWPError>(Msg));
196 return Error::success();
197 } else if (OverflowOptValue == OnCuIndexOverflow::SoftStop) {
198 AnySectionOverflow = true;
199 WithColor::defaultWarningHandler(make_error<DWPError>(Msg));
200 return Error::success();
201 }
202 return make_error<DWPError>(Msg);
203}
204
206 MCStreamer &Out, MapVector<uint64_t, UnitIndexEntry> &TypeIndexEntries,
207 const DWARFUnitIndex &TUIndex, MCSection *OutputTypes, StringRef Types,
208 const UnitIndexEntry &TUEntry, uint32_t &TypesOffset,
209 unsigned TypesContributionIndex, OnCuIndexOverflow OverflowOptValue,
210 bool &AnySectionOverflow) {
211 Out.switchSection(OutputTypes);
212 for (const DWARFUnitIndex::Entry &E : TUIndex.getRows()) {
213 auto *I = E.getContributions();
214 if (!I)
215 continue;
216 auto P = TypeIndexEntries.insert(std::make_pair(E.getSignature(), TUEntry));
217 if (!P.second)
218 continue;
219 auto &Entry = P.first->second;
220 // Zero out the debug_info contribution
221 Entry.Contributions[0] = {};
222 for (auto Kind : TUIndex.getColumnKinds()) {
224 continue;
225 auto &C =
226 Entry.Contributions[getContributionIndex(Kind, TUIndex.getVersion())];
227 C.setOffset(C.getOffset() + I->getOffset());
228 C.setLength(I->getLength());
229 ++I;
230 }
231 auto &C = Entry.Contributions[TypesContributionIndex];
232 Out.emitBytes(Types.substr(
233 C.getOffset() -
234 TUEntry.Contributions[TypesContributionIndex].getOffset(),
235 C.getLength()));
236 C.setOffset(TypesOffset);
237 uint32_t OldOffset = TypesOffset;
238 static_assert(sizeof(OldOffset) == sizeof(TypesOffset));
239 TypesOffset += C.getLength();
240 if (OldOffset > TypesOffset) {
241 if (Error Err = sectionOverflowErrorOrWarning(OldOffset, TypesOffset,
242 "Types", OverflowOptValue,
243 AnySectionOverflow))
244 return Err;
245 if (AnySectionOverflow) {
246 TypesOffset = OldOffset;
247 return Error::success();
248 }
249 }
250 }
251 return Error::success();
252}
253
255 MCStreamer &Out, MapVector<uint64_t, UnitIndexEntry> &TypeIndexEntries,
256 MCSection *OutputTypes, const std::vector<StringRef> &TypesSections,
257 const UnitIndexEntry &CUEntry, uint32_t &TypesOffset,
258 OnCuIndexOverflow OverflowOptValue, bool &AnySectionOverflow) {
259 for (StringRef Types : TypesSections) {
260 Out.switchSection(OutputTypes);
261 uint64_t Offset = 0;
262 DataExtractor Data(Types, true, 0);
263 while (Data.isValidOffset(Offset)) {
264 UnitIndexEntry Entry = CUEntry;
265 // Zero out the debug_info contribution
266 Entry.Contributions[0] = {};
267 auto &C = Entry.Contributions[getContributionIndex(DW_SECT_EXT_TYPES, 2)];
268 C.setOffset(TypesOffset);
269 auto PrevOffset = Offset;
270 // Length of the unit, including the 4 byte length field.
271 C.setLength(Data.getU32(&Offset) + 4);
272
273 Data.getU16(&Offset); // Version
274 Data.getU32(&Offset); // Abbrev offset
275 Data.getU8(&Offset); // Address size
276 auto Signature = Data.getU64(&Offset);
277 Offset = PrevOffset + C.getLength32();
278
279 auto P = TypeIndexEntries.insert(std::make_pair(Signature, Entry));
280 if (!P.second)
281 continue;
282
283 Out.emitBytes(Types.substr(PrevOffset, C.getLength32()));
284 uint32_t OldOffset = TypesOffset;
285 TypesOffset += C.getLength32();
286 if (OldOffset > TypesOffset) {
287 if (Error Err = sectionOverflowErrorOrWarning(OldOffset, TypesOffset,
288 "Types", OverflowOptValue,
289 AnySectionOverflow))
290 return Err;
291 if (AnySectionOverflow) {
292 TypesOffset = OldOffset;
293 return Error::success();
294 }
295 }
296 }
297 }
298 return Error::success();
299}
300
301static std::string buildDWODescription(StringRef Name, StringRef DWPName,
302 StringRef DWOName) {
303 std::string Text = "\'";
304 Text += Name;
305 Text += '\'';
306 bool HasDWO = !DWOName.empty();
307 bool HasDWP = !DWPName.empty();
308 if (HasDWO || HasDWP) {
309 Text += " (from ";
310 if (HasDWO) {
311 Text += '\'';
312 Text += DWOName;
313 Text += '\'';
314 }
315 if (HasDWO && HasDWP)
316 Text += " in ";
317 if (!DWPName.empty()) {
318 Text += '\'';
319 Text += DWPName;
320 Text += '\'';
321 }
322 Text += ")";
323 }
324 return Text;
325}
326
328 return make_error<DWPError>(
329 ("failure while decompressing compressed section: '" + Name + "', " +
330 llvm::toString(std::move(E)))
331 .str());
332}
333
334static Error
335handleCompressedSection(std::deque<SmallString<32>> &UncompressedSections,
336 SectionRef Sec, StringRef Name, StringRef &Contents) {
337 auto *Obj = dyn_cast<ELFObjectFileBase>(Sec.getObject());
338 if (!Obj ||
339 !(static_cast<ELFSectionRef>(Sec).getFlags() & ELF::SHF_COMPRESSED))
340 return Error::success();
341 bool IsLE = isa<object::ELF32LEObjectFile>(Obj) ||
342 isa<object::ELF64LEObjectFile>(Obj);
343 bool Is64 = isa<object::ELF64LEObjectFile>(Obj) ||
344 isa<object::ELF64BEObjectFile>(Obj);
345 Expected<Decompressor> Dec = Decompressor::create(Name, Contents, IsLE, Is64);
346 if (!Dec)
347 return createError(Name, Dec.takeError());
348
349 UncompressedSections.emplace_back();
350 if (Error E = Dec->resizeAndDecompress(UncompressedSections.back()))
351 return createError(Name, std::move(E));
352
353 Contents = UncompressedSections.back();
354 return Error::success();
355}
356
357namespace llvm {
358// Parse and return the header of an info section compile/type unit.
361 Error Err = Error::success();
362 uint64_t Offset = 0;
363 DWARFDataExtractor InfoData(Info, true, 0);
364 std::tie(Header.Length, Header.Format) =
365 InfoData.getInitialLength(&Offset, &Err);
366 if (Err)
367 return make_error<DWPError>("cannot parse compile unit length: " +
368 llvm::toString(std::move(Err)));
369
370 if (!InfoData.isValidOffset(Offset + (Header.Length - 1))) {
371 return make_error<DWPError>(
372 "compile unit exceeds .debug_info section range: " +
373 utostr(Offset + Header.Length) + " >= " + utostr(InfoData.size()));
374 }
375
376 Header.Version = InfoData.getU16(&Offset, &Err);
377 if (Err)
378 return make_error<DWPError>("cannot parse compile unit version: " +
379 llvm::toString(std::move(Err)));
380
381 uint64_t MinHeaderLength;
382 if (Header.Version >= 5) {
383 // Size: Version (2), UnitType (1), AddrSize (1), DebugAbbrevOffset (4),
384 // Signature (8)
385 MinHeaderLength = 16;
386 } else {
387 // Size: Version (2), DebugAbbrevOffset (4), AddrSize (1)
388 MinHeaderLength = 7;
389 }
390 if (Header.Length < MinHeaderLength) {
391 return make_error<DWPError>("unit length is too small: expected at least " +
392 utostr(MinHeaderLength) + " got " +
393 utostr(Header.Length) + ".");
394 }
395 if (Header.Version >= 5) {
396 Header.UnitType = InfoData.getU8(&Offset);
397 Header.AddrSize = InfoData.getU8(&Offset);
398 Header.DebugAbbrevOffset = InfoData.getU32(&Offset);
399 Header.Signature = InfoData.getU64(&Offset);
400 if (Header.UnitType == dwarf::DW_UT_split_type) {
401 // Type offset.
402 MinHeaderLength += 4;
403 if (Header.Length < MinHeaderLength)
404 return make_error<DWPError>("type unit is missing type offset");
405 InfoData.getU32(&Offset);
406 }
407 } else {
408 // Note that, address_size and debug_abbrev_offset fields have switched
409 // places between dwarf version 4 and 5.
410 Header.DebugAbbrevOffset = InfoData.getU32(&Offset);
411 Header.AddrSize = InfoData.getU8(&Offset);
412 }
413
414 Header.HeaderSize = Offset;
415 return Header;
416}
417
419 MCSection *StrOffsetSection,
420 StringRef CurStrSection,
421 StringRef CurStrOffsetSection, uint16_t Version) {
422 // Could possibly produce an error or warning if one of these was non-null but
423 // the other was null.
424 if (CurStrSection.empty() || CurStrOffsetSection.empty())
425 return;
426
427 DenseMap<uint64_t, uint32_t> OffsetRemapping;
428
429 DataExtractor Data(CurStrSection, true, 0);
430 uint64_t LocalOffset = 0;
431 uint64_t PrevOffset = 0;
432 while (const char *S = Data.getCStr(&LocalOffset)) {
433 OffsetRemapping[PrevOffset] =
434 Strings.getOffset(S, LocalOffset - PrevOffset);
435 PrevOffset = LocalOffset;
436 }
437
438 Data = DataExtractor(CurStrOffsetSection, true, 0);
439
440 Out.switchSection(StrOffsetSection);
441
442 uint64_t HeaderSize = debugStrOffsetsHeaderSize(Data, Version);
443 uint64_t Offset = 0;
444 uint64_t Size = CurStrOffsetSection.size();
445 // FIXME: This can be caused by bad input and should be handled as such.
446 assert(HeaderSize <= Size && "StrOffsetSection size is less than its header");
447 // Copy the header to the output.
448 Out.emitBytes(Data.getBytes(&Offset, HeaderSize));
449 while (Offset < Size) {
450 auto OldOffset = Data.getU32(&Offset);
451 auto NewOffset = OffsetRemapping[OldOffset];
452 Out.emitIntValue(NewOffset, 4);
453 }
454}
455
457void writeIndexTable(MCStreamer &Out, ArrayRef<unsigned> ContributionOffsets,
458 const MapVector<uint64_t, UnitIndexEntry> &IndexEntries,
459 const AccessField &Field) {
460 for (const auto &E : IndexEntries)
461 for (size_t I = 0; I != std::size(E.second.Contributions); ++I)
462 if (ContributionOffsets[I])
464 ? E.second.Contributions[I].getOffset32()
465 : E.second.Contributions[I].getLength32()),
466 4);
467}
468
469void writeIndex(MCStreamer &Out, MCSection *Section,
470 ArrayRef<unsigned> ContributionOffsets,
471 const MapVector<uint64_t, UnitIndexEntry> &IndexEntries,
472 uint32_t IndexVersion) {
473 if (IndexEntries.empty())
474 return;
475
476 unsigned Columns = 0;
477 for (auto &C : ContributionOffsets)
478 if (C)
479 ++Columns;
480
481 std::vector<unsigned> Buckets(NextPowerOf2(3 * IndexEntries.size() / 2));
482 uint64_t Mask = Buckets.size() - 1;
483 size_t I = 0;
484 for (const auto &P : IndexEntries) {
485 auto S = P.first;
486 auto H = S & Mask;
487 auto HP = ((S >> 32) & Mask) | 1;
488 while (Buckets[H]) {
489 assert(S != IndexEntries.begin()[Buckets[H] - 1].first &&
490 "Duplicate unit");
491 H = (H + HP) & Mask;
492 }
493 Buckets[H] = I + 1;
494 ++I;
495 }
496
497 Out.switchSection(Section);
498 Out.emitIntValue(IndexVersion, 4); // Version
499 Out.emitIntValue(Columns, 4); // Columns
500 Out.emitIntValue(IndexEntries.size(), 4); // Num Units
501 Out.emitIntValue(Buckets.size(), 4); // Num Buckets
502
503 // Write the signatures.
504 for (const auto &I : Buckets)
505 Out.emitIntValue(I ? IndexEntries.begin()[I - 1].first : 0, 8);
506
507 // Write the indexes.
508 for (const auto &I : Buckets)
509 Out.emitIntValue(I, 4);
510
511 // Write the column headers (which sections will appear in the table)
512 for (size_t I = 0; I != ContributionOffsets.size(); ++I)
513 if (ContributionOffsets[I])
515
516 // Write the offsets.
517 writeIndexTable(Out, ContributionOffsets, IndexEntries, AccessField::Offset);
518
519 // Write the lengths.
520 writeIndexTable(Out, ContributionOffsets, IndexEntries, AccessField::Length);
521}
522
523Error buildDuplicateError(const std::pair<uint64_t, UnitIndexEntry> &PrevE,
524 const CompileUnitIdentifiers &ID, StringRef DWPName) {
525 return make_error<DWPError>(
526 std::string("duplicate DWO ID (") + utohexstr(PrevE.first) + ") in " +
527 buildDWODescription(PrevE.second.Name, PrevE.second.DWPName,
528 PrevE.second.DWOName) +
529 " and " + buildDWODescription(ID.Name, DWPName, ID.DWOName));
530}
531
533 const StringMap<std::pair<MCSection *, DWARFSectionKind>> &KnownSections,
534 const MCSection *StrSection, const MCSection *StrOffsetSection,
535 const MCSection *TypesSection, const MCSection *CUIndexSection,
536 const MCSection *TUIndexSection, const MCSection *InfoSection,
537 const SectionRef &Section, MCStreamer &Out,
538 std::deque<SmallString<32>> &UncompressedSections,
539 uint32_t (&ContributionOffsets)[8], UnitIndexEntry &CurEntry,
540 StringRef &CurStrSection, StringRef &CurStrOffsetSection,
541 std::vector<StringRef> &CurTypesSection,
542 std::vector<StringRef> &CurInfoSection, StringRef &AbbrevSection,
543 StringRef &CurCUIndexSection, StringRef &CurTUIndexSection,
544 std::vector<std::pair<DWARFSectionKind, uint32_t>> &SectionLength) {
545 if (Section.isBSS())
546 return Error::success();
547
548 if (Section.isVirtual())
549 return Error::success();
550
551 Expected<StringRef> NameOrErr = Section.getName();
552 if (!NameOrErr)
553 return NameOrErr.takeError();
554 StringRef Name = *NameOrErr;
555
556 Expected<StringRef> ContentsOrErr = Section.getContents();
557 if (!ContentsOrErr)
558 return ContentsOrErr.takeError();
559 StringRef Contents = *ContentsOrErr;
560
561 if (auto Err = handleCompressedSection(UncompressedSections, Section, Name,
562 Contents))
563 return Err;
564
565 Name = Name.substr(Name.find_first_not_of("._"));
566
567 auto SectionPair = KnownSections.find(Name);
568 if (SectionPair == KnownSections.end())
569 return Error::success();
570
571 if (DWARFSectionKind Kind = SectionPair->second.second) {
572 if (Kind != DW_SECT_EXT_TYPES && Kind != DW_SECT_INFO) {
573 SectionLength.push_back(std::make_pair(Kind, Contents.size()));
574 }
575
576 if (Kind == DW_SECT_ABBREV) {
577 AbbrevSection = Contents;
578 }
579 }
580
581 MCSection *OutSection = SectionPair->second.first;
582 if (OutSection == StrOffsetSection)
583 CurStrOffsetSection = Contents;
584 else if (OutSection == StrSection)
585 CurStrSection = Contents;
586 else if (OutSection == TypesSection)
587 CurTypesSection.push_back(Contents);
588 else if (OutSection == CUIndexSection)
589 CurCUIndexSection = Contents;
590 else if (OutSection == TUIndexSection)
591 CurTUIndexSection = Contents;
592 else if (OutSection == InfoSection)
593 CurInfoSection.push_back(Contents);
594 else {
595 Out.switchSection(OutSection);
596 Out.emitBytes(Contents);
597 }
598 return Error::success();
599}
600
602 OnCuIndexOverflow OverflowOptValue) {
603 const auto &MCOFI = *Out.getContext().getObjectFileInfo();
604 MCSection *const StrSection = MCOFI.getDwarfStrDWOSection();
605 MCSection *const StrOffsetSection = MCOFI.getDwarfStrOffDWOSection();
606 MCSection *const TypesSection = MCOFI.getDwarfTypesDWOSection();
607 MCSection *const CUIndexSection = MCOFI.getDwarfCUIndexSection();
608 MCSection *const TUIndexSection = MCOFI.getDwarfTUIndexSection();
609 MCSection *const InfoSection = MCOFI.getDwarfInfoDWOSection();
611 {"debug_info.dwo", {InfoSection, DW_SECT_INFO}},
612 {"debug_types.dwo", {MCOFI.getDwarfTypesDWOSection(), DW_SECT_EXT_TYPES}},
613 {"debug_str_offsets.dwo", {StrOffsetSection, DW_SECT_STR_OFFSETS}},
614 {"debug_str.dwo", {StrSection, static_cast<DWARFSectionKind>(0)}},
615 {"debug_loc.dwo", {MCOFI.getDwarfLocDWOSection(), DW_SECT_EXT_LOC}},
616 {"debug_line.dwo", {MCOFI.getDwarfLineDWOSection(), DW_SECT_LINE}},
617 {"debug_macro.dwo", {MCOFI.getDwarfMacroDWOSection(), DW_SECT_MACRO}},
618 {"debug_abbrev.dwo", {MCOFI.getDwarfAbbrevDWOSection(), DW_SECT_ABBREV}},
619 {"debug_loclists.dwo",
620 {MCOFI.getDwarfLoclistsDWOSection(), DW_SECT_LOCLISTS}},
621 {"debug_rnglists.dwo",
622 {MCOFI.getDwarfRnglistsDWOSection(), DW_SECT_RNGLISTS}},
623 {"debug_cu_index", {CUIndexSection, static_cast<DWARFSectionKind>(0)}},
624 {"debug_tu_index", {TUIndexSection, static_cast<DWARFSectionKind>(0)}}};
625
628
629 uint32_t ContributionOffsets[8] = {};
630 uint16_t Version = 0;
631 uint32_t IndexVersion = 0;
632 bool AnySectionOverflow = false;
633
634 DWPStringPool Strings(Out, StrSection);
635
637 Objects.reserve(Inputs.size());
638
639 std::deque<SmallString<32>> UncompressedSections;
640
641 for (const auto &Input : Inputs) {
642 auto ErrOrObj = object::ObjectFile::createObjectFile(Input);
643 if (!ErrOrObj) {
644 return handleErrors(ErrOrObj.takeError(),
645 [&](std::unique_ptr<ECError> EC) -> Error {
646 return createFileError(Input, Error(std::move(EC)));
647 });
648 }
649
650 auto &Obj = *ErrOrObj->getBinary();
651 Objects.push_back(std::move(*ErrOrObj));
652
653 UnitIndexEntry CurEntry = {};
654
655 StringRef CurStrSection;
656 StringRef CurStrOffsetSection;
657 std::vector<StringRef> CurTypesSection;
658 std::vector<StringRef> CurInfoSection;
659 StringRef AbbrevSection;
660 StringRef CurCUIndexSection;
661 StringRef CurTUIndexSection;
662
663 // This maps each section contained in this file to its length.
664 // This information is later on used to calculate the contributions,
665 // i.e. offset and length, of each compile/type unit to a section.
666 std::vector<std::pair<DWARFSectionKind, uint32_t>> SectionLength;
667
668 for (const auto &Section : Obj.sections())
669 if (auto Err = handleSection(
670 KnownSections, StrSection, StrOffsetSection, TypesSection,
671 CUIndexSection, TUIndexSection, InfoSection, Section, Out,
672 UncompressedSections, ContributionOffsets, CurEntry,
673 CurStrSection, CurStrOffsetSection, CurTypesSection,
674 CurInfoSection, AbbrevSection, CurCUIndexSection,
675 CurTUIndexSection, SectionLength))
676 return Err;
677
678 if (CurInfoSection.empty())
679 continue;
680
682 parseInfoSectionUnitHeader(CurInfoSection.front());
683 if (!HeaderOrErr)
684 return HeaderOrErr.takeError();
685 InfoSectionUnitHeader &Header = *HeaderOrErr;
686
687 if (Version == 0) {
688 Version = Header.Version;
689 IndexVersion = Version < 5 ? 2 : 5;
690 } else if (Version != Header.Version) {
691 return make_error<DWPError>("incompatible DWARF compile unit versions.");
692 }
693
694 writeStringsAndOffsets(Out, Strings, StrOffsetSection, CurStrSection,
695 CurStrOffsetSection, Header.Version);
696
697 for (auto Pair : SectionLength) {
698 auto Index = getContributionIndex(Pair.first, IndexVersion);
699 CurEntry.Contributions[Index].setOffset(ContributionOffsets[Index]);
700 CurEntry.Contributions[Index].setLength(Pair.second);
701 uint32_t OldOffset = ContributionOffsets[Index];
702 ContributionOffsets[Index] += CurEntry.Contributions[Index].getLength32();
703 if (OldOffset > ContributionOffsets[Index]) {
704 uint32_t SectionIndex = 0;
705 for (auto &Section : Obj.sections()) {
706 if (SectionIndex == Index) {
708 OldOffset, ContributionOffsets[Index], *Section.getName(),
709 OverflowOptValue, AnySectionOverflow))
710 return Err;
711 }
712 ++SectionIndex;
713 }
714 if (AnySectionOverflow)
715 break;
716 }
717 }
718
719 uint32_t &InfoSectionOffset =
720 ContributionOffsets[getContributionIndex(DW_SECT_INFO, IndexVersion)];
721 if (CurCUIndexSection.empty()) {
722 bool FoundCUUnit = false;
723 Out.switchSection(InfoSection);
724 for (StringRef Info : CurInfoSection) {
725 uint64_t UnitOffset = 0;
726 while (Info.size() > UnitOffset) {
727 Expected<InfoSectionUnitHeader> HeaderOrError =
728 parseInfoSectionUnitHeader(Info.substr(UnitOffset, Info.size()));
729 if (!HeaderOrError)
730 return HeaderOrError.takeError();
731 InfoSectionUnitHeader &Header = *HeaderOrError;
732
733 UnitIndexEntry Entry = CurEntry;
734 auto &C = Entry.Contributions[getContributionIndex(DW_SECT_INFO,
735 IndexVersion)];
736 C.setOffset(InfoSectionOffset);
737 C.setLength(Header.Length + 4);
738
739 if (std::numeric_limits<uint32_t>::max() - InfoSectionOffset <
740 C.getLength32()) {
742 InfoSectionOffset, InfoSectionOffset + C.getLength32(),
743 "debug_info", OverflowOptValue, AnySectionOverflow))
744 return Err;
745 if (AnySectionOverflow) {
746 if (Header.Version < 5 ||
747 Header.UnitType == dwarf::DW_UT_split_compile)
748 FoundCUUnit = true;
749 break;
750 }
751 }
752
753 UnitOffset += C.getLength32();
754 if (Header.Version < 5 ||
755 Header.UnitType == dwarf::DW_UT_split_compile) {
757 Header, AbbrevSection,
758 Info.substr(UnitOffset - C.getLength32(), C.getLength32()),
759 CurStrOffsetSection, CurStrSection);
760
761 if (!EID)
762 return createFileError(Input, EID.takeError());
763 const auto &ID = *EID;
764 auto P = IndexEntries.insert(std::make_pair(ID.Signature, Entry));
765 if (!P.second)
766 return buildDuplicateError(*P.first, ID, "");
767 P.first->second.Name = ID.Name;
768 P.first->second.DWOName = ID.DWOName;
769
770 FoundCUUnit = true;
771 } else if (Header.UnitType == dwarf::DW_UT_split_type) {
772 auto P = TypeIndexEntries.insert(
773 std::make_pair(*Header.Signature, Entry));
774 if (!P.second)
775 continue;
776 }
777 Out.emitBytes(
778 Info.substr(UnitOffset - C.getLength32(), C.getLength32()));
779 InfoSectionOffset += C.getLength32();
780 }
781 if (AnySectionOverflow)
782 break;
783 }
784
785 if (!FoundCUUnit)
786 return make_error<DWPError>("no compile unit found in file: " + Input);
787
788 if (IndexVersion == 2) {
789 // Add types from the .debug_types section from DWARF < 5.
791 Out, TypeIndexEntries, TypesSection, CurTypesSection, CurEntry,
792 ContributionOffsets[getContributionIndex(DW_SECT_EXT_TYPES, 2)],
793 OverflowOptValue, AnySectionOverflow))
794 return Err;
795 }
796 if (AnySectionOverflow)
797 break;
798 continue;
799 }
800
801 if (CurInfoSection.size() != 1)
802 return make_error<DWPError>("expected exactly one occurrence of a debug "
803 "info section in a .dwp file");
804 StringRef DwpSingleInfoSection = CurInfoSection.front();
805
806 DWARFUnitIndex CUIndex(DW_SECT_INFO);
807 DataExtractor CUIndexData(CurCUIndexSection, Obj.isLittleEndian(), 0);
808 if (!CUIndex.parse(CUIndexData))
809 return make_error<DWPError>("failed to parse cu_index");
810 if (CUIndex.getVersion() != IndexVersion)
811 return make_error<DWPError>("incompatible cu_index versions, found " +
812 utostr(CUIndex.getVersion()) +
813 " and expecting " + utostr(IndexVersion));
814
815 Out.switchSection(InfoSection);
816 for (const DWARFUnitIndex::Entry &E : CUIndex.getRows()) {
817 auto *I = E.getContributions();
818 if (!I)
819 continue;
820 auto P = IndexEntries.insert(std::make_pair(E.getSignature(), CurEntry));
821 StringRef CUInfoSection =
822 getSubsection(DwpSingleInfoSection, E, DW_SECT_INFO);
823 Expected<InfoSectionUnitHeader> HeaderOrError =
824 parseInfoSectionUnitHeader(CUInfoSection);
825 if (!HeaderOrError)
826 return HeaderOrError.takeError();
827 InfoSectionUnitHeader &Header = *HeaderOrError;
828
830 Header, getSubsection(AbbrevSection, E, DW_SECT_ABBREV),
831 CUInfoSection,
832 getSubsection(CurStrOffsetSection, E, DW_SECT_STR_OFFSETS),
833 CurStrSection);
834 if (!EID)
835 return createFileError(Input, EID.takeError());
836 const auto &ID = *EID;
837 if (!P.second)
838 return buildDuplicateError(*P.first, ID, Input);
839 auto &NewEntry = P.first->second;
840 NewEntry.Name = ID.Name;
841 NewEntry.DWOName = ID.DWOName;
842 NewEntry.DWPName = Input;
843 for (auto Kind : CUIndex.getColumnKinds()) {
845 continue;
846 auto &C =
847 NewEntry.Contributions[getContributionIndex(Kind, IndexVersion)];
848 C.setOffset(C.getOffset() + I->getOffset());
849 C.setLength(I->getLength());
850 ++I;
851 }
852 unsigned Index = getContributionIndex(DW_SECT_INFO, IndexVersion);
853 auto &C = NewEntry.Contributions[Index];
854 Out.emitBytes(CUInfoSection);
855 C.setOffset(InfoSectionOffset);
856 InfoSectionOffset += C.getLength32();
857 }
858
859 if (!CurTUIndexSection.empty()) {
860 llvm::DWARFSectionKind TUSectionKind;
861 MCSection *OutSection;
862 StringRef TypeInputSection;
863 // Write type units into debug info section for DWARFv5.
864 if (Version >= 5) {
865 TUSectionKind = DW_SECT_INFO;
866 OutSection = InfoSection;
867 TypeInputSection = DwpSingleInfoSection;
868 } else {
869 // Write type units into debug types section for DWARF < 5.
870 if (CurTypesSection.size() != 1)
871 return make_error<DWPError>(
872 "multiple type unit sections in .dwp file");
873
874 TUSectionKind = DW_SECT_EXT_TYPES;
875 OutSection = TypesSection;
876 TypeInputSection = CurTypesSection.front();
877 }
878
879 DWARFUnitIndex TUIndex(TUSectionKind);
880 DataExtractor TUIndexData(CurTUIndexSection, Obj.isLittleEndian(), 0);
881 if (!TUIndex.parse(TUIndexData))
882 return make_error<DWPError>("failed to parse tu_index");
883 if (TUIndex.getVersion() != IndexVersion)
884 return make_error<DWPError>("incompatible tu_index versions, found " +
885 utostr(TUIndex.getVersion()) +
886 " and expecting " + utostr(IndexVersion));
887
888 unsigned TypesContributionIndex =
889 getContributionIndex(TUSectionKind, IndexVersion);
890 if (Error Err = addAllTypesFromDWP(
891 Out, TypeIndexEntries, TUIndex, OutSection, TypeInputSection,
892 CurEntry, ContributionOffsets[TypesContributionIndex],
893 TypesContributionIndex, OverflowOptValue, AnySectionOverflow))
894 return Err;
895 }
896 if (AnySectionOverflow)
897 break;
898 }
899
900 if (Version < 5) {
901 // Lie about there being no info contributions so the TU index only includes
902 // the type unit contribution for DWARF < 5. In DWARFv5 the TU index has a
903 // contribution to the info section, so we do not want to lie about it.
904 ContributionOffsets[0] = 0;
905 }
906 writeIndex(Out, MCOFI.getDwarfTUIndexSection(), ContributionOffsets,
907 TypeIndexEntries, IndexVersion);
908
909 if (Version < 5) {
910 // Lie about the type contribution for DWARF < 5. In DWARFv5 the type
911 // section does not exist, so no need to do anything about this.
912 ContributionOffsets[getContributionIndex(DW_SECT_EXT_TYPES, 2)] = 0;
913 // Unlie about the info contribution
914 ContributionOffsets[0] = 1;
915 }
916
917 writeIndex(Out, MCOFI.getDwarfCUIndexSection(), ContributionOffsets,
918 IndexEntries, IndexVersion);
919
920 return Error::success();
921}
922} // namespace llvm
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
static uint64_t getCUAbbrev(StringRef Abbrev, uint64_t AbbrCode)
Definition: DWP.cpp:42
static Error handleCompressedSection(std::deque< SmallString< 32 > > &UncompressedSections, SectionRef Sec, StringRef Name, StringRef &Contents)
Definition: DWP.cpp:335
static std::string buildDWODescription(StringRef Name, StringRef DWPName, StringRef DWOName)
Definition: DWP.cpp:301
static uint64_t debugStrOffsetsHeaderSize(DataExtractor StrOffsetsData, uint16_t DwarfVersion)
Definition: DWP.cpp:31
static Expected< const char * > getIndexedString(dwarf::Form Form, DataExtractor InfoData, uint64_t &InfoOffset, StringRef StrOffsets, StringRef Str, uint16_t Version)
Definition: DWP.cpp:58
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)
Definition: DWP.cpp:254
static unsigned getOnDiskSectionId(unsigned Index)
Definition: DWP.cpp:170
static Expected< CompileUnitIdentifiers > getCUIdentifiers(InfoSectionUnitHeader &Header, StringRef Abbrev, StringRef Info, StringRef StrOffsets, StringRef Str)
Definition: DWP.cpp:96
static Error sectionOverflowErrorOrWarning(uint32_t PrevOffset, uint32_t OverflowedOffset, StringRef SectionName, OnCuIndexOverflow OverflowOptValue, bool &AnySectionOverflow)
Definition: DWP.cpp:183
static mc::RegisterMCTargetOptionsFlags MCTargetOptionsFlags
Definition: DWP.cpp:28
static StringRef getSubsection(StringRef Section, const DWARFUnitIndex::Entry &Entry, DWARFSectionKind Kind)
Definition: DWP.cpp:174
static Error createError(StringRef Name, Error E)
Definition: DWP.cpp:327
static bool isSupportedSectionKind(DWARFSectionKind Kind)
Definition: DWP.cpp:155
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)
Definition: DWP.cpp:205
std::string Name
uint64_t Size
#define I(x, y, z)
Definition: MD5.cpp:58
#define H(x, y, z)
Definition: MD5.cpp:57
#define P(N)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static uint32_t getFlags(const Symbol *Sym)
Definition: TapiFile.cpp:27
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
size_t size() const
size - Get the array size.
Definition: ArrayRef.h:165
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.
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.
Definition: Error.h:160
static ErrorSuccess success()
Create a success value.
Definition: Error.h:334
Tagged union holding either a T or a Error.
Definition: Error.h:474
Error takeError()
Take ownership of the stored error.
Definition: Error.h:601
const MCObjectFileInfo * getObjectFileInfo() const
Definition: MCContext.h:450
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition: MCSection.h:39
Streaming machine code generation interface.
Definition: MCStreamer.h:212
MCContext & getContext() const
Definition: MCStreamer.h:297
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.
Definition: MCStreamer.cpp:134
virtual void switchSection(MCSection *Section, const MCExpr *Subsection=nullptr)
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.
Definition: MapVector.h:36
bool empty() const
Definition: MapVector.h:79
iterator begin()
Definition: MapVector.h:69
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
Definition: MapVector.h:141
size_type size() const
Definition: MapVector.h:60
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition: SmallString.h:26
void reserve(size_type N)
Definition: SmallVector.h:676
void push_back(const T &Elt)
Definition: SmallVector.h:426
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1209
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:128
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
constexpr bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:134
char back() const
back - Get the last character in the string.
Definition: StringRef.h:146
constexpr size_t size() const
size - Get the string size.
Definition: StringRef.h:137
char front() const
front - Get the first character in the string.
Definition: StringRef.h:140
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
static void defaultWarningHandler(Error Warning)
Implement default handling for Warning.
Definition: WithColor.cpp:164
static Expected< Decompressor > create(StringRef Name, StringRef Data, bool IsLE, bool Is64Bit)
Create decompressor object.
static Expected< OwningBinary< ObjectFile > > createObjectFile(StringRef ObjectPath)
Definition: ObjectFile.cpp:209
This is a value type class that represents a single section in the list of sections in the object fil...
Definition: ObjectFile.h:81
const ObjectFile * getObject() const
Definition: ObjectFile.h:601
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
@ C
The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34
@ SHF_COMPRESSED
Definition: ELF.h:1183
std::optional< const char * > toString(const std::optional< DWARFFormValue > &V)
Take an optional DWARFFormValue and try to extract a string value from it.
@ DW_LENGTH_DWARF64
Indicator of 64-bit DWARF format.
Definition: Dwarf.h:55
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
AccessField
Definition: DWP.cpp:456
@ Offset
Definition: DWP.cpp:456
@ Length
Definition: DWP.cpp:456
Error createFileError(const Twine &F, Error E)
Concatenate a source file path and/or name with an Error.
Definition: Error.h:1325
Error buildDuplicateError(const std::pair< uint64_t, UnitIndexEntry > &PrevE, const CompileUnitIdentifiers &ID, StringRef DWPName)
Definition: DWP.cpp:523
void writeIndex(MCStreamer &Out, MCSection *Section, ArrayRef< unsigned > ContributionOffsets, const MapVector< uint64_t, UnitIndexEntry > &IndexEntries, uint32_t IndexVersion)
Definition: DWP.cpp:469
Error handleErrors(Error E, HandlerTs &&... Hs)
Pass the ErrorInfo(s) contained in E to their respective handlers.
Definition: Error.h:947
void writeStringsAndOffsets(MCStreamer &Out, DWPStringPool &Strings, MCSection *StrOffsetSection, StringRef CurStrSection, StringRef CurStrOffsetSection, uint16_t Version)
Definition: DWP.cpp:418
DWARFSectionKind
The enum of section identifiers to be used in internal interfaces.
@ DW_SECT_EXT_LOC
@ DW_SECT_EXT_unknown
Denotes a value read from an index section that does not correspond to any of the supported standards...
@ DW_SECT_EXT_TYPES
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)
Definition: DWP.cpp:601
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)
Definition: DWP.cpp:532
void writeIndexTable(MCStreamer &Out, ArrayRef< unsigned > ContributionOffsets, const MapVector< uint64_t, UnitIndexEntry > &IndexEntries, const AccessField &Field)
Definition: DWP.cpp:457
unsigned getContributionIndex(DWARFSectionKind Kind, uint32_t IndexVersion)
Definition: DWP.cpp:162
Expected< InfoSectionUnitHeader > parseInfoSectionUnitHeader(StringRef Info)
Definition: DWP.cpp:359
OnCuIndexOverflow
Definition: DWP.h:18
constexpr uint64_t NextPowerOf2(uint64_t A)
Returns the next power of two (in 64-bits) that is strictly greater than A.
Definition: MathExtras.h:349
DWARFUnitIndex::Entry::SectionContribution Contributions[8]
Definition: DWP.h:25
A helper struct providing information about the byte size of DW_FORM values that vary in size dependi...
Definition: Dwarf.h:762
Create this object with static storage to register mc-related command line options.