LLVM 24.0.0git
llvm::dwarf_linker::AddressesMap Class Referenceabstract

AddressesMap represents information about valid addresses used by debug information. More...

#include "llvm/DWARFLinker/AddressesMap.h"

Classes

struct  SymbolRange
 The extent the linker gave a symbol, in source address space. More...

Public Member Functions

virtual ~AddressesMap ()=default
virtual bool hasValidRelocs ()=0
 Checks that there are valid relocations in the .debug_info section.
virtual std::optional< int64_t > getExprOpAddressRelocAdjustment (DWARFUnit &U, const DWARFExpression::Operation &Op, uint64_t StartOffset, uint64_t EndOffset, bool Verbose)=0
 Checks that the specified DWARF expression operand Op references live code section and returns the relocation adjustment value (to get the linked address this value might be added to the source expression operand address).
virtual std::optional< int64_t > getSubprogramRelocAdjustment (const DWARFDie &DIE, bool Verbose)=0
 Checks that the specified subprogram DIE references the live code section and returns the relocation adjustment value (to get the linked address this value might be added to the source subprogram address).
virtual std::optional< StringRefgetLibraryInstallName ()=0
virtual bool applyValidRelocs (MutableArrayRef< char > Data, uint64_t BaseOffset, bool IsLittleEndian)=0
 Apply the valid relocations to the buffer Data, taking into account that Data is at BaseOffset in the .debug_info section.
virtual bool needToSaveValidRelocs ()=0
 Check if the linker needs to gather and save relocation info.
virtual void updateAndSaveValidRelocs (bool IsDWARF5, uint64_t OriginalUnitOffset, int64_t LinkedOffset, uint64_t StartOffset, uint64_t EndOffset)=0
 Update and save relocation values to be serialized.
virtual void updateRelocationsWithUnitOffset (uint64_t OriginalUnitOffset, uint64_t OutputUnitOffset)=0
 Update the valid relocations that used OriginalUnitOffset as the compile unit offset, and update their values to reflect OutputUnitOffset.
virtual void clear ()=0
 Erases all data.
virtual std::optional< SymbolRangegetSymbolRangeForAddress (uint64_t Addr)
 Returns the symbol range [LowPC, HighPC) containing Addr, if known.
virtual std::optional< uint64_tgetNextLinkedSymbolStart (uint64_t LinkedAddr)
 Returns the linked address of the first symbol placed at or after LinkedAddr, if one is known.
uint64_t constrainCodeRangeHighPC (uint64_t LowPC, uint64_t HighPC, int64_t Adjustment)
 Constrains the end of the code range starting at LowPC, whose addresses shift by Adjustment in the output.
