LLVM 22.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. | |
Public Member Functions inherited from llvm::dwarf_linker::DWARFLinkerBase | |
virtual | ~DWARFLinkerBase ()=default |
Static Public Member Functions | |
static std::unique_ptr< DWARFLinker > | createLinker (MessageHandlerTy ErrorHandler, MessageHandlerTy WarningHandler, std::function< StringRef(StringRef)> StringsTranslator=nullptr) |
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> |
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 215 of file DWARFLinker.h.
|
inline |
Definition at line 217 of file DWARFLinker.h.
|
inlineoverridevirtual |
Add kind of accelerator tables to be generated.
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 285 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 2925 of file DWARFLinker.cpp.
References LLVM_UNLIKELY.
|
inlinestatic |
Definition at line 222 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 2946 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::sys::path::filename(), llvm::formatv(), 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::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 271 of file DWARFLinker.h.
|
inlineoverridevirtual |
Set estimated objects files amount, for preliminary data allocation.
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 294 of file DWARFLinker.h.
|
inlineoverridevirtual |
Set verification handler which would be used to report verification errors.
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 301 of file DWARFLinker.h.
|
inlineoverridevirtual |
Set whether to keep the enclosing function for a static variable.
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 275 of file DWARFLinker.h.
|
inlineoverridevirtual |
Do not unique types according to ODR.
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 263 of file DWARFLinker.h.
|
inlineoverridevirtual |
Use specified number of threads for parallel files linking.
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 280 of file DWARFLinker.h.
|
inlineoverridevirtual |
Set prefix map for objects.
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 311 of file DWARFLinker.h.
|
inline |
|
inlineoverridevirtual |
Set prepend path for clang modules.
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 291 of file DWARFLinker.h.
|
inlineoverridevirtual |
Print statistics to standard output.
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 253 of file DWARFLinker.h.
|
inlineoverridevirtual |
Set map for Swift interfaces.
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 306 of file DWARFLinker.h.
|
inlineoverridevirtual |
Set target DWARF version.
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 316 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 266 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 250 of file DWARFLinker.h.
References llvm::Verbose.
|
inlineoverridevirtual |
Verify the input DWARF.
Implements llvm::dwarf_linker::DWARFLinkerBase.
Definition at line 258 of file DWARFLinker.h.
References Verify.