LLVM: llvm::dwarf_linker::parallel::DWARFLinkerImpl Class Reference (original) (raw)

This class links debug info. More...

#include "[DWARFLinker/Parallel/DWARFLinkerImpl.h](DWARFLinkerImpl%5F8h%5Fsource.html)"

Public Member Functions
DWARFLinkerImpl (MessageHandlerTy ErrorHandler, MessageHandlerTy WarningHandler)
void addObjectFile (DWARFFile &File, ObjFileLoaderTy Loader=nullptr, CompileUnitHandlerTy OnCUDieLoaded=[](const DWARFUnit &) {}) override
Add object file to be linked.
Error link () override
Link debug info for added files.
void setOutputDWARFHandler (const Triple &TargetTriple, SectionHandlerTy SectionHandler) override
Set output DWARF handler.
void setVerbosity (bool Verbose) override
Allows to generate log of linking process to the standard output.
void setStatistics (bool Statistics) override
Print statistics to standard output.
void setVerifyInputDWARF (bool Verify) override
Verify the input DWARF.
void setNoODR (bool NoODR) override
Do not unique types according to ODR.
void setUpdateIndexTablesOnly (bool UpdateIndexTablesOnly) override
Update index tables only(do not modify rest of DWARF).
void setAllowNonDeterministicOutput (bool AllowNonDeterministicOutput) override
Allow generating valid, but non-deterministic output.
void setKeepFunctionForStatic (bool KeepFunctionForStatic) override
Set to keep the enclosing function for a static variable.
void setNumThreads (unsigned NumThreads) override
Use specified number of threads for parallel files linking.
void addAccelTableKind (AccelTableKind Kind) override
Add kind of accelerator tables to be generated.
void setPrependPath (StringRef Ppath) override
Set prepend path for clang modules.
void setEstimatedObjfilesAmount (unsigned ObjFilesNum) override
Set estimated objects files amount, for preliminary data allocation.
void setInputVerificationHandler (InputVerificationHandlerTy Handler) override
Set verification handler which would be used to report verification errors.
void setSwiftInterfacesMap (SwiftInterfacesMapTy *Map) override
Set map for Swift interfaces.
void setObjectPrefixMap (ObjectPrefixMapTy *Map) override
Set prefix map for objects.
Error setTargetDWARFVersion (uint16_t TargetDWARFVersion) override
Set target DWARF version.
Public Member Functions inherited from llvm::dwarf_linker::parallel::DWARFLinker
~DWARFLinker () override=default
Public Member Functions inherited from llvm::dwarf_linker::DWARFLinkerBase
virtual ~DWARFLinkerBase ()=default
Protected Types
enum StringDestinationKind : uint8_t { DebugStr, DebugLineStr }
Protected Member Functions
void verifyInput (const DWARFFile &File)
Verify input DWARF file.
Error validateAndUpdateOptions ()
Validate specified options.
void glueCompileUnitsAndWriteToTheOutput ()
Take already linked compile units and glue them into single file.
void assignOffsets ()
Enumerate all compile units and assign offsets to their sections and strings.
void assignOffsetsToSections ()
Enumerate all compile units and assign offsets to their sections.
void assignOffsetsToStrings ()
Enumerate all compile units and assign offsets to their strings.
void printStatistic ()
Print statistic for processed Debug Info.
void forEachOutputString (function_ref< void(StringDestinationKind, const StringEntry *)> StringHandler)
Enumerates all strings.
void forEachObjectSectionsSet (function_ref< void(OutputSections &SectionsSet)> SectionsSetHandler)
Enumerates sections for modules, invariant for object files, compile units.
void forEachCompileAndTypeUnit (function_ref< void(DwarfUnit *CU)> UnitHandler)
Enumerates all compile and type units.
void forEachCompileUnit (function_ref< void(CompileUnit *CU)> UnitHandler)
Enumerates all comple units.
void patchOffsetsAndSizes ()
Enumerates all patches and update them with the correct values.
void emitCommonSectionsAndWriteCompileUnitsToTheOutput ()
Emit debug sections common for all input files.
void emitAppleAcceleratorSections (const Triple &TargetTriple)
Emit apple accelerator sections.
void emitDWARFv5DebugNamesSection (const Triple &TargetTriple)
Emit .debug_names section.
void emitStringSections ()
Emit string sections.
void cleanupDataAfterDWARFOutputIsWritten ()
Cleanup data(string pools) after output sections are generated.
void writeCompileUnitsToTheOutput ()
Enumerate all compile units and put their data into the output stream.
void writeCommonSectionsToTheOutput ()
Enumerate common sections and put their data into the output stream.
Protected Attributes
std::atomic< size_t > UniqueUnitID
Unique ID for compile unit.
StringMap< uint64_t > ClangModules
Mapping the PCM filename to the DwoId.
std::mutex ClangModulesMutex
std::unique_ptr< TypeUnit > ArtificialTypeUnit
Type unit.
LinkingGlobalData GlobalData
StringEntryToDwarfStringPoolEntryMap DebugStrStrings
DwarfStringPoolEntries for .debug_str section.
StringEntryToDwarfStringPoolEntryMap DebugLineStrStrings
DwarfStringPoolEntries for .debug_line_str section.
SmallVector< std::unique_ptr< LinkContext > > ObjectContexts
Keeps all linking contexts.
OutputSections CommonSections
Common sections.
SectionHandlerTy SectionHandler = nullptr
Hanler for output sections.
uint64_t OverallNumberOfCU = 0
Overall compile units number.
Friends
class DependencyTracker
Additional Inherited Members
Public Types inherited from llvm::dwarf_linker::DWARFLinkerBase
enum class OutputFileType : uint8_t { Object, Assembly }
Type of output file. More...
enum class AccelTableKind : uint8_t { Apple, Pub, DebugNames }
The kind of accelerator tables to be emitted. More...
using MessageHandlerTy
using ObjFileLoaderTy
using InputVerificationHandlerTy
using ObjectPrefixMapTy = std::map<std::string, std::string>
using CompileUnitHandlerTy = function_ref<void(const DWARFUnit &Unit)>
using SwiftInterfacesMapTy = std::map<std::string, std::string>
Static Public Member Functions inherited from llvm::dwarf_linker::parallel::DWARFLinker
static LLVM_ABI std::unique_ptr< DWARFLinker > createLinker (MessageHandlerTy ErrorHandler, MessageHandlerTy WarningHandler)
Creates dwarf linker instance.

