summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Bertalan <dani@danielbertalan.dev>2022-03-13 08:30:34 +0100
committerAndreas Kling <kling@serenityos.org>2022-05-01 12:42:01 +0200
commited5f110b402bc6fa48ee4efbfcffd94f43a061f3 (patch)
tree7d84f66953799fbe2b6bfd641278242c14519f8c
parent435a263998440ea880ef1d20b7d3f1c8fb8a5a10 (diff)
downloadserenity-ed5f110b402bc6fa48ee4efbfcffd94f43a061f3.zip
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.
-rw-r--r--Userland/Libraries/LibELF/DynamicLoader.cpp2
1 files changed, 1 insertions, 1 deletions
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<NonnullRefPtr<DynamicObject>, DlErrorMessage> DynamicLoader::load_stage_3(unsigned flags)