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.
Implementations§
source§impl<'data, Elf: FileHeader> GnuHashTable<'data, Elf>
impl<'data, Elf: FileHeader> GnuHashTable<'data, Elf>
sourcepub fn parse(endian: Elf::Endian, data: &'data [u8]) -> Result<Self>
pub fn parse(endian: Elf::Endian, data: &'data [u8]) -> Result<Self>
Parse a GNU hash table.
data
should be from a SHT_GNU_HASH
section, or from a
segment pointed to via the 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 DT_GNU_HASH
entry.
sourcepub fn symbol_base(&self) -> u32
pub fn symbol_base(&self) -> u32
Return the symbol table index of the first symbol in the hash table.
sourcepub fn symbol_table_length(&self, endian: Elf::Endian) -> Option<u32>
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.
sourcepub 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<(usize, &'data Elf::Sym)>
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<(usize, &'data Elf::Sym)>
Use the hash table to find the symbol table entry with the given name, hash, and version.
Trait Implementations§
Auto Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more