LLVM 20.0.0git
|
This class keeps contents and offsets to the debug sections. More...
#include "DWARFLinker/Parallel/OutputSections.h"
Public Member Functions | |
OutputSections (LinkingGlobalData &GlobalData) | |
void | setOutputFormat (dwarf::FormParams Format, llvm::endianness Endianness) |
Sets output format for all keeping sections. | |
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 . | |
std::optional< const SectionDescriptor * > | tryGetSectionDescriptor (DebugSectionKind SectionKind) const |
Returns descriptor for the specified section of SectionKind . | |
std::optional< SectionDescriptor * > | tryGetSectionDescriptor (DebugSectionKind SectionKind) |
Returns descriptor for the specified section of SectionKind . | |
SectionDescriptor & | getOrCreateSectionDescriptor (DebugSectionKind SectionKind) |
Returns descriptor for the specified section of SectionKind . | |
void | eraseSections () |
Erases data of all sections. | |
void | forEach (function_ref< void(SectionDescriptor &)> Handler) |
Enumerate all sections and call Handler for each. | |
void | forEach (function_ref< void(std::shared_ptr< SectionDescriptor > Section)> Handler) |
Enumerate all sections and call Handler for each. | |
void | assignSectionsOffsetAndAccumulateSize (std::array< uint64_t, SectionKindsNum > &SectionSizesAccumulator) |
Enumerate all sections, for each section set current offset (kept by SectionSizesAccumulator ), update current offset with section length. | |
void | applyPatches (SectionDescriptor &Section, StringEntryToDwarfStringPoolEntryMap &DebugStrStrings, StringEntryToDwarfStringPoolEntryMap &DebugLineStrStrings, TypeUnit *TypeUnitPtr) |
Enumerate all sections, for each section apply all section patches. | |
llvm::endianness | getEndianness () const |
Endiannes for the sections. | |
uint16_t | getVersion () const |
Return DWARF version. | |
uint16_t | getDebugInfoHeaderSize () const |
Return size of header of debug_info table. | |
uint16_t | getDebugAddrHeaderSize () const |
Return size of header of debug_ table. | |
uint16_t | getDebugStrOffsetsHeaderSize () const |
Return size of header of debug_str_offsets table. | |
const dwarf::FormParams & | getFormParams () const |
Return size of address. | |
Protected Types | |
using | SectionsSetTy = std::map< DebugSectionKind, std::shared_ptr< SectionDescriptor > > |
All keeping sections. | |
Protected Attributes | |
LinkingGlobalData & | GlobalData |
dwarf::FormParams | Format = {4, 4, dwarf::DWARF32} |
Format for sections. | |
llvm::endianness | Endianness = llvm::endianness::native |
Endiannes for sections. | |
SectionsSetTy | SectionDescriptors |
This class keeps contents and offsets to the debug sections.
Any objects which is supposed to be emitted into the debug sections should use this class to track debug sections offsets and keep sections data.
Definition at line 303 of file OutputSections.h.
|
protected |
All keeping sections.
Definition at line 465 of file OutputSections.h.
|
inline |
Definition at line 305 of file OutputSections.h.
void OutputSections::applyPatches | ( | SectionDescriptor & | Section, |
StringEntryToDwarfStringPoolEntryMap & | DebugStrStrings, | ||
StringEntryToDwarfStringPoolEntryMap & | DebugLineStrStrings, | ||
TypeUnit * | TypeUnitPtr | ||
) |
Enumerate all sections, for each section apply all section patches.
Definition at line 303 of file OutputSections.cpp.
References assert(), llvm::dwarf_linker::DebugLoc, llvm::dwarf_linker::DebugLocLists, llvm::dwarf_linker::DebugRange, llvm::dwarf_linker::DebugRngLists, Format, llvm::formatv(), llvm::dwarf::FormParams::getDwarfOffsetByteSize(), llvm::dwarf_linker::parallel::StringEntryToDwarfStringPoolEntryMap::getExistingEntry(), llvm::dwarf_linker::parallel::TypeEntryBody::getFinalDie(), llvm::DIE::getOffset(), llvm::getULEB128Size(), llvm::dwarf_linker::parallel::SectionPatch::PatchOffset, llvm::dwarf_linker::parallel::DebugStrPatch::String, tryGetSectionDescriptor(), and llvm::dwarf::FormParams::Version.
Referenced by llvm::dwarf_linker::parallel::DWARFLinkerImpl::patchOffsetsAndSizes().
|
inline |
Enumerate all sections, for each section set current offset (kept by SectionSizesAccumulator
), update current offset with section length.
Definition at line 412 of file OutputSections.h.
References SectionDescriptors.
Referenced by llvm::dwarf_linker::parallel::DWARFLinkerImpl::assignOffsetsToSections().
|
inline |
Erases data of all sections.
Definition at line 389 of file OutputSections.h.
References SectionDescriptors.
Referenced by llvm::dwarf_linker::parallel::CompileUnit::maybeResetToLoadedStage().
|
inline |
Enumerate all sections and call Handler
for each.
Definition at line 395 of file OutputSections.h.
References assert(), and SectionDescriptors.
Referenced by llvm::dwarf_linker::parallel::DWARFLinkerImpl::patchOffsetsAndSizes(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::writeCommonSectionsToTheOutput(), and llvm::dwarf_linker::parallel::DWARFLinkerImpl::writeCompileUnitsToTheOutput().
|
inline |
Enumerate all sections and call Handler
for each.
Definition at line 403 of file OutputSections.h.
References SectionDescriptors.
|
inline |
Return size of header of debug_ table.
Definition at line 441 of file OutputSections.h.
References assert(), llvm::dwarf::DWARF32, llvm::dwarf::FormParams::Format, Format, and llvm::dwarf::FormParams::Version.
Referenced by llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneScalarAttr().
|
inline |
Return size of header of debug_info table.
Definition at line 436 of file OutputSections.h.
References Format, and llvm::dwarf::FormParams::Version.
Referenced by llvm::dwarf_linker::parallel::CompileUnit::cloneAndEmit(), llvm::dwarf_linker::parallel::TypeUnit::createDIETree(), and llvm::dwarf_linker::parallel::DwarfUnit::setOutUnitDIE().
|
inline |
Return size of header of debug_str_offsets table.
Definition at line 447 of file OutputSections.h.
References assert(), llvm::dwarf::DWARF32, llvm::dwarf::FormParams::Format, Format, and llvm::dwarf::FormParams::Version.
Referenced by llvm::dwarf_linker::parallel::DIEAttributeCloner::clone(), llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneScalarAttr(), and llvm::dwarf_linker::parallel::TypeUnit::createDIETree().
|
inline |
Endiannes for the sections.
Definition at line 430 of file OutputSections.h.
References Endianness.
Referenced by llvm::dwarf_linker::parallel::CompileUnit::cloneDieAttrExpression(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::link(), and llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::loadClangModule().
|
inline |
Return size of address.
Definition at line 453 of file OutputSections.h.
References Format.
Referenced by llvm::dwarf_linker::parallel::DIEAttributeCloner::clone(), llvm::dwarf_linker::parallel::CompileUnit::cloneAndEmitLineTable(), llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneBlockAttr(), llvm::dwarf_linker::parallel::CompileUnit::cloneDieAttrExpression(), and llvm::dwarf_linker::parallel::TypeUnit::TypeUnit().
|
inline |
Returns descriptor for the specified section of SectionKind
.
If descriptor does not exist then creates it.
Definition at line 373 of file OutputSections.h.
References assert(), Endianness, Format, GlobalData, and SectionDescriptors.
Referenced by llvm::dwarf_linker::parallel::DIEAttributeCloner::clone(), llvm::dwarf_linker::parallel::CompileUnit::cloneAndEmit(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::cloneAndEmitDebugFrame(), llvm::dwarf_linker::parallel::DIEAttributeCloner::cloneScalarAttr(), llvm::dwarf_linker::parallel::CompileUnit::CompileUnit(), llvm::dwarf_linker::parallel::TypeUnit::createDIETree(), llvm::dwarf_linker::parallel::DebugLineSectionEmitter::emit(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::emitCommonSectionsAndWriteCompileUnitsToTheOutput(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::emitInvariantSections(), llvm::dwarf_linker::parallel::TypeUnit::finishCloningAndEmit(), and llvm::dwarf_linker::parallel::TypeUnit::TypeUnit().
|
inline |
Returns descriptor for the specified section of SectionKind
.
The descriptor should already be created. The llvm_unreachable would be raised if it is not.
Definition at line 332 of file OutputSections.h.
References assert(), llvm::c_str(), llvm::formatv(), llvm::dwarf_linker::getSectionName(), llvm_unreachable, and SectionDescriptors.
|
inline |
Returns descriptor for the specified section of SectionKind
.
The descriptor should already be created. The llvm_unreachable would be raised if it is not.
Definition at line 317 of file OutputSections.h.
References llvm::c_str(), llvm::formatv(), llvm::dwarf_linker::getSectionName(), llvm_unreachable, and SectionDescriptors.
Referenced by llvm::dwarf_linker::parallel::DWARFLinkerImpl::emitStringSections().
|
inline |
Return DWARF version.
Definition at line 433 of file OutputSections.h.
References Format, and llvm::dwarf::FormParams::Version.
Referenced by llvm::dwarf_linker::parallel::DIEAttributeCloner::clone(), llvm::dwarf_linker::parallel::CompileUnit::cloneAndEmitDebugLocations(), llvm::dwarf_linker::parallel::CompileUnit::cloneAndEmitRanges(), llvm::dwarf_linker::parallel::DIEAttributeCloner::DIEAttributeCloner(), and llvm::dwarf_linker::parallel::CompileUnit::getDirAndFilenameFromLineTable().
|
inline |
Sets output format for all keeping sections.
Definition at line 308 of file OutputSections.h.
References Endianness, and Format.
Referenced by llvm::dwarf_linker::parallel::CompileUnit::CompileUnit(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::link(), and llvm::dwarf_linker::parallel::TypeUnit::TypeUnit().
|
inline |
Returns descriptor for the specified section of SectionKind
.
Returns std::nullopt if section descriptor is not created yet.
Definition at line 361 of file OutputSections.h.
References SectionDescriptors.
|
inline |
Returns descriptor for the specified section of SectionKind
.
Returns std::nullopt if section descriptor is not created yet.
Definition at line 349 of file OutputSections.h.
References SectionDescriptors.
Referenced by applyPatches(), and llvm::dwarf_linker::parallel::CompileUnit::updateDieRefPatchesWithClonedOffsets().
|
protected |
Endiannes for sections.
Definition at line 462 of file OutputSections.h.
Referenced by getEndianness(), getOrCreateSectionDescriptor(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::LinkContext(), and setOutputFormat().
|
protected |
Format for sections.
Definition at line 459 of file OutputSections.h.
Referenced by applyPatches(), llvm::dwarf_linker::parallel::CompileUnit::CompileUnit(), getDebugAddrHeaderSize(), getDebugInfoHeaderSize(), getDebugStrOffsetsHeaderSize(), getFormParams(), getOrCreateSectionDescriptor(), getVersion(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::LinkContext(), setOutputFormat(), and llvm::dwarf_linker::parallel::TypeUnit::TypeUnit().
|
protected |
Definition at line 456 of file OutputSections.h.
Referenced by llvm::dwarf_linker::parallel::DWARFLinkerImpl::addObjectFile(), llvm::dwarf_linker::parallel::CompileUnit::analyzeImportedModule(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::cleanupDataAfterDWARFOutputIsWritten(), llvm::dwarf_linker::parallel::CompileUnit::cloneAndEmit(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::cloneAndEmitDebugFrame(), llvm::dwarf_linker::parallel::CompileUnit::CompileUnit(), llvm::dwarf_linker::parallel::TypeUnit::createDIETree(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::emitCommonSectionsAndWriteCompileUnitsToTheOutput(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::emitInvariantSections(), llvm::dwarf_linker::parallel::DwarfUnit::error(), llvm::dwarf_linker::parallel::CompileUnit::error(), llvm::dwarf_linker::parallel::TypeUnit::finishCloningAndEmit(), llvm::dwarf_linker::parallel::DwarfUnit::getGlobalData(), getOrCreateSectionDescriptor(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::glueCompileUnitsAndWriteToTheOutput(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::isClangModuleRef(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::link(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::link(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::linkSingleCompileUnit(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::loadClangModule(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::registerModuleReference(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::validateAndUpdateOptions(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::verifyInput(), llvm::dwarf_linker::parallel::DwarfUnit::warn(), and llvm::dwarf_linker::parallel::CompileUnit::warn().
|
protected |
Definition at line 467 of file OutputSections.h.
Referenced by assignSectionsOffsetAndAccumulateSize(), eraseSections(), forEach(), getOrCreateSectionDescriptor(), getSectionDescriptor(), and tryGetSectionDescriptor().