summaryrefslogtreecommitdiff
path: root/Userland/DynamicLoader
diff options
context:
space:
mode:
authorGunnar Beutner <gbeutner@serenityos.org>2021-06-29 00:40:17 +0200
committerAndreas Kling <kling@serenityos.org>2021-06-29 20:03:36 +0200
commitd13842454940bc7f5537161d885789111ffbbd43 (patch)
treee24c421e735b33e4505d22ce8021e7c3c0784d5c /Userland/DynamicLoader
parent3cfe1a89145215052b57f9806cb97939761519de (diff)
downloadserenity-d13842454940bc7f5537161d885789111ffbbd43.zip
DynamicLoader: Implement self relocations for x86_64
Diffstat (limited to 'Userland/DynamicLoader')
-rw-r--r--Userland/DynamicLoader/main.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/Userland/DynamicLoader/main.cpp b/Userland/DynamicLoader/main.cpp
index 0b1924e5b8..bc18a5f361 100644
--- a/Userland/DynamicLoader/main.cpp
+++ b/Userland/DynamicLoader/main.cpp
@@ -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;
});
}