瀏覽代碼

DynamicLoader: Stop performing relative relocations on non-pie objects

Co-authored-by: Daniel Bertalan <dani@danielbertalan.dev>
Idan Horowitz 3 年之前
父節點
當前提交
fbeef409c6
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      Userland/Libraries/LibELF/DynamicLoader.cpp

+ 2 - 0
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 :)