This class links debug info.

Definition at line 26 of file DWARFLinkerImpl.h.

StringDestinationKind

addObjectFile()

assignOffsets()

void DWARFLinkerImpl::assignOffsets ( ) protected

assignOffsetsToSections()

void DWARFLinkerImpl::assignOffsetsToSections ( ) protected

assignOffsetsToStrings()

void DWARFLinkerImpl::assignOffsetsToStrings ( ) protected

cleanupDataAfterDWARFOutputIsWritten()

void DWARFLinkerImpl::cleanupDataAfterDWARFOutputIsWritten ( ) protected

emitAppleAcceleratorSections()

void DWARFLinkerImpl::emitAppleAcceleratorSections ( const Triple & TargetTriple) protected

Emit apple accelerator sections.

Definition at line 1208 of file DWARFLinkerImpl.cpp.

References llvm::dwarf_linker::AppleNames, llvm::dwarf_linker::AppleNamespaces, llvm::dwarf_linker::AppleObjC, llvm::dwarf_linker::AppleTypes, CommonSections, llvm::consumeError(), llvm::dwarf_linker::DebugInfo, DebugStrStrings, llvm::dwarf::DW_FLAG_type_implementation, Emitter, forEachCompileAndTypeUnit(), llvm_unreachable, llvm::dwarf_linker::parallel::DwarfUnit::Name, llvm::dwarf_linker::parallel::DwarfUnit::Namespace, llvm::dwarf_linker::parallel::DwarfUnit::None, llvm::dwarf_linker::parallel::DwarfUnit::ObjC, llvm::dwarf_linker::DWARFLinkerBase::Object, llvm::dwarf_linker::parallel::SectionDescriptor::OS, llvm::dwarf_linker::parallel::SectionDescriptor::setSizesForSectionCreatedByAsmPrinter(), and llvm::dwarf_linker::parallel::DwarfUnit::Type.

Referenced by emitCommonSectionsAndWriteCompileUnitsToTheOutput().

emitCommonSectionsAndWriteCompileUnitsToTheOutput()

void DWARFLinkerImpl::emitCommonSectionsAndWriteCompileUnitsToTheOutput ( ) protected

Emit debug sections common for all input files.

Definition at line 1113 of file DWARFLinkerImpl.cpp.

References llvm::dwarf_linker::DWARFLinkerBase::Apple, llvm::dwarf_linker::AppleNames, llvm::dwarf_linker::AppleNamespaces, llvm::dwarf_linker::AppleObjC, llvm::dwarf_linker::AppleTypes, CommonSections, llvm::dwarf_linker::DebugLineStr, llvm::dwarf_linker::DebugNames, llvm::dwarf_linker::DWARFLinkerBase::DebugNames, llvm::dwarf_linker::DebugStr, emitAppleAcceleratorSections(), emitDWARFv5DebugNamesSection(), emitStringSections(), GlobalData, llvm::is_contained(), llvm::parallel::TaskGroup::spawn(), and writeCompileUnitsToTheOutput().

