From ed5f110b402bc6fa48ee4efbfcffd94f43a061f3 Mon Sep 17 00:00:00 2001 From: Daniel Bertalan Date: Sun, 13 Mar 2022 08:30:34 +0100 Subject: LibELF: Perform .relr.dyn relocations before .rel.dyn IFUNC resolvers depend on the resolved function's address having been relocated by the time they are called. This means that relative relocations have to be done first. The linker is kind enough to put R_*_RELATIVE before R_*_IRELATIVE in .rel.dyn, but .relr.dyn contains relative relocations too. --- Userland/Libraries/LibELF/DynamicLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibELF/DynamicLoader.cpp b/Userland/Libraries/LibELF/DynamicLoader.cpp index 63bad18311..6a78df5af5 100644 --- a/Userland/Libraries/LibELF/DynamicLoader.cpp +++ b/Userland/Libraries/LibELF/DynamicLoader.cpp @@ -197,9 +197,9 @@ void DynamicLoader::do_main_relocations() } }; + do_relr_relocations(); m_dynamic_object->relocation_section().for_each_relocation(do_single_relocation); m_dynamic_object->plt_relocation_section().for_each_relocation(do_single_relocation); - do_relr_relocations(); } Result, DlErrorMessage> DynamicLoader::load_stage_3(unsigned flags) -- cgit v1.2.3