|
LLVM 24.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 |
| 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 321 of file OutputSections.h.
|
protected |
All keeping sections.
Definition at line 478 of file OutputSections.h.
|
inline |
Definition at line 323 of file OutputSections.h.
References GlobalData.
Referenced by llvm::dwarf_linker::parallel::DwarfUnit::DwarfUnit(), and llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::LinkContext().
| void OutputSections::applyPatches | ( | SectionDescriptor & | Section, |
| StringEntryToDwarfStringPoolEntryMap & | DebugStrStrings, | ||
| StringEntryToDwarfStringPoolEntryMap & | DebugLineStrStrings, | ||
| TypeUnit * | TypeUnitPtr ) |
Enumerate all sections, for each section apply all section patches.
Definition at line 304 of file OutputSections.cpp.
References assert(), llvm::dwarf_linker::DebugInfo, llvm::dwarf_linker::DebugLoc, llvm::dwarf_linker::DebugLocLists, llvm::dwarf_linker::DebugRange, llvm::dwarf_linker::DebugRngLists, Format, llvm::formatv(), llvm::dwarf_linker::parallel::StringEntryToDwarfStringPoolEntryMap::getExistingEntry(), llvm::dwarf_linker::parallel::TypeEntryBody::getFinalDie(), llvm::StringMapEntry< ValueTy >::getKey(), llvm::DIE::getOffset(), llvm::getULEB128Size(), llvm::StringMapEntryStorage< ValueTy >::getValue(), llvm::dwarf_linker::parallel::ModuleAnchor::LocalOffset, llvm::dwarf_linker::parallel::SectionPatch::PatchOffset, llvm::dwarf_linker::parallel::ModuleAnchor::Section, llvm::dwarf_linker::parallel::SectionDescriptor::StartOffset, llvm::dwarf_linker::parallel::DebugStrPatch::String, tryGetSectionDescriptor(), and llvm::dwarf_linker::parallel::ModuleAnchor::TypeName.
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 425 of file OutputSections.h.
References SectionDescriptors.
Referenced by llvm::dwarf_linker::parallel::DWARFLinkerImpl::assignOffsetsToSections().
|
inline |
Erases data of all sections.
Definition at line 402 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 408 of file OutputSections.h.
References assert(), and SectionDescriptors.
Referenced by llvm::dwarf_linker::parallel::DWARFLinkerImpl::patchOffsetsAndSizes(), and llvm::dwarf_linker::parallel::DWARFLinkerImpl::writeCompileUnitsToTheOutput().
|
inline |
Enumerate all sections and call Handler for each.
Definition at line 416 of file OutputSections.h.
References SectionDescriptors.
|
inline |
Return size of header of debug_ table.
Definition at line 454 of file OutputSections.h.
References assert(), llvm::dwarf::DWARF32, and Format.
|
inline |
Return size of header of debug_info table.
Definition at line 449 of file OutputSections.h.
References Format.
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 460 of file OutputSections.h.
References assert(), llvm::dwarf::DWARF32, and Format.
Referenced by llvm::dwarf_linker::parallel::TypeUnit::createDIETree().
|
inline |
Endiannes for the sections.
Definition at line 443 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 466 of file OutputSections.h.
References Format.
Referenced by llvm::dwarf_linker::parallel::CompileUnit::cloneAndEmitLineTable(), llvm::dwarf_linker::parallel::CompileUnit::cloneDieAttrExpression(), llvm::dwarf_linker::parallel::DwarfUnit::emitDebugInfo(), llvm::dwarf_linker::parallel::DwarfUnit::emitPubAcceleratorEntry(), 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 391 of file OutputSections.h.
References Endianness, Format, GlobalData, and SectionDescriptors.
Referenced by llvm::dwarf_linker::parallel::CompileUnit::cloneAndEmit(), llvm::dwarf_linker::parallel::CompileUnit::CompileUnit(), llvm::dwarf_linker::parallel::CompileUnit::CompileUnit(), llvm::dwarf_linker::parallel::TypeUnit::createDIETree(), llvm::dwarf_linker::parallel::DwarfUnit::emitAbbreviations(), llvm::dwarf_linker::parallel::DwarfUnit::emitDebugInfo(), llvm::dwarf_linker::parallel::DwarfUnit::emitDebugStringOffsetSection(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::emitInvariantSections(), llvm::dwarf_linker::parallel::DwarfUnit::emitPubAcceleratorEntry(), llvm::dwarf_linker::parallel::DwarfUnit::emitPubAccelerators(), llvm::dwarf_linker::parallel::TypeUnit::finishCloningAndEmit(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::registerCIEs(), 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 350 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 335 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::LinkContext::emitDebugFrame(), and llvm::dwarf_linker::parallel::CompileUnit::noteModuleAnchors().
|
inline |
Return DWARF version.
Definition at line 446 of file OutputSections.h.
References Format.
Referenced by llvm::dwarf_linker::parallel::CompileUnit::cloneAndEmitDebugLocations(), llvm::dwarf_linker::parallel::CompileUnit::cloneAndEmitRanges(), llvm::dwarf_linker::parallel::DwarfUnit::emitDebugStringOffsetSection(), and llvm::dwarf_linker::parallel::CompileUnit::getDirAndFilenameFromLineTable().
|
inline |
Sets output format for all keeping sections.
Definition at line 326 of file OutputSections.h.
References Endianness, and Format.
Referenced by llvm::dwarf_linker::parallel::CompileUnit::CompileUnit(), llvm::dwarf_linker::parallel::CompileUnit::CompileUnit(), 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 379 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 367 of file OutputSections.h.
References SectionDescriptors.
Referenced by applyPatches(), and llvm::dwarf_linker::parallel::CompileUnit::updateDieRefPatchesWithClonedOffsets().
|
protected |
Endiannes for sections.
Definition at line 475 of file OutputSections.h.
Referenced by getEndianness(), getOrCreateSectionDescriptor(), and setOutputFormat().
|
protected |
Format for sections.
Definition at line 472 of file OutputSections.h.
Referenced by applyPatches(), llvm::dwarf_linker::parallel::CompileUnit::CompileUnit(), llvm::dwarf_linker::parallel::CompileUnit::CompileUnit(), getDebugAddrHeaderSize(), getDebugInfoHeaderSize(), getDebugStrOffsetsHeaderSize(), getFormParams(), getOrCreateSectionDescriptor(), getVersion(), setOutputFormat(), and llvm::dwarf_linker::parallel::TypeUnit::TypeUnit().
|
protected |
Definition at line 469 of file OutputSections.h.
Referenced by llvm::dwarf_linker::parallel::CompileUnit::analyzeImportedModule(), llvm::dwarf_linker::parallel::CompileUnit::cloneAndEmit(), 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::DWARFLinkerImpl::LinkContext::scanFrameData(), 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().
|
protected |
Definition at line 480 of file OutputSections.h.
Referenced by assignSectionsOffsetAndAccumulateSize(), eraseSections(), forEach(), forEach(), getOrCreateSectionDescriptor(), getSectionDescriptor(), getSectionDescriptor(), tryGetSectionDescriptor(), and tryGetSectionDescriptor().