9#ifndef LLVM_LIB_DWARFLINKERPARALLEL_OUTPUTSECTIONS_H
10#define LLVM_LIB_DWARFLINKERPARALLEL_OUTPUTSECTIONS_H
32namespace dwarflinker_parallel {
106 bool AddLocalValue =
false)
192 ListDebugLineStrPatch(&
GlobalData.getAllocator()),
193 ListDebugRangePatch(&
GlobalData.getAllocator()),
194 ListDebugLocPatch(&
GlobalData.getAllocator()),
195 ListDebugDieRefPatch(&
GlobalData.getAllocator()),
196 ListDebugULEB128DieRefPatch(&
GlobalData.getAllocator()),
197 ListDebugOffsetPatch(&
GlobalData.getAllocator()),
198 ListDebugDieTypeRefPatch(&
GlobalData.getAllocator()),
199 ListDebugType2TypeDieRefPatch(&
GlobalData.getAllocator()),
200 ListDebugTypeStrPatch(&
GlobalData.getAllocator()),
201 ListDebugTypeLineStrPatch(&
GlobalData.getAllocator()),
202 ListDebugTypeDeclFilePatch(&
GlobalData.getAllocator()),
222#define ADD_PATCHES_LIST(T) \
223 T ¬ePatch(const T &Patch) { return List##T.add(Patch); } \
224 ArrayList<T> List##T;
243 template <
typename T>
246 PatchesOffsetsList.
emplace_back(¬ePatch(Patch).PatchOffset);
397 std::optional<const SectionDescriptor *>
409 std::optional<SectionDescriptor *>
431 Section.second.clearAllSectionData();
437 Handler(Section.second);
444 std::array<uint64_t, SectionKindsNum> &SectionSizesAccumulator) {
446 Section.second.StartOffset = SectionSizesAccumulator[
static_cast<uint8_t
>(
447 Section.second.getKind())];
448 SectionSizesAccumulator[
static_cast<uint8_t
>(Section.second.getKind())] +=
449 Section.second.getContents().size();
This file contains constants used for implementing Dwarf debug support.
#define ADD_PATCHES_LIST(T)
Section patches.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallString class.
A structured debug information entry.
PointerIntPair - This class implements a pair of a pointer and small integer.
SectionKind - This is a simple POD value that classifies the properties of a section.
StringRef slice(size_t Start, size_t End) const
Return a reference to the substring from [Start, End).
reference emplace_back(ArgTypes &&... Args)
pointer data()
Return a pointer to the vector's buffer, even if empty().
A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs...
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
StringRef - Represent a constant reference to a string, i.e.
Stores all information related to a compile unit, be it in its original instance of the object file o...
This class keeps data and services common for the whole linking process.
StringRef translateString(StringRef String)
Translate specified string.
This class keeps contents and offsets to the debug sections.
uint16_t getVersion() const
Return DWARF version.
void assignSectionsOffsetAndAccumulateSize(std::array< uint64_t, SectionKindsNum > &SectionSizesAccumulator)
Enumerate all sections, for each section set current offset (kept by SectionSizesAccumulator),...
uint16_t getDebugStrOffsetsHeaderSize() const
Return size of header of debug_str_offsets table.
void forEach(function_ref< void(SectionDescriptor &)> Handler)
Enumerate all sections and call Handler for each.
uint16_t getDebugAddrHeaderSize() const
Return size of header of debug_ table.
void setOutputFormat(dwarf::FormParams Format, llvm::endianness Endianness)
Sets output format for all keeping sections.
SectionsSetTy SectionDescriptors
void applyPatches(SectionDescriptor &Section, StringEntryToDwarfStringPoolEntryMap &DebugStrStrings, StringEntryToDwarfStringPoolEntryMap &DebugLineStrStrings, TypeUnit *TypeUnitPtr)
Enumerate all sections, for each section apply all section patches.
void eraseSections()
Erases data of all sections.
LinkingGlobalData & GlobalData
std::map< DebugSectionKind, SectionDescriptor > SectionsSetTy
All keeping sections.
std::optional< SectionDescriptor * > tryGetSectionDescriptor(DebugSectionKind SectionKind)
Returns descriptor for the specified section of SectionKind.
const SectionDescriptor & getSectionDescriptor(DebugSectionKind SectionKind) const
Returns descriptor for the specified section of SectionKind.
SectionDescriptor & getSectionDescriptor(DebugSectionKind SectionKind)
Returns descriptor for the specified section of SectionKind.
llvm::endianness Endianness
Endiannes for sections.
llvm::endianness getEndianness() const
Endiannes for the sections.
OutputSections(LinkingGlobalData &GlobalData)
const dwarf::FormParams & getFormParams() const
Return size of address.
SectionDescriptor & getOrCreateSectionDescriptor(DebugSectionKind SectionKind)
Returns descriptor for the specified section of SectionKind.
uint16_t getDebugInfoHeaderSize() const
Return size of header of debug_info table.
dwarf::FormParams Format
Format for sections.
std::optional< const SectionDescriptor * > tryGetSectionDescriptor(DebugSectionKind SectionKind) const
Returns descriptor for the specified section of SectionKind.
This class creates a DwarfStringPoolEntry for the corresponding StringEntry.
Type Unit is used to represent an artificial compilation unit which keeps all type information.
An efficient, type-erasing, non-owning reference to a callable.
A raw_ostream that writes to an SmallVector or SmallString.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
uint8_t getDwarfOffsetByteSize(DwarfFormat Format)
The size of a reference determined by the DWARF 32/64-bit format.
@ DW_LENGTH_DWARF64
Indicator of 64-bit DWARF format.
std::optional< DebugSectionKind > parseDebugTableName(llvm::StringRef SecName)
Recognise the table name and match it with the DebugSectionKind.
DebugSectionKind
List of tracked debug tables.
static constexpr size_t SectionKindsNum
const StringLiteral & getSectionName(DebugSectionKind SectionKind)
Return the name of the section.
This is an optimization pass for GlobalISel generic memory operations.
auto formatv(const char *Fmt, Ts &&... Vals) -> formatv_object< decltype(std::make_tuple(detail::build_format_adapter(std::forward< Ts >(Vals))...))>
SmallVectorImpl< T >::const_pointer c_str(SmallVectorImpl< T > &str)
This structure is used to update reference to the DIE.
PointerIntPair< CompileUnit *, 1 > RefCU
uint64_t RefDieIdxOrClonedOffset
This structure is used to update reference to the type DIE.
This structure is used to update strings offsets into .debug_line_str.
const StringEntry * String
This structure is used to update location list offset into .debug_loc/.debug_loclists.
int64_t AddrAdjustmentValue
PointerIntPair< SectionDescriptor *, 1 > SectionPtr
DebugOffsetPatch(uint64_t PatchOffset, SectionDescriptor *SectionPtr, bool AddLocalValue=false)
This structure is used to update range list offset into .debug_ranges/.debug_rnglists.
bool IsCompileUnitRanges
Indicates patch which points to immediate compile unit's attribute.
This structure is used to update strings offsets into .debug_str.
const StringEntry * String
This structure is used to update reference to the type DIE.
This structure is used to update reference to the DIE of ULEB128 form.
PointerIntPair< CompileUnit *, 1 > RefCU
uint64_t RefDieIdxOrClonedOffset
This structure is used to keep data of the concrete section.
DebugSectionKind SectionKind
The section kind.
void clearSectionContent()
Erase only section output data bits.
uint64_t getIntVal(uint64_t PatchOffset, unsigned Size)
Returns integer value of Size located by specified PatchOffset.
void emitInplaceString(StringRef String)
Emit specified inplace string value into the current section contents.
void notePatchWithOffsetUpdate(const T &Patch, OffsetsPtrVector &PatchesOffsetsList)
While creating patches, offsets to attributes may be partially unknown(because size of abbreviation n...
void emitOffset(uint64_t Val)
Emit specified offset value into the current section contents.
void emitString(dwarf::Form StringForm, const char *StringVal)
void applySLEB128(uint64_t PatchOffset, uint64_t Val)
Writes integer value Val of SLEB128 format by specified PatchOffset.
void applyULEB128(uint64_t PatchOffset, uint64_t Val)
Writes integer value Val of ULEB128 format by specified PatchOffset.
size_t SectionOffsetInsideAsmPrinterOutputEnd
uint64_t StartOffset
When objects(f.e.
OutSectionDataTy Contents
Section data bits.
llvm::endianness Endianess
SectionDescriptor(DebugSectionKind SectionKind, LinkingGlobalData &GlobalData, dwarf::FormParams Format, llvm::endianness Endianess)
raw_svector_ostream OS
Stream which stores data to the Contents.
dwarf::FormParams Format
Output format.
llvm::endianness getEndianess() const
Returns endianess used by section.
void emitIntVal(uint64_t Val, unsigned Size)
Emit specified integer value into the current section contents.
size_t SectionOffsetInsideAsmPrinterOutputStart
Some sections are generated using AsmPrinter.
DebugSectionKind getKind()
Returns section kind.
void emitUnitLength(uint64_t Length)
Emit unit length into the current section contents.
dwarf::FormParams getFormParams() const
Returns FormParams used by section.
void apply(uint64_t PatchOffset, dwarf::Form AttrForm, uint64_t Val)
Write specified Value of AttrForm to the PatchOffset.
const StringLiteral & getName() const
Returns section name.
void applyIntVal(uint64_t PatchOffset, uint64_t Val, unsigned Size)
Writes integer value Val of Size by specified PatchOffset.
LinkingGlobalData & GlobalData
void maybeEmitDwarf64Mark()
Emit DWARF64 mark into the current section contents.
void setSizesForSectionCreatedByAsmPrinter()
Some sections are emitted using AsmPrinter.
StringRef getContents()
Returns section content.
void clearAllSectionData()
Erase whole section contents(data bits, list of patches).
void emitStringPlaceholder()
Emit string placeholder into the current section contents.
void setOutputFormat(dwarf::FormParams Format, llvm::endianness Endianess)
Sets output format.
There are fields(sizes, offsets) which should be updated after sections are generated.