LLVM 20.0.0git
Public Member Functions | Static Public Member Functions | Protected Types | Protected Attributes | List of all members
llvm::objcopy::elf::SymbolTableSection Class Reference

#include "ObjCopy/ELF/ELFObject.h"

Inheritance diagram for llvm::objcopy::elf::SymbolTableSection:
Inheritance graph
[legend]

Public Member Functions

 SymbolTableSection ()
 
void addSymbol (Twine Name, uint8_t Bind, uint8_t Type, SectionBase *DefinedIn, uint64_t Value, uint8_t Visibility, uint16_t Shndx, uint64_t SymbolSize)
 
void prepareForLayout ()
 
bool empty () const
 
bool indicesChanged () const
 
void setShndxTable (SectionIndexSection *ShndxTable)
 
const SectionIndexSectiongetShndxTable () const
 
void fillShndxTable ()
 
const SectionBasegetStrTab () const
 
Expected< const Symbol * > getSymbolByIndex (uint32_t Index) const
 
Expected< Symbol * > getSymbolByIndex (uint32_t Index)
 
void updateSymbols (function_ref< void(Symbol &)> Callable)
 
Error removeSectionReferences (bool AllowBrokenLinks, function_ref< bool(const SectionBase *)> ToRemove) override
 
Error initialize (SectionTableRef SecTable) override
 
void finalize () override
 
Error accept (SectionVisitor &Visitor) const override
 
Error accept (MutableSectionVisitor &Visitor) override
 
Error removeSymbols (function_ref< bool(const Symbol &)> ToRemove) override
 
void replaceSectionReferences (const DenseMap< SectionBase *, SectionBase * > &FromTo) override
 
- Public Member Functions inherited from llvm::objcopy::elf::SectionBase
 SectionBase ()=default
 
 SectionBase (const SectionBase &)=default
 
virtual ~SectionBase ()=default
 
virtual Error initialize (SectionTableRef SecTable)
 
virtual void finalize ()
 
virtual Error removeSectionReferences (bool AllowBrokenLinks, function_ref< bool(const SectionBase *)> ToRemove)
 
virtual Error removeSymbols (function_ref< bool(const Symbol &)> ToRemove)
 
virtual Error accept (SectionVisitor &Visitor) const =0
 
virtual Error accept (MutableSectionVisitor &Visitor)=0
 
virtual void markSymbols ()
 
virtual void replaceSectionReferences (const DenseMap< SectionBase *, SectionBase * > &)
 
virtual bool hasContents () const
 
virtual void onRemove ()
 
virtual void restoreSymTabLink (SymbolTableSection &)
 

Static Public Member Functions

static bool classof (const SectionBase *S)
 

Protected Types

using SymPtr = std::unique_ptr< Symbol >
 

Protected Attributes

std::vector< std::unique_ptr< Symbol > > Symbols
 
StringTableSectionSymbolNames = nullptr
 
SectionIndexSectionSectionIndexTable = nullptr
 
bool IndicesChanged = false
 

Additional Inherited Members

- Public Attributes inherited from llvm::objcopy::elf::SectionBase
std::string Name
 
SegmentParentSegment = nullptr
 
uint64_t HeaderOffset = 0
 
uint32_t Index = 0
 
uint32_t OriginalIndex = 0
 
uint64_t OriginalFlags = 0
 
uint64_t OriginalType = ELF::SHT_NULL
 
uint64_t OriginalOffset = std::numeric_limits<uint64_t>::max()
 
uint64_t Addr = 0
 
uint64_t Align = 1
 
uint32_t EntrySize = 0
 
uint64_t Flags = 0
 
uint64_t Info = 0
 
uint64_t Link = ELF::SHN_UNDEF
 
uint64_t NameIndex = 0
 
uint64_t Offset = 0
 
uint64_t Size = 0
 
uint64_t Type = ELF::SHT_NULL
 
ArrayRef< uint8_tOriginalData
 
bool HasSymbol = false
 

Detailed Description

Definition at line 807 of file ELFObject.h.

Member Typedef Documentation

◆ SymPtr

using llvm::objcopy::elf::SymbolTableSection::SymPtr = std::unique_ptr<Symbol>
protected

Definition at line 819 of file ELFObject.h.

Constructor & Destructor Documentation

◆ SymbolTableSection()

llvm::objcopy::elf::SymbolTableSection::SymbolTableSection ( )
inline

Member Function Documentation

