LLVM 17.0.0git
|
The core of the Dwarf linking logic. More...
#include "llvm/DWARFLinker/DWARFLinker.h"
Public Member Functions | |
DWARFLinker (DwarfEmitter *Emitter, DwarfLinkerClient ClientID=DwarfLinkerClient::General) | |
void | addObjectFile (DWARFFile &File, objFileLoader Loader=nullptr, CompileUnitHandler OnCUDieLoaded=[](const DWARFUnit &) {}) |
Add object file to be linked. | |
Error | link () |
Link debug info for added objFiles. | |
void | setVerbosity (bool Verbose) |
A number of methods setting various linking options: | |
void | setStatistics (bool Statistics) |
Print statistics to standard output. | |
void | setVerifyInputDWARF (bool Verify) |
Verify the input DWARF. | |
void | setNoOutput (bool NoOut) |
Do not emit linked dwarf info. | |
void | setNoODR (bool NoODR) |
Do not unique types according to ODR. | |
void | setUpdate (bool Update) |
update existing DWARF info(for the linked binary). | |
void | setKeepFunctionForStatic (bool KeepFunctionForStatic) |
Set whether to keep the enclosing function for a static variable. | |
void | setNumThreads (unsigned NumThreads) |
Use specified number of threads for parallel files linking. | |
void | addAccelTableKind (DwarfLinkerAccelTableKind Kind) |
Add kind of accelerator tables to be generated. | |
void | setPrependPath (const std::string &Ppath) |
Set prepend path for clang modules. | |
void | setStringsTranslator (std::function< StringRef(StringRef)> StringsTranslator) |
Set translator which would be used for strings. | |
void | setEstimatedObjfilesAmount (unsigned ObjFilesNum) |
Set estimated objects files amount, for preliminary data allocation. | |
void | setWarningHandler (messageHandler Handler) |
Set warning handler which would be used to report warnings. | |
void | setErrorHandler (messageHandler Handler) |
Set error handler which would be used to report errors. | |
void | setInputVerificationHandler (inputVerificationHandler Handler) |
Set verification handler which would be used to report verification errors. | |
void | setSwiftInterfacesMap (swiftInterfacesMap *Map) |
Set map for Swift interfaces. | |
void | setObjectPrefixMap (objectPrefixMap *Map) |
Set prefix map for objects. | |
Error | setTargetDWARFVersion (uint16_t TargetDWARFVersion) |
Set target DWARF version. | |
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 276 of file DWARFLinker.h.
|
inline |
Definition at line 278 of file DWARFLinker.h.
|
inline |
Add kind of accelerator tables to be generated.
Definition at line 325 of file DWARFLinker.h.
References assert().
void llvm::DWARFLinker::addObjectFile | ( | DWARFFile & | File, |
objFileLoader | Loader = nullptr , |
||
CompileUnitHandler | OnCUDieLoaded = [](const DWARFUnit &) {} |
||
) |
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.
Definition at line 2686 of file DWARFLinker.cpp.
References LLVM_UNLIKELY.
Error llvm::DWARFLinker::link | ( | ) |
Link debug info for added objFiles.
Object files are linked all together.
Definition at line 2707 of file DWARFLinker.cpp.
References llvm::analyzeContextInfo(), llvm::Apple, assert(), llvm::ThreadPool::async(), llvm::DIDumpOptions::ChildRecurseDepth, Context, llvm::DebugNames, llvm::Dsymutil, E, llvm::DwarfEmitter::emitAbbrevs(), llvm::DwarfEmitter::emitAppleNames(), llvm::DwarfEmitter::emitAppleNamespaces(), llvm::DwarfEmitter::emitAppleObjc(), llvm::DwarfEmitter::emitAppleTypes(), llvm::DwarfEmitter::emitDebugNames(), llvm::DwarfEmitter::emitLineStrings(), llvm::DwarfEmitter::emitStrings(), llvm::sys::path::filename(), llvm::formatv(), llvm::DwarfEmitter::getDebugInfoSectionSize(), llvm::getDebugInfoSize(), llvm::getPCMFile(), llvm::DeclContextTree::getRoot(), llvm::hardware_concurrency(), I, LHS, LLVM_LIKELY, LLVM_UNLIKELY, llvm::outs(), llvm::Pub, RHS, llvm::BitVector::set(), llvm::sort(), llvm::Error::success(), llvm::StringRef::take_back(), llvm::dwarf::toString(), llvm::DIDumpOptions::Verbose, llvm::verifyKeepChain(), llvm::ThreadPool::wait(), and llvm::Warning.
|
inline |
Set error handler which would be used to report errors.
Definition at line 351 of file DWARFLinker.h.
|
inline |
Set estimated objects files amount, for preliminary data allocation.
Definition at line 341 of file DWARFLinker.h.
|
inline |
Set verification handler which would be used to report verification errors.
Definition at line 357 of file DWARFLinker.h.
|
inline |
Set whether to keep the enclosing function for a static variable.
Definition at line 317 of file DWARFLinker.h.
|
inline |
Do not unique types according to ODR.
Definition at line 311 of file DWARFLinker.h.
|
inline |
Do not emit linked dwarf info.
Definition at line 308 of file DWARFLinker.h.
|
inline |
Use specified number of threads for parallel files linking.
Definition at line 322 of file DWARFLinker.h.
|
inline |
Set prefix map for objects.
Definition at line 367 of file DWARFLinker.h.
|
inline |
Set prepend path for clang modules.
Definition at line 332 of file DWARFLinker.h.
|
inline |
Print statistics to standard output.
Definition at line 302 of file DWARFLinker.h.
|
inline |
Set translator which would be used for strings.
Definition at line 336 of file DWARFLinker.h.
|
inline |
Set map for Swift interfaces.
Definition at line 362 of file DWARFLinker.h.
Set target DWARF version.
Definition at line 372 of file DWARFLinker.h.
References llvm::createStringError(), and llvm::Error::success().
|
inline |
update existing DWARF info(for the linked binary).
Definition at line 314 of file DWARFLinker.h.
|
inline |
A number of methods setting various linking options:
Allows to generate log of linking process to the standard output.
Definition at line 299 of file DWARFLinker.h.
References llvm::Verbose.
|
inline |
|
inline |
Set warning handler which would be used to report warnings.
Definition at line 346 of file DWARFLinker.h.