LIEF: Library to Instrument Executable Formats Version 2.0.0
Loading...
Searching...
No Matches
LIEF::ELF::SymbolVersion Class Reference

Class which represents an entry defined in the DT_VERSYM dynamic entry. More...

#include <SymbolVersion.hpp>

Inheritance diagram for LIEF::ELF::SymbolVersion:
Collaboration diagram for LIEF::ELF::SymbolVersion:

Public Member Functions

 SymbolVersion (uint16_t value)
 SymbolVersion ()=default
 ~SymbolVersion () override=default
SymbolVersion & operator= (const SymbolVersion &)=default
 SymbolVersion (const SymbolVersion &)=default
uint16_t value () const
 Value associated with the symbol.
uint16_t version () const
 Version index without the GNU VERSYM_HIDDEN bit.
bool is_local () const
 Whether this symbol version is local (VER_NDX_LOCAL).
bool is_global () const
 Whether this symbol version is global (VER_NDX_GLOBAL).
bool is_hidden () const
 Whether the GNU VERSYM_HIDDEN bit is set.
void set_hidden (bool value=true)
 Set or clear the GNU VERSYM_HIDDEN bit while preserving the version index.
bool has_auxiliary_version () const
 Whether the current SymbolVersion has an auxiliary one.
SymbolVersionAux * symbol_version_auxiliary ()
 SymbolVersionAux associated with the current Version if any, or a nullptr.
const SymbolVersionAux * symbol_version_auxiliary () const
void symbol_version_auxiliary (SymbolVersionAuxRequirement &svauxr)
 Set the version's auxiliary requirement The given SymbolVersionAuxRequirement must be an existing reference in the ELF::Binary.
void drop_version (uint16_t value)
 Drop the versioning requirement and replace the value (local/global).
void as_global ()
 Redefine this version as global by dropping its auxiliary version.
void as_local ()
 Redefine this version as local by dropping its auxiliary version.
void value (uint16_t v)
void accept (Visitor &visitor) const override
Public Member Functions inherited from LIEF::Object
 Object ()
 Object (const Object &other)
Object & operator= (const Object &other)
 Object (Object &&) noexcept=default
Object & operator= (Object &&) noexcept=default
template<class T>
output_t< T > as ()
template<class T>
output_const_t< T > as () const
virtual bool operator== (const Object &other) const
virtual bool operator!= (const Object &other) const
virtual ~Object ()

Static Public Member Functions

static SymbolVersion local ()
 Generate a local SymbolVersion.
static SymbolVersion global ()
 Generate a global SymbolVersion.

Static Public Attributes

static constexpr uint16_t LOCAL_VERSION = 0
static constexpr uint16_t GLOBAL_VERSION = 1
static constexpr uint16_t HIDDEN_MASK = 0x8000
 Mask for the GNU VERSYM_HIDDEN bit.
static constexpr uint16_t VERSION_MASK = 0x7fff
 Mask for the version index (VERSYM_VERSION in the GNU implementation).

Additional Inherited Members

Public Types inherited from LIEF::Object
template<class T>
using output_t = add_pointer_t<decay_t<T>>
template<class T>
using output_const_t = add_pointer_t<add_const_t<decay_t<T>>>

Detailed Description

Class which represents an entry defined in the DT_VERSYM dynamic entry.

Constructor & Destructor Documentation

◆ SymbolVersion() [1/3]

LIEF::ELF::SymbolVersion::SymbolVersion ( uint16_t value)
inline

References value().

Referenced by global(), local(), operator<<, operator=(), and SymbolVersion().

◆ SymbolVersion() [2/3]

LIEF::ELF::SymbolVersion::SymbolVersion ( )
default

◆ ~SymbolVersion()

LIEF::ELF::SymbolVersion::~SymbolVersion ( )
overridedefault

◆ SymbolVersion() [3/3]

LIEF::ELF::SymbolVersion::SymbolVersion ( const SymbolVersion & )
default

References SymbolVersion().

Member Function Documentation

◆ accept()

void LIEF::ELF::SymbolVersion::accept ( Visitor & visitor) const
overridevirtual

Implements LIEF::Object.

◆ as_global()

void LIEF::ELF::SymbolVersion::as_global ( )
inline

Redefine this version as global by dropping its auxiliary version.

See also
as_local() drop_version()

References drop_version(), and GLOBAL_VERSION.

◆ as_local()

void LIEF::ELF::SymbolVersion::as_local ( )
inline

Redefine this version as local by dropping its auxiliary version.

See also
as_global() drop_version()

References drop_version(), and LOCAL_VERSION.

