Skip to content

Commit

Permalink
Add comment about allignment
Browse files Browse the repository at this point in the history
  • Loading branch information
realFlowControl committed Feb 20, 2025
1 parent 8341365 commit 1447603
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion profiling/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ unsafe fn override_got_entry(info: *mut dl_phdr_info, overwrites: *mut Vec<GotSy
let name = CStr::from_ptr(name_ptr).to_str().unwrap_or("");

if name == overwrite.symbol_name {
// Calculate the GOT entry address
// Calculate the GOT entry address. Per the ELF spec, `r_offset` for pointer-sized
// relocations (such as GOT entries) is guaranteed to be pointer-aligned, see:
// https://github.com/ARM-software/abi-aa/blob/main/aaelf64/aaelf64.rst#5733relocation-operations
let got_entry =
((*info).dlpi_addr as usize + (*rel).r_offset as usize) as *mut *mut ();

Expand Down

0 comments on commit 1447603

Please sign in to comment.