mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-28 21:54:40 +03:00
DynamicLoader: Implement self relocations for x86_64
This commit is contained in:
parent
3cfe1a8914
commit
d138424549
Notes:
sideshowbarker
2024-07-18 11:20:39 +09:00
Author: https://github.com/gunnarbeutner Commit: https://github.com/SerenityOS/serenity/commit/d1384245494 Pull-request: https://github.com/SerenityOS/serenity/pull/8317
@ -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)));
|
auto dynamic_object = ELF::DynamicObject::create({}, (VirtualAddress(base_address)), (VirtualAddress(dynamic_section_addr)));
|
||||||
|
|
||||||
dynamic_object->relocation_section().for_each_relocation([base_address](auto& reloc) {
|
dynamic_object->relocation_section().for_each_relocation([base_address](auto& reloc) {
|
||||||
if (reloc.type() != R_386_RELATIVE)
|
#if ARCH(I386)
|
||||||
return IterationDecision::Continue;
|
VERIFY(reloc.type() == R_386_RELATIVE);
|
||||||
|
#else
|
||||||
|
VERIFY(reloc.type() == R_X86_64_RELATIVE);
|
||||||
|
#endif
|
||||||
|
|
||||||
*(u32*)reloc.address().as_ptr() += base_address;
|
*(FlatPtr*)reloc.address().as_ptr() += base_address;
|
||||||
return IterationDecision::Continue;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user