pub struct GnuHashTable<'data, Elf: FileHeader> {
symbol_base: u32,
bloom_shift: u32,
bloom_filters: &'data [u8],
buckets: &'data [U32<Elf::Endian>],
values: &'data [U32<Elf::Endian>],
}
Expand description
A GNU symbol hash table in an ELF file.
Returned by SectionHeader::gnu_hash
.
Fields§
§symbol_base: u32
§bloom_shift: u32
§bloom_filters: &'data [u8]
§buckets: &'data [U32<Elf::Endian>]
§values: &'data [U32<Elf::Endian>]
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 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.
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.
fn bucket(&self, endian: Elf::Endian, hash: u32) -> SymbolIndex
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<(SymbolIndex, &'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<(SymbolIndex, &'data Elf::Sym)>
Use the hash table to find the symbol table entry with the given name, hash, and version.