LIEF: Library to Instrument Executable Formats Version 0.16.0
|
Loading...
Searching...
No Matches
Go to the documentation of this file.
16#ifndef LIEF_ELF_SYMBOL_H
17#define LIEF_ELF_SYMBOL_H
59 enum class VISIBILITY {
78 LIEF::Symbol(std::move(name), 0, 0)
82 return BINDING(value);
90 return static_cast<uint8_t
>(binding);
94 return static_cast<uint8_t
>(type);
116 uint8_t
other()
const {
129 return VISIBILITY(other_);
140 uint64_t
value()
const override {
152 uint64_t
size()
const override {
161 uint16_t
shndx()
const {
169 return symbol_version_ !=
nullptr;
175 return symbol_version_;
179 return symbol_version_;
183 return binding() == BINDING::LOCAL;
187 return binding() == BINDING::GLOBAL;
191 return binding() == BINDING::WEAK;
210 other_ =
static_cast<uint8_t
>(visibility);
219 void value(uint64_t value)
override {
223 void size(uint64_t size)
override {
241 return this->binding() == BINDING::GLOBAL;
246 return this->type() == TYPE::FUNC;
251 return this->type() == TYPE::OBJECT;
254 void accept(Visitor& visitor)
const override;
260 LIEF_API Symbol(
const T& header, ARCH arch);
262 TYPE type_ = TYPE::NOTYPE;
263 BINDING binding_ = BINDING::LOCAL;
266 Section* section_ =
nullptr;
267 SymbolVersion* symbol_version_ =
nullptr;
268 ARCH arch_ = ARCH::NONE;
Class which represents an ELF binary.
Definition ELF/Binary.hpp:59
Class which parses and transforms an ELF file into a ELF::Binary object.
Definition ELF/Parser.hpp:45
Class wich represents an ELF Section.
Definition ELF/Section.hpp:48
Class which represents an entry defined in the DT_VERSYM dynamic entry.
Definition SymbolVersion.hpp:32
Class which represents an ELF symbol.
Definition ELF/Symbol.hpp:35
void accept(Visitor &visitor) const override
Symbol(const Symbol &other)
const SymbolVersion * symbol_version() const
Definition ELF/Symbol.hpp:178
void shndx(uint16_t idx)
Definition ELF/Symbol.hpp:215
void set_imported(bool flag=true)
Set whether or not the symbol is imported.
uint8_t other() const
Alias for visibility()
Definition ELF/Symbol.hpp:118
~Symbol() override=default
void type(TYPE type)
Definition ELF/Symbol.hpp:197
std::string demangled_name() const
Symbol's unmangled name. If not available, it returns an empty string.
bool is_exported() const
Check if the current symbol is exported.
void binding(BINDING binding)
Definition ELF/Symbol.hpp:201
uint8_t information() const
This member specifies the symbol's type and binding attributes.
TYPE type() const
The symbol's type provides a general classification for the associated entity.
Definition ELF/Symbol.hpp:105
uint64_t size() const override
Symbol size.
Definition ELF/Symbol.hpp:158
void value(uint64_t value) override
Definition ELF/Symbol.hpp:219
BINDING
Definition ELF/Symbol.hpp:40
bool is_variable() const
True if the symbol represent a variable.
Definition ELF/Symbol.hpp:250
const Section * section() const
Definition ELF/Symbol.hpp:137
BINDING binding() const
The symbol's binding determines the linkage visibility and behavior.
Definition ELF/Symbol.hpp:110
Symbol(std::string name)
Definition ELF/Symbol.hpp:77
uint16_t shndx() const
Definition ELF/Symbol.hpp:163
bool is_local() const
Definition ELF/Symbol.hpp:182
bool is_global() const
Definition ELF/Symbol.hpp:186
void size(uint64_t size) override
Definition ELF/Symbol.hpp:223
Symbol & operator=(Symbol other)
uint16_t section_idx() const
ELF::Section index associated with the symbol.
Definition ELF/Symbol.hpp:123
TYPE
Type of the symbol. This enum matches the STT_xxx values of the ELF specs.
Definition ELF/Symbol.hpp:49
void visibility(VISIBILITY visibility)
Definition ELF/Symbol.hpp:209
void set_exported(bool flag=true)
Set whether or not the symbol is exported.
bool is_imported() const
Check if the current symbol is imported.
static BINDING binding_from(uint32_t value, ARCH)
Definition ELF/Symbol.hpp:81
Section * section()
Section associated with the symbol or a nullptr if it does not exist.
Definition ELF/Symbol.hpp:133
bool is_weak() const
Definition ELF/Symbol.hpp:190
bool has_version() const
Check if this symbols has a symbol version .
Definition ELF/Symbol.hpp:168
static TYPE type_from(uint32_t value, ARCH)
Definition ELF/Symbol.hpp:85
void other(uint8_t other)
Definition ELF/Symbol.hpp:205
void information(uint8_t info)
VISIBILITY visibility() const
Symbol visibility.
Definition ELF/Symbol.hpp:128
SymbolVersion * symbol_version()
Return the SymbolVersion associated with this symbol. If there is no symbol version,...
Definition ELF/Symbol.hpp:174
static uint8_t to_value(TYPE type)
Definition ELF/Symbol.hpp:93
uint64_t value() const override
This member has slightly different interpretations:
Definition ELF/Symbol.hpp:149
bool is_static() const
True if the symbol is a static one.
Definition ELF/Symbol.hpp:240
bool is_function() const
True if the symbol represent a function.
Definition ELF/Symbol.hpp:245
static uint8_t to_value(BINDING binding)
Definition ELF/Symbol.hpp:89
VISIBILITY
Visibility of the symbol. This enum matches the STV_xxx values of the official ELF specs.
Definition ELF/Symbol.hpp:62
friend std::ostream & operator<<(std::ostream &os, const Symbol &entry)
Namespace related to the LIEF's ELF module.
Definition Abstract/Header.hpp:28
const char * to_string(DynamicEntry::TAG e)
ARCH
Definition ELF/enums.hpp:30
LIEF namespace.
Definition Abstract/Binary.hpp:36
#define LIEF_API
Definition visibility.h:41