Function crate_metadata::write_relocation
source · pub fn write_relocation(
relocation_entry: RelocationEntry,
target_sec_slice: &mut [u8],
target_sec_offset: usize,
source_sec_vaddr: VirtualAddress,
verbose_log: bool
) -> Result<(), &'static str>
Expand description
Actually write the value of a relocation entry.
Arguments
relocation_entry
: the relocation entry from the ELF file that specifies the details of the relocation action to perform.target_sec_slice
: a byte slice holding the entire contents of the target section, i.e., the section where the relocation data will be written to.target_sec_offset
: the offset intotarget_sec_slice
where the target section’s contents begin.source_sec_vaddr
: theVirtualAddress
of the source section of the relocation, i.e., the section that thetarget_sec
depends on and “points” to.verbose_log
: whether to output verbose logging information about this relocation action.
Notes
- There is a great, succint table of relocation types here: https://docs.rs/goblin/0.6.0/goblin/elf/reloc/index.html.
- aarch64-specific relocation docs here: https://github.com/ARM-software/abi-aa/blob/main/aaelf64/aaelf64.rst#relocation-types.