LLVM 19.0.0git
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
llvm::dwarf_linker::parallel::SectionDescriptor Struct Reference

This structure is used to keep data of the concrete section. More...

#include "DWARFLinker/Parallel/OutputSections.h"

Inheritance diagram for llvm::dwarf_linker::parallel::SectionDescriptor:
Inheritance graph
[legend]

Public Member Functions

 SectionDescriptor (DebugSectionKind SectionKind, LinkingGlobalData &GlobalData, dwarf::FormParams Format, llvm::endianness Endianess)
 
void clearAllSectionData ()
 Erase whole section content(data bits, list of patches).
 
void clearSectionContent ()
 Erase only section output data bits.
 
template<typename T >
void notePatchWithOffsetUpdate (const T &Patch, OffsetsPtrVector &PatchesOffsetsList)
 While creating patches, offsets to attributes may be partially unknown(because size of abbreviation number is unknown).
 
void setSizesForSectionCreatedByAsmPrinter ()
 Some sections are emitted using AsmPrinter.
 
StringRef getContents () override
 Returns section content.
 
void emitUnitLength (uint64_t Length)
 Emit unit length into the current section contents.
 
void maybeEmitDwarf64Mark ()
 Emit DWARF64 mark into the current section contents.
 
void emitOffset (uint64_t Val)
 Emit specified offset value into the current section contents.
 
void emitIntVal (uint64_t Val, unsigned Size)
 Emit specified integer value into the current section contents.
 
void emitString (dwarf::Form StringForm, const char *StringVal)
 
void emitBinaryData (llvm::StringRef Data)
 
void emitInplaceString (StringRef String)
 Emit specified inplace string value into the current section contents.
 
void emitStringPlaceholder ()
 Emit string placeholder into the current section contents.
 
void apply (uint64_t PatchOffset, dwarf::Form AttrForm, uint64_t Val)
 Write specified Value of AttrForm to the PatchOffset.
 
uint64_t getIntVal (uint64_t PatchOffset, unsigned Size)
 Returns integer value of Size located by specified PatchOffset.
 
- Public Member Functions inherited from llvm::dwarf_linker::parallel::SectionDescriptorBase
 SectionDescriptorBase (DebugSectionKind SectionKind, dwarf::FormParams Format, llvm::endianness Endianess)
 
virtual ~SectionDescriptorBase ()=default
 
virtual StringRef getContents ()=0
 Returns section content.
 
DebugSectionKind getKind ()
 Returns section kind.
 
const StringLiteralgetName () const
 Returns section name.
 
llvm::endianness getEndianess () const
 Returns endianess used by section.
 
dwarf::FormParams getFormParams () const
 Returns FormParams used by section.
 

Public Attributes

friend OutputSections
 
