diff --git a/core/relinker/relinker/src/guest/GuestModuleBuilder.cpp b/core/relinker/relinker/src/guest/GuestModuleBuilder.cpp index 01047372f..08aec4772 100644 --- a/core/relinker/relinker/src/guest/GuestModuleBuilder.cpp +++ b/core/relinker/relinker/src/guest/GuestModuleBuilder.cpp @@ -45,7 +45,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)