LLVM 18.0.0git
|
The core of the Dwarf linking logic. More...
#include "llvm/DWARFLinker/DWARFLinker.h"
Public Types | |
enum class | OutputFileType { Object , Assembly } |
Type of output file. More... | |
enum class | AccelTableKind : uint8_t { Apple , Pub , DebugNames } |
The kind of accelerator tables we should emit. More... | |
typedef std::function< void(const Twine &Warning, StringRef Context, const DWARFDie *DIE)> | messageHandler |
typedef std::function< void(const DWARFFile &File, llvm::StringRef Output)> | inputVerificationHandler |
typedef std::function< ErrorOr< DWARFFile & >(StringRef ContainerName, StringRef Path)> | objFileLoader |
Public Member Functions | |
DWARFLinker (messageHandler ErrorHandler, messageHandler WarningHandler, std::function< StringRef(StringRef)> StringsTranslator) | |
Error | createEmitter (const Triple &TheTriple, OutputFileType FileType, raw_pwrite_stream &OutFile) |
DwarfEmitter * | getEmitter () |
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. Object files are linked all together. | |
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 | setNoODR (bool NoODR) |
Do not unique types according to ODR. | |
void | setUpdateIndexTablesOnly (bool Update) |
Update index tables only(do not modify rest of DWARF). | |
void | setAllowNonDeterministicOutput (bool) |
Allow generating valid, but non-deterministic output. | |
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 (AccelTableKind Kind) |
Add kind of accelerator tables to be generated. | |
void | setPrependPath (const std::string &Ppath) |
Set prepend path for clang modules. | |
void | setEstimatedObjfilesAmount (unsigned ObjFilesNum) |
Set estimated objects files amount, for preliminary data allocation. | |
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. | |
Static Public Member Functions | |
static std::unique_ptr< DWARFLinker > | createLinker (messageHandler ErrorHandler, messageHandler WarningHandler, std::function< StringRef(StringRef)> StringsTranslator=nullptr) |
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 337 of file DWARFLinker.h.
typedef std::function<void(const DWARFFile &File, llvm::StringRef Output)> llvm::DWARFLinker::inputVerificationHandler |
Definition at line 367 of file DWARFLinker.h.
typedef std::function<void(const Twine &Warning, StringRef Context, const DWARFDie *DIE)> llvm::DWARFLinker::messageHandler |
Definition at line 341 of file DWARFLinker.h.
typedef std::function<ErrorOr<DWARFFile &>(StringRef ContainerName, StringRef Path)> llvm::DWARFLinker::objFileLoader |
Definition at line 370 of file DWARFLinker.h.
|
strong |
The kind of accelerator tables we should emit.
Enumerator | |
---|---|
Apple | .apple_names, .apple_namespaces, .apple_types, .apple_objc. |
Pub | .debug_pubnames, .debug_pubtypes |
DebugNames | .debug_names. |
Definition at line 362 of file DWARFLinker.h.
|
strong |
|
inline |
Definition at line 342 of file DWARFLinker.h.
|
inline |
Add kind of accelerator tables to be generated.
Definition at line 420 of file DWARFLinker.h.
References assert(), and llvm::is_contained().
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 2676 of file DWARFLinker.cpp.
References LLVM_UNLIKELY.
Error llvm::DWARFLinker::createEmitter | ( | const Triple & | TheTriple, |
OutputFileType | FileType, | ||
raw_pwrite_stream & | OutFile | ||
) |
Definition at line 3052 of file DWARFLinker.cpp.
|
inlinestatic |
Definition at line 348 of file DWARFLinker.h.
DwarfEmitter * llvm::DWARFLinker::getEmitter | ( | ) |
Definition at line 3062 of file DWARFLinker.cpp.
Error llvm::DWARFLinker::link | ( | ) |
Link debug info for added objFiles. Object files are linked all together.
Definition at line 2697 of file DWARFLinker.cpp.
References llvm::analyzeContextInfo(), Apple, assert(), llvm::ThreadPool::async(), llvm::DIDumpOptions::ChildRecurseDepth, Context, DebugNames, llvm::DebugDieValuePool::DieValues, llvm::Dsymutil, E, llvm::sys::path::filename(), llvm::formatv(), llvm::getDebugInfoSize(), llvm::getPCMFile(), llvm::DeclContextTree::getRoot(), llvm::hardware_concurrency(), I, LHS, LLVM_LIKELY, LLVM_UNLIKELY, llvm::outs(), 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 |
Allow generating valid, but non-deterministic output.
Definition at line 408 of file DWARFLinker.h.
|
inline |
Set estimated objects files amount, for preliminary data allocation.
Definition at line 429 of file DWARFLinker.h.
|
inline |
Set verification handler which would be used to report verification errors.
Definition at line 435 of file DWARFLinker.h.
|
inline |
Set whether to keep the enclosing function for a static variable.
Definition at line 412 of file DWARFLinker.h.
|
inline |
Do not unique types according to ODR.
Definition at line 402 of file DWARFLinker.h.
|
inline |
Use specified number of threads for parallel files linking.
Definition at line 417 of file DWARFLinker.h.
|
inline |
Set prefix map for objects.
Definition at line 445 of file DWARFLinker.h.
|
inline |
Set prepend path for clang modules.
Definition at line 426 of file DWARFLinker.h.
|
inline |
Print statistics to standard output.
Definition at line 396 of file DWARFLinker.h.
|
inline |
Set map for Swift interfaces.
Definition at line 440 of file DWARFLinker.h.
Set target DWARF version.
Definition at line 450 of file DWARFLinker.h.
References llvm::createStringError(), and llvm::Error::success().
|
inline |
Update index tables only(do not modify rest of DWARF).
Definition at line 405 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 393 of file DWARFLinker.h.
References llvm::Verbose.
|
inline |