From 0a324d8ccb47f79b3f513318aef1d67f2a1aa4d0 Mon Sep 17 00:00:00 2001 From: ethan Date: Sun, 11 Oct 2026 15:45:26 -0700 Subject: [PATCH] fix(relinker): resolve .suprx guest module aliases --- .../relinker/src/guest/GuestModuleBuilder.cpp | 2 +- .../tests/test_guest_needed_modules.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/core/relinker/relinker/src/guest/GuestModuleBuilder.cpp b/core/relinker/relinker/src/guest/GuestModuleBuilder.cpp index d51c4c160..8d1ddeb71 100644 --- a/core/relinker/relinker/src/guest/GuestModuleBuilder.cpp +++ b/core/relinker/relinker/src/guest/GuestModuleBuilder.cpp @@ -44,7 +44,7 @@ std::string FoldFilename(std::string name) { std::string ModuleStem(std::string name, const bool windows) { if (windows) name = FoldFilename(std::move(name)); - for (const std::string_view suffix : {".debug_prx", ".sprx", ".prx"}) { + for (const std::string_view suffix : {".debug_prx", ".suprx", ".sprx", ".prx"}) { if (name.size() > suffix.size() && name.ends_with(suffix)) return name.substr(0, name.size() - suffix.size()); } return {}; diff --git a/core/relinker/relinker/tests/test_guest_needed_modules.py b/core/relinker/relinker/tests/test_guest_needed_modules.py index adc9b97da..d15b96ac9 100644 --- a/core/relinker/relinker/tests/test_guest_needed_modules.py +++ b/core/relinker/relinker/tests/test_guest_needed_modules.py @@ -142,6 +142,24 @@ def main(): needed = needed_libraries(output.read_bytes()) assert needed == [f"$ORIGIN/app0/{directory}/needed.prx.guest.prx"], needed + for requested, physical in ((b"needed.suprx", "needed.prx"), + (b"needed.prx", "needed.suprx"), + (b"needed.sprx", "needed.suprx"), + (b"needed.debug_prx", "needed.suprx")): + case = work / f"{windows}-suprx-alias-{requested.decode()}-{physical}" + (case / "sce_module").mkdir(parents=True) + (case / "sce_module" / physical).write_bytes(module_with_symbol(True)) + result, output = convert(case, windows, requested) + assert result.returncode == 0, (result.stdout, result.stderr) + artifact = case / "app0" / "sce_module" / (physical + ".guest.prx") + assert artifact.is_file(), (requested, physical, result.stdout) + if not windows: + needed = needed_libraries(output.read_bytes()) + assert needed == [f"$ORIGIN/app0/sce_module/{physical}.guest.prx"], needed + elif os.name == "nt": + run = subprocess.run([str(output)], capture_output=True, text=True, timeout=30) + assert run.returncode == 42, (run.returncode, run.stdout, run.stderr) + if windows: case = work / "debug-name-case" (case / "prx").mkdir(parents=True)