summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibELF/DynamicLoader.cpp
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2022-07-10 03:13:11 +0300
committerAndreas Kling <kling@serenityos.org>2022-07-10 14:24:34 +0200
commitfbeef409c6029b0a8d2b51b0e64ca44f679844ed (patch)
tree7a2d6314dc9949322f9ee348f6e3dc2c66aca850 /Userland/Libraries/LibELF/DynamicLoader.cpp
parentb700d1a474634840da86aeefd2a67b2e8a364cd6 (diff)
downloadserenity-fbeef409c6029b0a8d2b51b0e64ca44f679844ed.zip
DynamicLoader: Stop performing relative relocations on non-pie objects
Co-authored-by: Daniel Bertalan <dani@danielbertalan.dev>
Diffstat (limited to 'Userland/Libraries/LibELF/DynamicLoader.cpp')
-rw-r--r--Userland/Libraries/LibELF/DynamicLoader.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/Userland/Libraries/LibELF/DynamicLoader.cpp b/Userland/Libraries/LibELF/DynamicLoader.cpp
index 7925b0dc66..6ea9ab82db 100644
--- a/Userland/Libraries/LibELF/DynamicLoader.cpp
+++ b/Userland/Libraries/LibELF/DynamicLoader.cpp
@@ -557,6 +557,8 @@ DynamicLoader::RelocationResult DynamicLoader::do_relocation(const ELF::DynamicO
#else
case R_X86_64_RELATIVE: {
#endif
+ if (!image().is_dynamic())
+ break;
// FIXME: According to the spec, R_386_relative ones must be done first.
// We could explicitly do them first using m_number_of_relocations from DT_RELCOUNT
// However, our compiler is nice enough to put them at the front of the relocations for us :)