LLVM 19.0.0git
|
The core of the Dwarf linking logic. More...
#include "llvm/DWARFLinker/Classic/DWARFLinker.h"
Public Member Functions | |
DWARFLinker (MessageHandlerTy ErrorHandler, MessageHandlerTy WarningHandler, std::function< StringRef(StringRef)> StringsTranslator) | |
void | setOutputDWARFEmitter (DwarfEmitter *Emitter) |
Set output DWARF emitter. | |
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 objFiles. Object files are linked all together. | |
void | setVerbosity (bool Verbose) override |
A number of methods setting various linking options: | |
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 Update) override |
Update index tables only(do not modify rest of DWARF). | |
void | setAllowNonDeterministicOutput (bool) override |
Allow generating valid, but non-deterministic output. | |
void | setKeepFunctionForStatic (bool KeepFunctionForStatic) override |
Set whether 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. | |
![]() | |
virtual | ~DWARFLinkerBase ()=default |
virtual void | addObjectFile (DWARFFile &File, ObjFileLoaderTy Loader=nullptr, CompileUnitHandlerTy OnCUDieLoaded=[](const DWARFUnit &) {})=0 |
Add an object file to be linked. | |
virtual Error | link ()=0 |
Link the debug info for all object files added through calls to addObjectFile. | |
virtual void | setVerbosity (bool Verbose)=0 |
A number of methods setting various linking options: Enable logging to standard output. | |
virtual void | setStatistics (bool Statistics)=0 |
Print statistics to standard output. | |
virtual void | setVerifyInputDWARF (bool Verify)=0 |
Verify the input DWARF. | |
virtual void | setNoODR (bool NoODR)=0 |
Do not unique types according to ODR. | |
virtual void | setUpdateIndexTablesOnly (bool Update)=0 |
Update index tables only (do not modify rest of DWARF). | |
virtual void | setAllowNonDeterministicOutput (bool)=0 |
Allows generating non-deterministic output in exchange for more parallelism. | |
virtual void | setKeepFunctionForStatic (bool KeepFunctionForStatic)=0 |
Set whether to keep the enclosing function for a static variable. | |
virtual void | setNumThreads (unsigned NumThreads)=0 |
Use specified number of threads for parallel files linking. | |
virtual void | addAccelTableKind (AccelTableKind Kind)=0 |
Add kind of accelerator tables to be generated. | |
virtual void | setPrependPath (StringRef Ppath)=0 |
Set prepend path for clang modules. | |
virtual void | setEstimatedObjfilesAmount (unsigned ObjFilesNum)=0 |
Set estimated objects files amount, for preliminary data allocation. | |
virtual void | setInputVerificationHandler (InputVerificationHandlerTy Handler)=0 |
Set verification handler used to report verification errors. | |
virtual void | setSwiftInterfacesMap (SwiftInterfacesMapTy *Map)=0 |
Set map for Swift interfaces. | |
virtual void | setObjectPrefixMap (ObjectPrefixMapTy *Map)=0 |
Set prefix map for objects. | |
virtual Error | setTargetDWARFVersion (uint16_t TargetDWARFVersion)=0 |
Set target DWARF version. | |
Static Public Member Functions | |
static std::unique_ptr< DWARFLinker > | createLinker (MessageHandlerTy ErrorHandler, MessageHandlerTy WarningHandler, std::function< StringRef(StringRef)> StringsTranslator=nullptr) |
Additional Inherited Members | |
![]() | |
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 = std::function< void(const Twine &Warning, StringRef Context, const DWARFDie *DIE)> |
using | ObjFileLoaderTy = std::function< ErrorOr< DWARFFile & >(StringRef ContainerName, StringRef Path)> |
using | InputVerificationHandlerTy = std::function< void(const DWARFFile &File, llvm::StringRef Output)> |
using | ObjectPrefixMapTy = std::map< std::string, std::string > |
using | CompileUnitHandlerTy = function_ref< void(const DWARFUnit &Unit)> |
using | SwiftInterfacesMapTy = std::map< std::string, std::string > |
The core of the Dwarf linking logic.
The generation of the dwarf information from the object files will be driven by the selection of 'root DIEs', which are DIEs that describe variables or functions that resolves to the corresponding code section(and thus have entries in the Addresses map). All the debug information that will be generated(the DIEs, but also the line tables, ranges, ...) is derived from that set of root DIEs.
The root DIEs are identified because they contain relocations that points to code section(the low_pc for a function, the location for a variable). These relocations are called ValidRelocs in the AddressesInfo and are gathered as a very first step when we start processing a object file.
Definition at line 211 of file DWARFLinker.h.
|
inline |
Definition at line 213 of file DWARFLinker.h.
|
inlineoverridevirtual |
Add kind of accelerator tables to be generated.
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 281 of file DWARFLinker.h.
References assert(), and llvm::is_contained().
|
overridevirtual |
Add object file to be linked.
Pre-load compile unit die. Call OnCUDieLoaded
for each compile unit die. If specified File
has reference to the Clang module then such module would be pre-loaded by Loader
for !Update case.
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 2675 of file DWARFLinker.cpp.
References LLVM_UNLIKELY.
|
inlinestatic |
Definition at line 218 of file DWARFLinker.h.
|
overridevirtual |
Link debug info for added objFiles. Object files are linked all together.
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 2696 of file DWARFLinker.cpp.
References llvm::analyzeContextInfo(), llvm::dwarf_linker::DWARFLinkerBase::Apple, assert(), llvm::ThreadPoolInterface::async(), llvm::DIDumpOptions::ChildRecurseDepth, llvm::dwarf_linker::DWARFLinkerBase::DebugNames, E, llvm::dwarf_linker::classic::DwarfEmitter::emitAbbrevs(), llvm::dwarf_linker::classic::DwarfEmitter::emitAppleNames(), llvm::dwarf_linker::classic::DwarfEmitter::emitAppleNamespaces(), llvm::dwarf_linker::classic::DwarfEmitter::emitAppleObjc(), llvm::dwarf_linker::classic::DwarfEmitter::emitAppleTypes(), llvm::dwarf_linker::classic::DwarfEmitter::emitDebugNames(), llvm::dwarf_linker::classic::DwarfEmitter::emitLineStrings(), llvm::dwarf_linker::classic::DwarfEmitter::emitStringOffsets(), llvm::dwarf_linker::classic::DwarfEmitter::emitStrings(), llvm::sys::path::filename(), llvm::formatv(), llvm::dwarf_linker::classic::DwarfEmitter::getDebugInfoSectionSize(), llvm::getDebugInfoSize(), llvm::getPCMFile(), llvm::dwarf_linker::classic::DeclContextTree::getRoot(), llvm::dwarf_linker::IndexedValuesMap< T >::getValues(), llvm::hardware_concurrency(), I, LHS, LLVM_LIKELY, LLVM_UNLIKELY, llvm::outs(), llvm::dwarf_linker::DWARFLinkerBase::Pub, RHS, llvm::BitVector::set(), llvm::sort(), llvm::Error::success(), llvm::StringRef::take_back(), llvm::dwarf::toString(), llvm::DIDumpOptions::Verbose, llvm::verifyKeepChain(), llvm::SingleThreadExecutor::wait(), and llvm::Warning.
|
inlineoverridevirtual |
Allow generating valid, but non-deterministic output.
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 267 of file DWARFLinker.h.
|
inlineoverridevirtual |
Set estimated objects files amount, for preliminary data allocation.
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 290 of file DWARFLinker.h.
|
inlineoverridevirtual |
Set verification handler which would be used to report verification errors.
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 297 of file DWARFLinker.h.
|
inlineoverridevirtual |
Set whether to keep the enclosing function for a static variable.
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 271 of file DWARFLinker.h.
|
inlineoverridevirtual |
Do not unique types according to ODR.
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 259 of file DWARFLinker.h.
|
inlineoverridevirtual |
Use specified number of threads for parallel files linking.
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 276 of file DWARFLinker.h.
|
inlineoverridevirtual |
Set prefix map for objects.
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 307 of file DWARFLinker.h.
|
inline |
|
inlineoverridevirtual |
Set prepend path for clang modules.
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 287 of file DWARFLinker.h.
|
inlineoverridevirtual |
Print statistics to standard output.
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 249 of file DWARFLinker.h.
|
inlineoverridevirtual |
Set map for Swift interfaces.
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 302 of file DWARFLinker.h.
|
inlineoverridevirtual |
Set target DWARF version.
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 312 of file DWARFLinker.h.
References llvm::createStringError(), and llvm::Error::success().
|
inlineoverridevirtual |
Update index tables only(do not modify rest of DWARF).
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 262 of file DWARFLinker.h.
|
inlineoverridevirtual |
A number of methods setting various linking options:
Allows to generate log of linking process to the standard output.
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 246 of file DWARFLinker.h.
References llvm::Verbose.
|
inlineoverridevirtual |
Verify the input DWARF.
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 254 of file DWARFLinker.h.
References Verify.