mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:18:11 +00:00
DynamicLoader: Implement self relocations for x86_64
This commit is contained in:
parent
3cfe1a8914
commit
d138424549
1 changed files with 6 additions and 4 deletions
|
@ -49,11 +49,13 @@ static void perform_self_relocations(auxv_t* auxvp)
|
|||
auto dynamic_object = ELF::DynamicObject::create({}, (VirtualAddress(base_address)), (VirtualAddress(dynamic_section_addr)));
|
||||
|
||||
dynamic_object->relocation_section().for_each_relocation([base_address](auto& reloc) {
|
||||
if (reloc.type() != R_386_RELATIVE)
|
||||
return IterationDecision::Continue;
|
||||
#if ARCH(I386)
|
||||
VERIFY(reloc.type() == R_386_RELATIVE);
|
||||
#else
|
||||
VERIFY(reloc.type() == R_X86_64_RELATIVE);
|
||||
#endif
|
||||
|
||||
*(u32*)reloc.address().as_ptr() += base_address;
|
||||
return IterationDecision::Continue;
|
||||
*(FlatPtr*)reloc.address().as_ptr() += base_address;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue