From 3ee06a91df6975851660ae497bff7a79d61a9f96 Mon Sep 17 00:00:00 2001 From: Stephen Miller <56742918+StevenMiller123@users.noreply.github.com> Date: Tue, 10 Mar 2026 00:25:45 -0500 Subject: [PATCH] Relocate imports on HLE loads (#4113) Now that dynamic HLE loads happen after the eboot loads, HLEs for most "preload" modules wouldn't detect if you didn't have libSceRtc dumped. This was because, while we stored all the new symbols from the HLE lib, we weren't relocating loaded modules to use these symbols. --- src/core/libraries/sysmodule/sysmodule_internal.cpp | 4 ++++ src/core/linker.h | 7 +++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/core/libraries/sysmodule/sysmodule_internal.cpp b/src/core/libraries/sysmodule/sysmodule_internal.cpp index 55acded94..def410e25 100644 --- a/src/core/libraries/sysmodule/sysmodule_internal.cpp +++ b/src/core/libraries/sysmodule/sysmodule_internal.cpp @@ -252,6 +252,10 @@ s32 loadModuleInternal(s32 index, s32 argc, const void* argv, s32* res_out) { if (init_func) { LOG_INFO(Loader, "Can't Load {} switching to HLE", mod_name); init_func(&linker->GetHLESymbols()); + + // When loading HLEs, we need to relocate imports + // This ensures later module loads can see our HLE functions. + linker->RelocateAllImports(); } else { LOG_INFO(Loader, "No HLE available for {} module", mod_name); } diff --git a/src/core/linker.h b/src/core/linker.h index 8ffcd9d45..3cb59d9ee 100644 --- a/src/core/linker.h +++ b/src/core/linker.h @@ -125,11 +125,10 @@ public: } } - void LoadSharedLibraries() { + void RelocateAllImports() { + std::scoped_lock lk{mutex}; for (auto& module : m_modules) { - if (module->IsSharedLib()) { - module->Start(0, nullptr, nullptr); - } + Relocate(module.get()); } }