LLVM 19.0.0git
Public Member Functions | Protected Types | Protected Attributes | List of all members
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:
Inheritance graph
[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 = std::map< DebugSectionKind, std::shared_ptr< SectionDescriptor > >
 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 303 of file OutputSections.h.

Member Typedef Documentation

◆ SectionsSetTy

All keeping sections.

Definition at line 465 of file OutputSections.h.

Constructor & Destructor Documentation

◆ OutputSections()

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

Definition at line 305 of file OutputSections.h.

Member Function Documentation

◆ applyPatches()

void OutputSections::applyPatches ( SectionDescriptor Section,
StringEntryToDwarfStringPoolEntryMap DebugStrStrings,
StringEntryToDwarfStringPoolEntryMap DebugLineStrStrings,
TypeUnit TypeUnitPtr 
)

◆ 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 412 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 389 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 403 of file OutputSections.h.

References SectionDescriptors.

◆ getDebugAddrHeaderSize()

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

◆ getDebugInfoHeaderSize()

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

◆ getDebugStrOffsetsHeaderSize()

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

◆ getEndianness()

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

◆ getFormParams()

const dwarf::FormParams & llvm::dwarf_linker::parallel::OutputSections::getFormParams ( ) const
inline

◆ getOrCreateSectionDescriptor()

SectionDescriptor & llvm::dwarf_linker::parallel::OutputSections::getOrCreateSectionDescriptor ( DebugSectionKind  SectionKind)
inline

◆ 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 332 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 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().

◆ getVersion()

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

◆ 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 361 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 349 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

◆ Format

dwarf::FormParams llvm::dwarf_linker::parallel::OutputSections::Format = {4, 4, dwarf::DWARF32}
protected

◆ GlobalData

LinkingGlobalData& llvm::dwarf_linker::parallel::OutputSections::GlobalData
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().

◆ SectionDescriptors

SectionsSetTy llvm::dwarf_linker::parallel::OutputSections::SectionDescriptors
protected

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