handle relocation 0x01 #9

Merged
husky merged 1 commit from feature/nikocs/relocation_0x01 into develop 2025-09-14 23:34:32 -07:00
Showing only changes of commit b55b8db9bc - Show all commits

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
}