◆ accept() [1/2]

Error SymbolTableSection::accept ( MutableSectionVisitor Visitor)
overridevirtual

◆ accept() [2/2]

Error SymbolTableSection::accept ( SectionVisitor Visitor) const
overridevirtual

◆ addSymbol()

void SymbolTableSection::addSymbol ( Twine  Name,
uint8_t  Bind,
uint8_t  Type,
SectionBase DefinedIn,
uint64_t  Value,
uint8_t  Visibility,
uint16_t  Shndx,
uint64_t  SymbolSize 
)

◆ classof()

static bool llvm::objcopy::elf::SymbolTableSection::classof ( const SectionBase S)
inlinestatic

◆ empty()

bool llvm::objcopy::elf::SymbolTableSection::empty ( ) const
inline

Definition at line 829 of file ELFObject.h.

References Symbols.

Referenced by removeUnneededSections(), and replaceAndRemoveSections().

◆ fillShndxTable()

void SymbolTableSection::fillShndxTable ( )

◆ finalize()

void SymbolTableSection::finalize ( )
overridevirtual

◆ getShndxTable()

const SectionIndexSection * llvm::objcopy::elf::SymbolTableSection::getShndxTable ( ) const
inline

Definition at line 834 of file ELFObject.h.

References SectionIndexTable.

◆ getStrTab()

const SectionBase * llvm::objcopy::elf::SymbolTableSection::getStrTab ( ) const
inline

Definition at line 836 of file ELFObject.h.

References SymbolNames.

Referenced by removeUnneededSections(), and replaceAndRemoveSections().

◆ getSymbolByIndex() [1/2]

Expected< Symbol * > SymbolTableSection::getSymbolByIndex ( uint32_t  Index)

Definition at line 852 of file ELFObject.cpp.

References getSymbolByIndex(), llvm::objcopy::elf::SectionBase::Index, and Sym.

◆ getSymbolByIndex() [2/2]

Expected< const Symbol * > SymbolTableSection::getSymbolByIndex ( uint32_t  Index) const

◆ indicesChanged()

bool llvm::objcopy::elf::SymbolTableSection::indicesChanged ( ) const
inline

Definition at line 830 of file ELFObject.h.

References IndicesChanged.

◆ initialize()

Error SymbolTableSection::initialize ( SectionTableRef  SecTable)
overridevirtual

◆ prepareForLayout()

void SymbolTableSection::prepareForLayout ( )

◆ removeSectionReferences()

Error SymbolTableSection::removeSectionReferences ( bool  AllowBrokenLinks,
function_ref< bool(const SectionBase *)>  ToRemove 
)
overridevirtual

◆ removeSymbols()

Error SymbolTableSection::removeSymbols ( function_ref< bool(const Symbol &)>  ToRemove)
overridevirtual

◆ replaceSectionReferences()

void SymbolTableSection::replaceSectionReferences ( const DenseMap< SectionBase *, SectionBase * > &  FromTo)
overridevirtual

◆ setShndxTable()

void llvm::objcopy::elf::SymbolTableSection::setShndxTable ( SectionIndexSection ShndxTable)
inline

Definition at line 831 of file ELFObject.h.

References SectionIndexTable.

Referenced by llvm::objcopy::elf::SectionIndexSection::initialize().

◆ updateSymbols()

void SymbolTableSection::updateSymbols ( function_ref< void(Symbol &)>  Callable)

Definition at line 756 of file ELFObject.cpp.

References llvm::drop_begin(), llvm::ELF::STB_LOCAL, Sym, and Symbols.

Referenced by updateAndRemoveSymbols().

Member Data Documentation

◆ IndicesChanged

bool llvm::objcopy::elf::SymbolTableSection::IndicesChanged = false
protected

Definition at line 817 of file ELFObject.h.

Referenced by indicesChanged(), and removeSymbols().

◆ SectionIndexTable

SectionIndexSection* llvm::objcopy::elf::SymbolTableSection::SectionIndexTable = nullptr
protected

◆ SymbolNames

StringTableSection* llvm::objcopy::elf::SymbolTableSection::SymbolNames = nullptr
protected

Definition at line 815 of file ELFObject.h.

Referenced by finalize(), getStrTab(), prepareForLayout(), and removeSectionReferences().

◆ Symbols

std::vector<std::unique_ptr<Symbol> > llvm::objcopy::elf::SymbolTableSection::Symbols
protected

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