std::pair< bool, std::optional< int64_t > > getVariableRelocAdjustment (const DWARFDie &DIE, bool Verbose)
 This function checks whether variable has DWARF expression containing operation referencing live address(f.e.

Detailed Description

AddressesMap represents information about valid addresses used by debug information.

Valid addresses are those which points to live code sections. i.e. relocations for these addresses point into sections which would be/are placed into resulting binary.

Definition at line 30 of file AddressesMap.h.

Constructor & Destructor Documentation

◆ ~AddressesMap()

virtual llvm::dwarf_linker::AddressesMap::~AddressesMap ( )
virtualdefault

Member Function Documentation

◆ applyValidRelocs()

virtual bool llvm::dwarf_linker::AddressesMap::applyValidRelocs ( MutableArrayRef< char > Data,
uint64_t BaseOffset,
bool IsLittleEndian )
pure virtual

Apply the valid relocations to the buffer Data, taking into account that Data is at BaseOffset in the .debug_info section.

Returns
true whether any reloc has been applied.

References llvm::Data.

◆ clear()

virtual void llvm::dwarf_linker::AddressesMap::clear ( )
pure virtual

Erases all data.

◆ constrainCodeRangeHighPC()

uint64_t llvm::dwarf_linker::AddressesMap::constrainCodeRangeHighPC ( uint64_t LowPC,
uint64_t HighPC,
int64_t Adjustment )
inline

Constrains the end of the code range starting at LowPC, whose addresses shift by Adjustment in the output.

HighPC is an address, not a length.

The linker places symbols independently, so a range overrunning the symbol it starts in can cover a different one once linked. Only that overlap is repaired.

Definition at line 113 of file AddressesMap.h.

References assert(), getNextLinkedSymbolStart(), and getSymbolRangeForAddress().

Referenced by llvm::constrainHighPC().

◆ getExprOpAddressRelocAdjustment()

virtual std::optional< int64_t > llvm::dwarf_linker::AddressesMap::getExprOpAddressRelocAdjustment ( DWARFUnit & U,
const DWARFExpression::Operation & Op,
uint64_t StartOffset,
uint64_t EndOffset,
bool Verbose )
pure virtual

Checks that the specified DWARF expression operand Op references live code section and returns the relocation adjustment value (to get the linked address this value might be added to the source expression operand address).

Print debug output if Verbose is true.

Returns
relocation adjustment value or std::nullopt if there is no corresponding live address.

References llvm::Verbose.

Referenced by getVariableRelocAdjustment().

◆ getLibraryInstallName()

virtual std::optional< StringRef > llvm::dwarf_linker::AddressesMap::getLibraryInstallName ( )
pure virtual

◆ getNextLinkedSymbolStart()

virtual std::optional< uint64_t > llvm::dwarf_linker::AddressesMap::getNextLinkedSymbolStart ( uint64_t LinkedAddr)
inlinevirtual

Returns the linked address of the first symbol placed at or after LinkedAddr, if one is known.

Definition at line 102 of file AddressesMap.h.

Referenced by constrainCodeRangeHighPC().

◆ getSubprogramRelocAdjustment()

virtual std::optional< int64_t > llvm::dwarf_linker::AddressesMap::getSubprogramRelocAdjustment ( const DWARFDie & DIE,
bool Verbose )
pure virtual

Checks that the specified subprogram DIE references the live code section and returns the relocation adjustment value (to get the linked address this value might be added to the source subprogram address).

Allowed kinds of input DIE: DW_TAG_subprogram, DW_TAG_label. Print debug output if Verbose is true.

Returns
relocation adjustment value or std::nullopt if there is no corresponding live address.

References llvm::Verbose.

◆ getSymbolRangeForAddress()

virtual std::optional< SymbolRange > llvm::dwarf_linker::AddressesMap::getSymbolRangeForAddress ( uint64_t Addr)
inlinevirtual

Returns the symbol range [LowPC, HighPC) containing Addr, if known.

Definition at line 95 of file AddressesMap.h.

Referenced by constrainCodeRangeHighPC().

◆ getVariableRelocAdjustment()

std::pair< bool, std::optional< int64_t > > llvm::dwarf_linker::AddressesMap::getVariableRelocAdjustment ( const DWARFDie & DIE,
bool Verbose )
inline

This function checks whether variable has DWARF expression containing operation referencing live address(f.e.

DW_OP_addr, DW_OP_addrx...).

Returns
first is true if the expression has an operation referencing an address. second is the relocation adjustment value if the live address is referenced.

Definition at line 139 of file AddressesMap.h.

References assert(), llvm::Data, getExprOpAddressRelocAdjustment(), llvm::DIE::getOffset(), llvm::DIE::getTag(), llvm::dwarf::isTlsAddressOp(), and llvm::Verbose.

◆ hasValidRelocs()

virtual bool llvm::dwarf_linker::AddressesMap::hasValidRelocs ( )
pure virtual

Checks that there are valid relocations in the .debug_info section.

◆ needToSaveValidRelocs()

virtual bool llvm::dwarf_linker::AddressesMap::needToSaveValidRelocs ( )
pure virtual

Check if the linker needs to gather and save relocation info.

◆ updateAndSaveValidRelocs()

virtual void llvm::dwarf_linker::AddressesMap::updateAndSaveValidRelocs ( bool IsDWARF5,
uint64_t OriginalUnitOffset,
int64_t LinkedOffset,
uint64_t StartOffset,
uint64_t EndOffset )
pure virtual

Update and save relocation values to be serialized.

◆ updateRelocationsWithUnitOffset()

virtual void llvm::dwarf_linker::AddressesMap::updateRelocationsWithUnitOffset ( uint64_t OriginalUnitOffset,
uint64_t OutputUnitOffset )
pure virtual

Update the valid relocations that used OriginalUnitOffset as the compile unit offset, and update their values to reflect OutputUnitOffset.


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