LLVM 22.0.0git
llvm::objcopy::elf::SymbolTableSection Class Reference

#include "ObjCopy/ELF/ELFObject.h"

Inheritance diagram for llvm::objcopy::elf::SymbolTableSection:
[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 void markSymbols ()
virtual bool hasContents () const
virtual ArrayRef< uint8_tgetContents () 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 811 of file ELFObject.h.

Member Typedef Documentation

◆ SymPtr

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

Definition at line 823 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()

◆ classof()

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

◆ empty()

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

Definition at line 833 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 838 of file ELFObject.h.

References SectionIndexTable.

◆ getStrTab()

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

◆ getSymbolByIndex() [1/2]

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

◆ getSymbolByIndex() [2/2]

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

◆ indicesChanged()

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

Definition at line 834 of file ELFObject.h.

References IndicesChanged.

◆ initialize()

◆ prepareForLayout()

void SymbolTableSection::prepareForLayout ( )

Definition at line 815 of file ELFObject.cpp.

References SectionIndexTable, SymbolNames, and Symbols.

◆ 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 835 of file ELFObject.h.

References SectionIndexTable.

◆ 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, and Symbols.

Referenced by updateAndRemoveSymbols().

Member Data Documentation

◆ IndicesChanged

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

Definition at line 821 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 819 of file ELFObject.h.

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

◆ Symbols


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