Struct object::read::elf::GnuHashTable

source ·
pub struct GnuHashTable<'data, Elf: FileHeader> { /* private fields */ }
Expand description

A GNU symbol hash table in an ELF file.

Returned by SectionHeader::gnu_hash.

Implementations§

source§

impl<'data, Elf: FileHeader> GnuHashTable<'data, Elf>

source

pub fn parse(endian: Elf::Endian, data: &'data [u8]) -> Result<Self>

Parse a GNU hash table.

data should be from an elf::SHT_GNU_HASH section, or from a segment pointed to via the elf::DT_GNU_HASH entry.

The header is read at offset 0 in the given data.

The header does not contain a length field, and so all of data will be used as the hash table values. It does not matter if this is longer than needed, and this will often the case when accessing the hash table via the elf::DT_GNU_HASH entry.

source

pub fn symbol_base(&self) -> u32

Return the symbol table index of the first symbol in the hash table.

source

pub fn symbol_table_length(&self, endian: Elf::Endian) -> Option<u32>

Determine the symbol table length by finding the last entry in the hash table.

Returns None if the hash table is empty or invalid.

source

pub fn find<R: ReadRef<'data>>( &self, endian: Elf::Endian, name: &[u8], hash: u32, version: Option<&Version<'_>>, symbols: &SymbolTable<'data, Elf, R>, versions: &VersionTable<'data, Elf>, ) -> Option<(SymbolIndex, &'data Elf::Sym)>

Use the hash table to find the symbol table entry with the given name, hash, and version.

Trait Implementations§

source§

impl<'data, Elf: Debug + FileHeader> Debug for GnuHashTable<'data, Elf>
where Elf::Endian: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'data, Elf> Freeze for GnuHashTable<'data, Elf>

§

impl<'data, Elf> RefUnwindSafe for GnuHashTable<'data, Elf>
where <Elf as FileHeader>::Endian: RefUnwindSafe,

§

impl<'data, Elf> Send for GnuHashTable<'data, Elf>
where <Elf as FileHeader>::Endian: Sync,

§

impl<'data, Elf> Sync for GnuHashTable<'data, Elf>
where <Elf as FileHeader>::Endian: Sync,

§

impl<'data, Elf> Unpin for GnuHashTable<'data, Elf>

§

impl<'data, Elf> UnwindSafe for GnuHashTable<'data, Elf>
where <Elf as FileHeader>::Endian: RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.