Skip to main content

visit_reloc_table

Function visit_reloc_table 

Source
unsafe fn visit_reloc_table(
    base: usize,
    symtab: *const Elf64_Sym,
    strtab: *const c_char,
    rela: *const Elf64Rela,
    count: usize,
    symbol: &[u8],
    visit: &mut dyn FnMut(*mut *mut c_void),
)
Expand description

Hand exactly the GOT slots of symbol in one relocation table to visit and nothing else — every candidate entry is name-checked so no other symbol the library imports is disturbed. It handles both the JUMP_SLOT and GLOB_DAT entry forms: an entry is skipped unless its relocation type is one of those with a nonzero symbol index whose name, resolved through symtab/strtab, is exactly symbol; the slot of a match lives at base + r_offset.