LLVM 20.0.0git
|
This structure is used to keep data of the concrete section. More...
#include "DWARFLinker/Parallel/OutputSections.h"
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 StringLiteral & | getName () 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 | |
LinkingGlobalData & | GlobalData |
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 |
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.
|
inline |
Definition at line 155 of file OutputSections.h.
void SectionDescriptor::apply | ( | uint64_t | PatchOffset, |
dwarf::Form | AttrForm, | ||
uint64_t | Val | ||
) |
Write specified Value
of AttrForm
to the PatchOffset
.
Definition at line 171 of file OutputSections.cpp.
References applyIntVal(), applySLEB128(), applyULEB128(), llvm::dwarf_linker::parallel::SectionDescriptorBase::Format, llvm::dwarf::FormParams::getDwarfOffsetByteSize(), llvm::dwarf::FormParams::getRefAddrByteSize(), and llvm_unreachable.
Referenced by llvm::dwarf_linker::parallel::DebugLineSectionEmitter::emit(), and llvm::dwarf_linker::parallel::DwarfUnit::emitDebugStringOffsetSection().
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().
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().
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().
void SectionDescriptor::clearAllSectionData | ( | ) |
Erase whole section content(data bits, list of patches).
Definition at line 60 of file OutputSections.cpp.
References clearSectionContent(), and StartOffset.
void SectionDescriptor::clearSectionContent | ( | ) |
Erase only section output data bits.
Definition at line 76 of file OutputSections.cpp.
References Contents.
Referenced by clearAllSectionData().
void SectionDescriptor::emitBinaryData | ( | llvm::StringRef | Data | ) |
Definition at line 167 of file OutputSections.cpp.
References llvm::Data, OS, and llvm::raw_ostream::write().
|
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().
Emit specified integer value into the current section contents.
Definition at line 140 of file OutputSections.cpp.
References llvm::dwarf_linker::parallel::SectionDescriptorBase::Endianess, llvm_unreachable, llvm::native, OS, Size, llvm::sys::swapByteOrder(), and llvm::raw_ostream::write().
Referenced by llvm::dwarf_linker::parallel::DwarfUnit::emitDebugStringOffsetSection(), emitInplaceString(), emitOffset(), llvm::dwarf_linker::parallel::DwarfUnit::emitPubAcceleratorEntry(), emitUnitLength(), and maybeEmitDwarf64Mark().
|
inline |
Emit specified offset value into the current section contents.
Definition at line 243 of file OutputSections.h.
References emitIntVal(), llvm::dwarf::getDwarfOffsetByteSize(), and llvm::dwarf_linker::parallel::SectionDescriptorBase::getFormParams().
Referenced by llvm::dwarf_linker::parallel::DwarfUnit::emitDebugStringOffsetSection(), llvm::dwarf_linker::parallel::DwarfUnit::emitPubAcceleratorEntry(), and emitStringPlaceholder().
void SectionDescriptor::emitString | ( | dwarf::Form | StringForm, |
const char * | StringVal | ||
) |
Definition at line 116 of file OutputSections.cpp.
References assert(), emitInplaceString(), emitStringPlaceholder(), llvm::dwarf_linker::parallel::LinkingGlobalData::getStringPool(), GlobalData, llvm_unreachable, OS, and llvm::raw_ostream::tell().
|
inline |
Emit string placeholder into the current section contents.
Definition at line 261 of file OutputSections.h.
References emitOffset().
Referenced by emitString().
|
inline |
Emit unit length into the current section contents.
Definition at line 230 of file OutputSections.h.
References emitIntVal(), llvm::dwarf::getDwarfOffsetByteSize(), llvm::dwarf_linker::parallel::SectionDescriptorBase::getFormParams(), llvm::Length, and maybeEmitDwarf64Mark().
Referenced by llvm::dwarf_linker::parallel::DebugLineSectionEmitter::emit(), and llvm::dwarf_linker::parallel::DwarfUnit::emitDebugStringOffsetSection().
|
inlineoverridevirtual |
Returns section content.
Implements llvm::dwarf_linker::parallel::SectionDescriptorBase.
Definition at line 221 of file OutputSections.h.
References Contents, SectionOffsetInsideAsmPrinterOutputEnd, SectionOffsetInsideAsmPrinterOutputStart, and llvm::SmallString< InternalLen >::slice().
Referenced by applyIntVal(), applySLEB128(), applyULEB128(), and getIntVal().
Returns integer value of Size
located by specified PatchOffset
.
Definition at line 226 of file OutputSections.cpp.
References assert(), llvm::StringRef::data(), llvm::dwarf_linker::parallel::SectionDescriptorBase::Endianess, getContents(), llvm_unreachable, llvm::support::endian::read16(), llvm::support::endian::read32(), llvm::support::endian::read64(), llvm::size(), and Size.
|
inline |
Emit DWARF64 mark into the current section contents.
Definition at line 236 of file OutputSections.h.
References llvm::dwarf::DW_LENGTH_DWARF64, llvm::dwarf::DWARF64, emitIntVal(), llvm::dwarf_linker::parallel::SectionDescriptorBase::Format, and llvm::dwarf_linker::parallel::SectionDescriptorBase::getFormParams().
Referenced by emitUnitLength().
|
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().
|
inlineprotected |
Sets output format.
Definition at line 283 of file OutputSections.h.
References llvm::dwarf_linker::parallel::SectionDescriptorBase::Endianess, and llvm::dwarf_linker::parallel::SectionDescriptorBase::Format.
void SectionDescriptor::setSizesForSectionCreatedByAsmPrinter | ( | ) |
Some sections are emitted using AsmPrinter.
In that case "Contents" member of SectionDescriptor contains elf file. This method searches for section data inside elf file and remember offset to it.
Definition at line 78 of file OutputSections.cpp.
References llvm::SmallVectorImpl< T >::clear(), llvm::consumeError(), Contents, llvm::object::ObjectFile::createObjectFile(), llvm::SmallVectorTemplateCommon< T, typename >::data(), llvm::Data, llvm::SmallVectorBase< Size_T >::empty(), llvm::dwarf_linker::parseDebugTableName(), SectionOffsetInsideAsmPrinterOutputEnd, SectionOffsetInsideAsmPrinterOutputStart, and llvm::Expected< T >::takeError().
Referenced by llvm::dwarf_linker::parallel::DwarfUnit::emitDebugInfo().
|
protected |
Section data bits.
Definition at line 291 of file OutputSections.h.
Referenced by clearSectionContent(), getContents(), and setSizesForSectionCreatedByAsmPrinter().
|
protected |
Definition at line 288 of file OutputSections.h.
Referenced by emitString().
raw_svector_ostream llvm::dwarf_linker::parallel::SectionDescriptor::OS |
Stream which stores data to the Contents.
Definition at line 185 of file OutputSections.h.
Referenced by llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::cloneAndEmitDebugFrame(), llvm::dwarf_linker::parallel::DebugLineSectionEmitter::emit(), llvm::dwarf_linker::parallel::DwarfUnit::emitAbbreviations(), emitBinaryData(), llvm::dwarf_linker::parallel::DwarfUnit::emitDebugInfo(), llvm::dwarf_linker::parallel::DwarfUnit::emitDebugStringOffsetSection(), llvm::dwarf_linker::parallel::DwarfUnit::emitDwarfAbbrevEntry(), emitInplaceString(), emitIntVal(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::emitInvariantSections(), llvm::dwarf_linker::parallel::DwarfUnit::emitPubAcceleratorEntry(), and emitString().
friend llvm::dwarf_linker::parallel::SectionDescriptor::OutputSections |
Definition at line 153 of file OutputSections.h.
|
protected |
Definition at line 297 of file OutputSections.h.
Referenced by getContents(), and setSizesForSectionCreatedByAsmPrinter().
|
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().
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().