LLVM 22.0.0git
llvm::dwarf_linker::parallel::OutputSections Class Reference

This class keeps contents and offsets to the debug sections. More...

#include "DWARFLinker/Parallel/OutputSections.h"

Inheritance diagram for llvm::dwarf_linker::parallel::OutputSections:
[legend]

Public Member Functions

 OutputSections (LinkingGlobalData &GlobalData)
void setOutputFormat (dwarf::FormParams Format, llvm::endianness Endianness)
 Sets output format for all keeping sections.
const SectionDescriptorgetSectionDescriptor (DebugSectionKind SectionKind) const
 Returns descriptor for the specified section of SectionKind.
SectionDescriptorgetSectionDescriptor (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.
SectionDescriptorgetOrCreateSectionDescriptor (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::FormParamsgetFormParams () const
 Return size of address.

Protected Types

using SectionsSetTy
 All keeping sections.

Protected Attributes

LinkingGlobalDataGlobalData
dwarf::FormParams Format = {4, 4, dwarf::DWARF32}
 Format for sections.
llvm::endianness Endianness = llvm::endianness::native
 Endiannes for sections.
SectionsSetTy SectionDescriptors

Detailed Description

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 305 of file OutputSections.h.

Member Typedef Documentation

◆ SectionsSetTy

Initial value:
std::map<DebugSectionKind, std::shared_ptr<SectionDescriptor>>

All keeping sections.

Definition at line 462 of file OutputSections.h.

Constructor & Destructor Documentation

◆ OutputSections()

llvm::dwarf_linker::parallel::OutputSections::OutputSections ( LinkingGlobalData & GlobalData)
inline

Member Function Documentation

◆ applyPatches()

◆ assignSectionsOffsetAndAccumulateSize()

void llvm::dwarf_linker::parallel::OutputSections::assignSectionsOffsetAndAccumulateSize ( std::array< uint64_t, SectionKindsNum > & SectionSizesAccumulator)
inline

Enumerate all sections, for each section set current offset (kept by SectionSizesAccumulator), update current offset with section length.

Definition at line 409 of file OutputSections.h.

References SectionDescriptors.

Referenced by llvm::dwarf_linker::parallel::DWARFLinkerImpl::assignOffsetsToSections().

◆ eraseSections()

void llvm::dwarf_linker::parallel::OutputSections::eraseSections ( )
inline

Erases data of all sections.

Definition at line 386 of file OutputSections.h.

References SectionDescriptors.

Referenced by llvm::dwarf_linker::parallel::CompileUnit::maybeResetToLoadedStage().

◆ forEach() [1/2]

void llvm::dwarf_linker::parallel::OutputSections::forEach ( function_ref< void(SectionDescriptor &)> Handler)
inline

◆ forEach() [2/2]

void llvm::dwarf_linker::parallel::OutputSections::forEach ( function_ref< void(std::shared_ptr< SectionDescriptor > Section)> Handler)
inline

Enumerate all sections and call Handler for each.

Definition at line 400 of file OutputSections.h.

References SectionDescriptors.

◆ getDebugAddrHeaderSize()

uint16_t llvm::dwarf_linker::parallel::OutputSections::getDebugAddrHeaderSize ( ) const
inline

Return size of header of debug_ table.

Definition at line 438 of file OutputSections.h.

References assert(), llvm::dwarf::DWARF32, and Format.

◆ getDebugInfoHeaderSize()

uint16_t llvm::dwarf_linker::parallel::OutputSections::getDebugInfoHeaderSize ( ) const
inline

◆ getDebugStrOffsetsHeaderSize()

uint16_t llvm::dwarf_linker::parallel::OutputSections::getDebugStrOffsetsHeaderSize ( ) const
inline

Return size of header of debug_str_offsets table.

Definition at line 444 of file OutputSections.h.

References assert(), llvm::dwarf::DWARF32, and Format.

Referenced by llvm::dwarf_linker::parallel::TypeUnit::createDIETree().

◆ getEndianness()

llvm::endianness llvm::dwarf_linker::parallel::OutputSections::getEndianness ( ) const
inline

◆ getFormParams()

◆ getOrCreateSectionDescriptor()

◆ getSectionDescriptor() [1/2]

SectionDescriptor & llvm::dwarf_linker::parallel::OutputSections::getSectionDescriptor ( DebugSectionKind SectionKind)
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 334 of file OutputSections.h.

References assert(), llvm::c_str(), llvm::formatv(), llvm::dwarf_linker::getSectionName(), llvm_unreachable, and SectionDescriptors.

◆ getSectionDescriptor() [2/2]

const SectionDescriptor & llvm::dwarf_linker::parallel::OutputSections::getSectionDescriptor ( DebugSectionKind SectionKind) const
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 319 of file OutputSections.h.

References llvm::c_str(), llvm::formatv(), llvm::dwarf_linker::getSectionName(), llvm_unreachable, and SectionDescriptors.

◆ getVersion()

◆ setOutputFormat()

void llvm::dwarf_linker::parallel::OutputSections::setOutputFormat ( dwarf::FormParams Format,
llvm::endianness Endianness )
inline

◆ tryGetSectionDescriptor() [1/2]

std::optional< SectionDescriptor * > llvm::dwarf_linker::parallel::OutputSections::tryGetSectionDescriptor ( DebugSectionKind SectionKind)
inline

Returns descriptor for the specified section of SectionKind.

Returns std::nullopt if section descriptor is not created yet.

Definition at line 363 of file OutputSections.h.

References SectionDescriptors.

◆ tryGetSectionDescriptor() [2/2]

std::optional< const SectionDescriptor * > llvm::dwarf_linker::parallel::OutputSections::tryGetSectionDescriptor ( DebugSectionKind SectionKind) const
inline

Returns descriptor for the specified section of SectionKind.

Returns std::nullopt if section descriptor is not created yet.

Definition at line 351 of file OutputSections.h.

References SectionDescriptors.

Referenced by applyPatches(), and llvm::dwarf_linker::parallel::CompileUnit::updateDieRefPatchesWithClonedOffsets().

Member Data Documentation

◆ Endianness

llvm::endianness llvm::dwarf_linker::parallel::OutputSections::Endianness = llvm::endianness::native
protected

Endiannes for sections.

Definition at line 459 of file OutputSections.h.

Referenced by getEndianness(), getOrCreateSectionDescriptor(), and setOutputFormat().

◆ Format

◆ GlobalData

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

Definition at line 453 of file OutputSections.h.

Referenced by llvm::dwarf_linker::parallel::CompileUnit::analyzeImportedModule(), llvm::dwarf_linker::parallel::CompileUnit::cloneAndEmit(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::cloneAndEmitDebugFrame(), llvm::dwarf_linker::parallel::CompileUnit::CompileUnit(), llvm::dwarf_linker::parallel::CompileUnit::CompileUnit(), llvm::dwarf_linker::parallel::TypeUnit::createDIETree(), llvm::dwarf_linker::parallel::DwarfUnit::DwarfUnit(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::emitInvariantSections(), llvm::dwarf_linker::parallel::CompileUnit::error(), llvm::dwarf_linker::parallel::CompileUnit::error(), llvm::dwarf_linker::parallel::DwarfUnit::error(), llvm::dwarf_linker::parallel::TypeUnit::finishCloningAndEmit(), llvm::dwarf_linker::parallel::DwarfUnit::getGlobalData(), getOrCreateSectionDescriptor(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::isClangModuleRef(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::link(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::LinkContext(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::linkSingleCompileUnit(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::loadClangModule(), OutputSections(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::registerModuleReference(), llvm::dwarf_linker::parallel::TypeUnit::TypeUnit(), llvm::dwarf_linker::parallel::CompileUnit::warn(), llvm::dwarf_linker::parallel::CompileUnit::warn(), llvm::dwarf_linker::parallel::CompileUnit::warn(), and llvm::dwarf_linker::parallel::DwarfUnit::warn().

◆ SectionDescriptors


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