Merge pull request 'handle relocation 0x01' (#9) from feature/nikocs/relocation_0x01 into develop

Reviewed-on: #9
This commit is contained in:
husky 2025-09-14 23:34:32 -07:00
commit 897deba6c8

View file

@ -98,6 +98,11 @@ pub fn apply_relocation(segment_buffer: &mut [u8], current_segment_base: u32, ta
x if x == RiscVRelocationType::None as u16 => {
// do nothing
}
x if x == RiscVRelocationType::R32 as u16 => {
let ptr = relocation_header.relocation_pointer as usize;
let addr = relocation_header.target_pointer as u32 + target_segment_base;
segment_buffer[ptr..ptr+4].copy_from_slice(&addr.to_le_bytes());
}
x if x == RiscVRelocationType::CallPLT as u16 || x == RiscVRelocationType::Call as u16 => {
// these are relative, do nothing for now
}