◆ drop_version()

void LIEF::ELF::SymbolVersion::drop_version ( uint16_t value)
inline

Drop the versioning requirement and replace the value (local/global).

References GLOBAL_VERSION, LOCAL_VERSION, and value().

Referenced by as_global(), and as_local().

◆ global()

SymbolVersion LIEF::ELF::SymbolVersion::global ( )
inlinestatic

Generate a global SymbolVersion.

References GLOBAL_VERSION, and SymbolVersion().

◆ has_auxiliary_version()

bool LIEF::ELF::SymbolVersion::has_auxiliary_version ( ) const
inline

Whether the current SymbolVersion has an auxiliary one.

References symbol_version_auxiliary().

◆ is_global()

bool LIEF::ELF::SymbolVersion::is_global ( ) const
inline

Whether this symbol version is global (VER_NDX_GLOBAL).

VERSYM_BASE has the same value as VER_NDX_GLOBAL, so this also identifies the base version.

References GLOBAL_VERSION, and version().

◆ is_hidden()

bool LIEF::ELF::SymbolVersion::is_hidden ( ) const
inline

Whether the GNU VERSYM_HIDDEN bit is set.

A hidden version is only available when explicitly referenced by its version name.

References HIDDEN_MASK, and value().

◆ is_local()

bool LIEF::ELF::SymbolVersion::is_local ( ) const
inline

Whether this symbol version is local (VER_NDX_LOCAL).

References LOCAL_VERSION, and version().

◆ local()

SymbolVersion LIEF::ELF::SymbolVersion::local ( )
inlinestatic

Generate a local SymbolVersion.

References LOCAL_VERSION, and SymbolVersion().

◆ operator=()

SymbolVersion & LIEF::ELF::SymbolVersion::operator= ( const SymbolVersion & )
default

References SymbolVersion().

◆ set_hidden()

void LIEF::ELF::SymbolVersion::set_hidden ( bool value = true)
inline

Set or clear the GNU VERSYM_HIDDEN bit while preserving the version index.

References HIDDEN_MASK, value(), and VERSION_MASK.

◆ symbol_version_auxiliary() [1/3]

SymbolVersionAux * LIEF::ELF::SymbolVersion::symbol_version_auxiliary ( )
inline

SymbolVersionAux associated with the current Version if any, or a nullptr.

References LIEF_LIFETIMEBOUND.

Referenced by has_auxiliary_version().

◆ symbol_version_auxiliary() [2/3]

const SymbolVersionAux * LIEF::ELF::SymbolVersion::symbol_version_auxiliary ( ) const
inline

References LIEF_LIFETIMEBOUND.

◆ symbol_version_auxiliary() [3/3]

void LIEF::ELF::SymbolVersion::symbol_version_auxiliary ( SymbolVersionAuxRequirement & svauxr)

Set the version's auxiliary requirement The given SymbolVersionAuxRequirement must be an existing reference in the ELF::Binary.

On can add a new SymbolVersionAuxRequirement by using SymbolVersionRequirement::add_aux_requirement

◆ value() [1/2]

uint16_t LIEF::ELF::SymbolVersion::value ( ) const
inline

Value associated with the symbol.

If the given SymbolVersion hasn't Auxiliary version:

  • 0 means Local
  • 1 means Global

Referenced by drop_version(), is_hidden(), set_hidden(), SymbolVersion(), and version().

◆ value() [2/2]

void LIEF::ELF::SymbolVersion::value ( uint16_t v)
inline

◆ version()

uint16_t LIEF::ELF::SymbolVersion::version ( ) const
inline

Version index without the GNU VERSYM_HIDDEN bit.

References value(), and VERSION_MASK.

Referenced by is_global(), and is_local().

Member Data Documentation

◆ GLOBAL_VERSION

uint16_t LIEF::ELF::SymbolVersion::GLOBAL_VERSION = 1
staticconstexpr

◆ HIDDEN_MASK

uint16_t LIEF::ELF::SymbolVersion::HIDDEN_MASK = 0x8000
staticconstexpr

Mask for the GNU VERSYM_HIDDEN bit.

Referenced by is_hidden(), and set_hidden().

◆ LOCAL_VERSION

uint16_t LIEF::ELF::SymbolVersion::LOCAL_VERSION = 0
staticconstexpr

◆ VERSION_MASK

uint16_t LIEF::ELF::SymbolVersion::VERSION_MASK = 0x7fff
staticconstexpr

Mask for the version index (VERSYM_VERSION in the GNU implementation).

Referenced by set_hidden(), and version().


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