LLVM 17.0.0git
Classes | Public Member Functions | List of all members
llvm::DWARFLinker Class Reference

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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ DWARFLinker()

llvm::DWARFLinker::DWARFLinker ( DwarfEmitter Emitter,
DwarfLinkerClient  ClientID = DwarfLinkerClient::General 
)
inline

Definition at line 278 of file DWARFLinker.h.

Member Function Documentation

◆ addAccelTableKind()

void llvm::DWARFLinker::addAccelTableKind ( DwarfLinkerAccelTableKind  Kind)
inline

Add kind of accelerator tables to be generated.

Definition at line 325 of file DWARFLinker.h.

References assert().

◆ addObjectFile()

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.

Precondition
NoODR, Update options should be set before call to addObjectFile.

Definition at line 2686 of file DWARFLinker.cpp.

References LLVM_UNLIKELY.

◆ link()

Error llvm::DWARFLinker::link ( )

◆ setErrorHandler()

void llvm::DWARFLinker::setErrorHandler ( messageHandler  Handler)
inline

Set error handler which would be used to report errors.

Definition at line 351 of file DWARFLinker.h.

◆ setEstimatedObjfilesAmount()

void llvm::DWARFLinker::setEstimatedObjfilesAmount ( unsigned  ObjFilesNum)
inline

Set estimated objects files amount, for preliminary data allocation.

Definition at line 341 of file DWARFLinker.h.

◆ setInputVerificationHandler()

void llvm::DWARFLinker::setInputVerificationHandler ( inputVerificationHandler  Handler)
inline

Set verification handler which would be used to report verification errors.

Definition at line 357 of file DWARFLinker.h.

◆ setKeepFunctionForStatic()

void llvm::DWARFLinker::setKeepFunctionForStatic ( bool  KeepFunctionForStatic)
inline

Set whether to keep the enclosing function for a static variable.

Definition at line 317 of file DWARFLinker.h.

◆ setNoODR()

void llvm::DWARFLinker::setNoODR ( bool  NoODR)
inline

Do not unique types according to ODR.

Definition at line 311 of file DWARFLinker.h.

◆ setNoOutput()

void llvm::DWARFLinker::setNoOutput ( bool  NoOut)
inline

Do not emit linked dwarf info.

Definition at line 308 of file DWARFLinker.h.

◆ setNumThreads()

void llvm::DWARFLinker::setNumThreads ( unsigned  NumThreads)
inline

Use specified number of threads for parallel files linking.

Definition at line 322 of file DWARFLinker.h.

◆ setObjectPrefixMap()

void llvm::DWARFLinker::setObjectPrefixMap ( objectPrefixMap Map)
inline

Set prefix map for objects.

Definition at line 367 of file DWARFLinker.h.

◆ setPrependPath()

void llvm::DWARFLinker::setPrependPath ( const std::string &  Ppath)
inline

Set prepend path for clang modules.

Definition at line 332 of file DWARFLinker.h.

◆ setStatistics()

void llvm::DWARFLinker::setStatistics ( bool  Statistics)
inline

Print statistics to standard output.

Definition at line 302 of file DWARFLinker.h.

◆ setStringsTranslator()

void llvm::DWARFLinker::setStringsTranslator ( std::function< StringRef(StringRef)>  StringsTranslator)
inline

Set translator which would be used for strings.

Definition at line 336 of file DWARFLinker.h.

◆ setSwiftInterfacesMap()

void llvm::DWARFLinker::setSwiftInterfacesMap ( swiftInterfacesMap Map)
inline

Set map for Swift interfaces.

Definition at line 362 of file DWARFLinker.h.

◆ setTargetDWARFVersion()

Error llvm::DWARFLinker::setTargetDWARFVersion ( uint16_t  TargetDWARFVersion)
inline

Set target DWARF version.

Definition at line 372 of file DWARFLinker.h.

References llvm::createStringError(), and llvm::Error::success().

◆ setUpdate()

void llvm::DWARFLinker::setUpdate ( bool  Update)
inline

update existing DWARF info(for the linked binary).

Definition at line 314 of file DWARFLinker.h.

◆ setVerbosity()

void llvm::DWARFLinker::setVerbosity ( bool  Verbose)
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.

◆ setVerifyInputDWARF()

void llvm::DWARFLinker::setVerifyInputDWARF ( bool  Verify)
inline

Verify the input DWARF.

Definition at line 305 of file DWARFLinker.h.

References Verify.

◆ setWarningHandler()

void llvm::DWARFLinker::setWarningHandler ( messageHandler  Handler)
inline

Set warning handler which would be used to report warnings.

Definition at line 346 of file DWARFLinker.h.


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