elf_loader 0.15.1

A no_std-friendly ELF loader, runtime linker, and JIT linker for Rust.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::elf::{ElfLayout, ElfShdr, ElfStringTable, ElfSymbol, HashTable, SymbolTable};

impl<L: ElfLayout> SymbolTable<L> {
    /// Creates a symbol table from section headers, typically used for relocatable objects.
    pub(crate) fn from_shdrs(symtab: &ElfShdr<L>, shdrs: &[ElfShdr<L>]) -> Self {
        let strtab_shdr = &shdrs[symtab.sh_link() as usize];
        let strtab = ElfStringTable::new(strtab_shdr.sh_addr() as *const u8);
        let hashtab = HashTable::from_shdr(symtab, &strtab);

        Self {
            hashtab,
            symtab: symtab.sh_addr() as *const ElfSymbol<L>,
            strtab,
            #[cfg(feature = "version")]
            version: None,
        }
    }
}