Referenced by glueCompileUnitsAndWriteToTheOutput().

emitDWARFv5DebugNamesSection()

void DWARFLinkerImpl::emitDWARFv5DebugNamesSection ( const Triple & TargetTriple) protected

Emit .debug_names section.

Definition at line 1338 of file DWARFLinkerImpl.cpp.

References CommonSections, llvm::consumeError(), llvm::dwarf_linker::DebugInfo, llvm::dwarf_linker::DebugNames, llvm::dwarf_linker::DWARFLinkerBase::DebugNames, DebugStrStrings, Emitter, forEachCompileAndTypeUnit(), llvm::dwarf_linker::parallel::DwarfUnit::Name, llvm::dwarf_linker::parallel::DwarfUnit::Namespace, llvm::dwarf_linker::DWARFLinkerBase::Object, llvm::dwarf_linker::parallel::SectionDescriptor::OS, llvm::dwarf_linker::parallel::SectionDescriptor::setSizesForSectionCreatedByAsmPrinter(), and llvm::dwarf_linker::parallel::DwarfUnit::Type.

Referenced by emitCommonSectionsAndWriteCompileUnitsToTheOutput().

emitStringSections()

void DWARFLinkerImpl::emitStringSections ( ) protected

Emit string sections.

Definition at line 1159 of file DWARFLinkerImpl.cpp.

References assert(), CommonSections, llvm::dwarf_linker::DebugLineStr, DebugLineStr, DebugLineStrStrings, llvm::dwarf_linker::DebugStr, DebugStr, DebugStrStrings, forEachOutputString(), llvm::DwarfStringPoolEntry::isIndexed(), llvm::DwarfStringPoolEntry::Offset, llvm::StringRef::size(), llvm::DwarfStringPoolEntryWithExtString::String, and llvm::String.

Referenced by emitCommonSectionsAndWriteCompileUnitsToTheOutput().

forEachCompileAndTypeUnit()

void DWARFLinkerImpl::forEachCompileAndTypeUnit ( function_ref< void(DwarfUnit *CU)> UnitHandler) protected

forEachCompileUnit()

forEachObjectSectionsSet()

forEachOutputString()

glueCompileUnitsAndWriteToTheOutput()

void DWARFLinkerImpl::glueCompileUnitsAndWriteToTheOutput ( ) protected
Error DWARFLinkerImpl::link ( ) overridevirtual

Link debug info for added files.

Implements llvm::dwarf_linker::DWARFLinkerBase.

Definition at line 89 of file DWARFLinkerImpl.cpp.

References llvm::dwarf::FormParams::AddrSize, ArtificialTypeUnit, llvm::ThreadPoolInterface::async(), llvm::big, llvm::DIDumpOptions::ChildRecurseDepth, CommonSections, llvm::dwarf::DWARF32, llvm::DWARFDie::find(), GlobalData, glueCompileUnitsAndWriteToTheOutput(), llvm::hardware_concurrency(), llvm::dwarf_linker::parallel::isODRLanguage(), llvm::little, llvm::native, ObjectContexts, llvm::optimal_concurrency(), llvm::outs(), OverallNumberOfCU, llvm::parallel::TaskGroup::spawn(), llvm::parallel::strategy, llvm::Error::success(), llvm::dwarf::toUnsigned(), UniqueUnitID, validateAndUpdateOptions(), llvm::DIDumpOptions::Verbose, verifyInput(), and llvm::SingleThreadExecutor::wait().

patchOffsetsAndSizes()

void DWARFLinkerImpl::patchOffsetsAndSizes ( ) protected

printStatistic()

void DWARFLinkerImpl::printStatistic ( ) protected

setOutputDWARFHandler()

void llvm::dwarf_linker::parallel::DWARFLinkerImpl::setOutputDWARFHandler ( const Triple & TargetTriple, SectionHandlerTy SectionHandler ) inlineoverridevirtual

validateAndUpdateOptions()

Error DWARFLinkerImpl::validateAndUpdateOptions ( ) protected

verifyInput()

writeCommonSectionsToTheOutput()

void DWARFLinkerImpl::writeCommonSectionsToTheOutput ( ) protected

writeCompileUnitsToTheOutput()

void DWARFLinkerImpl::writeCompileUnitsToTheOutput ( ) protected

DependencyTracker


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