uint64_t StartOffset = 0
 When objects(f.e.
 
raw_svector_ostream OS
 Stream which stores data to the Contents.
 

Protected Member Functions

void applyIntVal (uint64_t PatchOffset, uint64_t Val, unsigned Size)
 Writes integer value Val of Size by specified PatchOffset.
 
void applyULEB128 (uint64_t PatchOffset, uint64_t Val)
 Writes integer value Val of ULEB128 format by specified PatchOffset.
 
void applySLEB128 (uint64_t PatchOffset, uint64_t Val)
 Writes integer value Val of SLEB128 format by specified PatchOffset.
 
void setOutputFormat (dwarf::FormParams Format, llvm::endianness Endianess)
 Sets output format.
 

Protected Attributes

LinkingGlobalDataGlobalData
 
OutSectionDataTy Contents
 Section data bits.
 
size_t SectionOffsetInsideAsmPrinterOutputStart = 0
 Some sections are generated using AsmPrinter.
 
size_t SectionOffsetInsideAsmPrinterOutputEnd = 0
 
- Protected Attributes inherited from llvm::dwarf_linker::parallel::SectionDescriptorBase
DebugSectionKind SectionKind = DebugSectionKind::NumberOfEnumEntries
 The section kind.
 
dwarf::FormParams Format = {4, 4, dwarf::DWARF32}
 Output format.
 
llvm::endianness Endianess = llvm::endianness::little
 

Detailed Description

This structure is used to keep data of the concrete section.

Like data bits, list of patches, format.

Definition at line 152 of file OutputSections.h.

Constructor & Destructor Documentation

◆ SectionDescriptor()

llvm::dwarf_linker::parallel::SectionDescriptor::SectionDescriptor ( DebugSectionKind  SectionKind,
LinkingGlobalData GlobalData,
dwarf::FormParams  Format,
llvm::endianness  Endianess 
)
inline

Definition at line 155 of file OutputSections.h.

Member Function Documentation

◆ apply()

void SectionDescriptor::apply ( uint64_t  PatchOffset,
dwarf::Form  AttrForm,
uint64_t  Val 
)

◆ applyIntVal()

void SectionDescriptor::applyIntVal ( uint64_t  PatchOffset,
uint64_t  Val,
unsigned  Size 
)
protected

Writes integer value Val of Size by specified PatchOffset.

Definition at line 250 of file OutputSections.cpp.

References assert(), llvm::dwarf_linker::parallel::SectionDescriptorBase::Endianess, getContents(), llvm_unreachable, llvm::size(), Size, and llvm::support::endian::write().

Referenced by apply().

◆ applySLEB128()

void SectionDescriptor::applySLEB128 ( uint64_t  PatchOffset,
uint64_t  Val 
)
protected

Writes integer value Val of SLEB128 format by specified PatchOffset.

Definition at line 292 of file OutputSections.cpp.

References assert(), llvm::encodeSLEB128(), llvm::dwarf_linker::parallel::SectionDescriptorBase::Format, getContents(), llvm::dwarf::FormParams::getDwarfOffsetByteSize(), and llvm::size().

Referenced by apply().

◆ applyULEB128()

void SectionDescriptor::applyULEB128 ( uint64_t  PatchOffset,
uint64_t  Val 
)
protected

Writes integer value Val of ULEB128 format by specified PatchOffset.

Definition at line 280 of file OutputSections.cpp.

References assert(), llvm::encodeULEB128(), llvm::dwarf_linker::parallel::SectionDescriptorBase::Format, getContents(), llvm::dwarf::FormParams::getDwarfOffsetByteSize(), and llvm::size().

Referenced by apply().

◆ clearAllSectionData()

void SectionDescriptor::clearAllSectionData ( )

Erase whole section content(data bits, list of patches).

Definition at line 60 of file OutputSections.cpp.

References clearSectionContent(), and StartOffset.

◆ clearSectionContent()

void SectionDescriptor::clearSectionContent ( )

Erase only section output data bits.

Definition at line 76 of file OutputSections.cpp.

References Contents.

Referenced by clearAllSectionData().

◆ emitBinaryData()

void SectionDescriptor::emitBinaryData ( llvm::StringRef  Data)

Definition at line 167 of file OutputSections.cpp.

References llvm::Data, OS, and llvm::raw_ostream::write().

◆ emitInplaceString()

void llvm::dwarf_linker::parallel::SectionDescriptor::emitInplaceString ( StringRef  String)
inline

Emit specified inplace string value into the current section contents.

Definition at line 255 of file OutputSections.h.

References emitIntVal(), OS, and llvm::String.

Referenced by llvm::dwarf_linker::parallel::DwarfUnit::emitPubAcceleratorEntry(), emitString(), and llvm::dwarf_linker::parallel::DWARFLinkerImpl::emitStringSections().

◆ emitIntVal()

void SectionDescriptor::emitIntVal ( uint64_t  Val,
unsigned  Size 
)

◆ emitOffset()

void llvm::dwarf_linker::parallel::SectionDescriptor::emitOffset ( uint64_t  Val)
inline

◆ emitString()

void SectionDescriptor::emitString ( dwarf::Form  StringForm,
const char StringVal 
)

◆ emitStringPlaceholder()

void llvm::dwarf_linker::parallel::SectionDescriptor::emitStringPlaceholder ( )
inline

Emit string placeholder into the current section contents.

Definition at line 261 of file OutputSections.h.

References emitOffset().

Referenced by emitString().

◆ emitUnitLength()

void llvm::dwarf_linker::parallel::SectionDescriptor::emitUnitLength ( uint64_t  Length)
inline

◆ getContents()

StringRef llvm::dwarf_linker::parallel::SectionDescriptor::getContents ( )
inlineoverridevirtual

◆ getIntVal()

uint64_t SectionDescriptor::getIntVal ( uint64_t  PatchOffset,
unsigned  Size 
)

◆ maybeEmitDwarf64Mark()

void llvm::dwarf_linker::parallel::SectionDescriptor::maybeEmitDwarf64Mark ( )
inline

◆ notePatchWithOffsetUpdate()

template<typename T >
void llvm::dwarf_linker::parallel::SectionDescriptor::notePatchWithOffsetUpdate ( const T Patch,
OffsetsPtrVector PatchesOffsetsList 
)
inline

While creating patches, offsets to attributes may be partially unknown(because size of abbreviation number is unknown).

In such case we remember patch itself and pointer to patch application offset to add size of abbreviation number later.

Definition at line 210 of file OutputSections.h.

References llvm::SmallVectorImpl< T >::emplace_back().

Referenced by llvm::dwarf_linker::parallel::DIEAttributeCloner::clone(), llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneDieRefAttr(), llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneScalarAttr(), llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneStringAttr(), and llvm::dwarf_linker::parallel::TypeUnit::createDIETree().

◆ setOutputFormat()

void llvm::dwarf_linker::parallel::SectionDescriptor::setOutputFormat ( dwarf::FormParams  Format,
llvm::endianness  Endianess 
)
inlineprotected

◆ setSizesForSectionCreatedByAsmPrinter()

void SectionDescriptor::setSizesForSectionCreatedByAsmPrinter ( )

Member Data Documentation

◆ Contents

OutSectionDataTy llvm::dwarf_linker::parallel::SectionDescriptor::Contents
protected

Section data bits.

Definition at line 291 of file OutputSections.h.

Referenced by clearSectionContent(), getContents(), and setSizesForSectionCreatedByAsmPrinter().

◆ GlobalData

LinkingGlobalData& llvm::dwarf_linker::parallel::SectionDescriptor::GlobalData
protected

Definition at line 288 of file OutputSections.h.

Referenced by emitString().

◆ OS

raw_svector_ostream llvm::dwarf_linker::parallel::SectionDescriptor::OS

◆ OutputSections

friend llvm::dwarf_linker::parallel::SectionDescriptor::OutputSections

Definition at line 153 of file OutputSections.h.

◆ SectionOffsetInsideAsmPrinterOutputEnd

size_t llvm::dwarf_linker::parallel::SectionDescriptor::SectionOffsetInsideAsmPrinterOutputEnd = 0
protected

Definition at line 297 of file OutputSections.h.

Referenced by getContents(), and setSizesForSectionCreatedByAsmPrinter().

◆ SectionOffsetInsideAsmPrinterOutputStart

size_t llvm::dwarf_linker::parallel::SectionDescriptor::SectionOffsetInsideAsmPrinterOutputStart = 0
protected

Some sections are generated using AsmPrinter.

The real section data located inside elf file in that case. Following fields points to the real section content inside elf file.

Definition at line 296 of file OutputSections.h.

Referenced by getContents(), and setSizesForSectionCreatedByAsmPrinter().

◆ StartOffset

uint64_t llvm::dwarf_linker::parallel::SectionDescriptor::StartOffset = 0

When objects(f.e.

compile units) are glued into the single file, the debug sections corresponding to the concrete object are assigned with offsets inside the whole file. This field keeps offset to the debug section, corresponding to this object.

Definition at line 182 of file OutputSections.h.

Referenced by clearAllSectionData().


The documentation for this struct was generated from the following files: