fix(relinker): skip backup copies of guest modules in the online converter too #10997

Merged
SandstromPL merged 1 commit from upstream-pr/10997 into main 2026-10-26 21:58:33 +00:00
SandstromPL commented 2026-10-25 13:20:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SandstromPL on 2026-10-25T13:20:07Z.


What

#7380 made the command-line relinker skip a dumper's backup copy of a module. That is an ELF module whose file name extends another module's in the same directory, with the same SONAME, such as libX.prx.esbak or libX.prxbak next to libX.prx. #7418 then allowed Windows export aliases while probing.

The check lives in the CLI's ReadModules. The online converter doesn't use ReadModules: demo/web/archive.mjs hands every ELF in sce_module/ to Bindings.cpp, and from there to Conversion. So the online converter still stops on these layouts with Ambiguous guest dependency name: libX.prx. #7380 left that as a follow-up under "Not covered". Its examples are Furi (#7020), with .prx, .prx.esbak and .prxbak copies of each module, and Dreaming Sarah (#3018), with libc.prx.esbak.

The check moves into the relinker core as RemoveBackupCopies:

  • Conversion::Convert runs it before patching or converting modules. It reports each skipped copy through the progress messages, so the online converter shows the same Skipping backup copy: … line the command line prints.
  • ReadModules calls the same function, so the command line and --verify-patches behave as before. A module list that ReadModules has already filtered passes through Convert unchanged.
  • docs/user/USAGE.md now says both the command line and the online converter skip backup copies.

The online converter's packager copies the untouched backup files into the output app, as the command line leaves them on disk.

Tested

Linux (Ubuntu 24.04, GCC 13.3), relinker-only build (-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON) on main 4017310678:

  • relinker_conversion has a new case, run for both the Linux and Windows targets.
    • It converts libSceFace.prx, libSceFace.prx.esbak and libSceFace.prxbak, all with the SONAME libSceFace.prx, through Conversion as the online converter does. It requires one converted module and both Skipping backup copy messages.
    • A .esbak with a different SONAME is still converted.
    • The test fixture gains an optional DT_SONAME.
    • Without the new call in Conversion::Convert, the case fails with Ambiguous guest dependency name: libSceFace.prx.
  • guest_module_directories passes unchanged. It holds #7380's and #7418's command-line backup-copy cases, which now go through the shared function.
  • The whole relinker suite passes: 296 of 296.
  • I couldn't build the wasm module here (no Emscripten). Bindings.cpp is unchanged and passes its modules to the same Conversion::Convert.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5005087447 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10997). Originally posted by [SandstromPL](https://github.com/SandstromPL) on 2026-10-25T13:20:07Z. --- ### What #7380 made the command-line relinker skip a dumper's backup copy of a module. That is an ELF module whose file name extends another module's in the same directory, with the same SONAME, such as `libX.prx.esbak` or `libX.prxbak` next to `libX.prx`. #7418 then allowed Windows export aliases while probing. The check lives in the CLI's `ReadModules`. The online converter doesn't use `ReadModules`: `demo/web/archive.mjs` hands every ELF in `sce_module/` to `Bindings.cpp`, and from there to `Conversion`. So the online converter still stops on these layouts with `Ambiguous guest dependency name: libX.prx`. #7380 left that as a follow-up under "Not covered". Its examples are Furi (#7020), with `.prx`, `.prx.esbak` and `.prxbak` copies of each module, and Dreaming Sarah (#3018), with `libc.prx.esbak`. The check moves into the relinker core as `RemoveBackupCopies`: - `Conversion::Convert` runs it before patching or converting modules. It reports each skipped copy through the progress messages, so the online converter shows the same `Skipping backup copy: …` line the command line prints. - `ReadModules` calls the same function, so the command line and `--verify-patches` behave as before. A module list that `ReadModules` has already filtered passes through `Convert` unchanged. - `docs/user/USAGE.md` now says both the command line and the online converter skip backup copies. The online converter's packager copies the untouched backup files into the output app, as the command line leaves them on disk. ### Tested Linux (Ubuntu 24.04, GCC 13.3), relinker-only build (`-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON`) on `main` 4017310678: - `relinker_conversion` has a new case, run for both the Linux and Windows targets. - It converts `libSceFace.prx`, `libSceFace.prx.esbak` and `libSceFace.prxbak`, all with the SONAME `libSceFace.prx`, through `Conversion` as the online converter does. It requires one converted module and both `Skipping backup copy` messages. - A `.esbak` with a different SONAME is still converted. - The test fixture gains an optional `DT_SONAME`. - Without the new call in `Conversion::Convert`, the case fails with `Ambiguous guest dependency name: libSceFace.prx`. - `guest_module_directories` passes unchanged. It holds #7380's and #7418's command-line backup-copy cases, which now go through the shared function. - The whole relinker suite passes: 296 of 296. - I couldn't build the wasm module here (no Emscripten). `Bindings.cpp` is unchanged and passes its modules to the same `Conversion::Convert`. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-25 13:31:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T13:31:01Z.

Review: APPROVED


Reviewed exact head 479fcec4ee05d861e13051216992a056ed43e945. RemoveBackupCopies centralizes the existing same-directory filename-prefix plus matching-nonempty-SONAME rule, mutates the module list once, and reports skipped paths through the converter progress interface. Both CLI loading and core conversion call it, so online conversion now follows the same rule and prefiltered CLI input remains unchanged. The new Conversion::Convert regression covers .esbak and .prxbak copies for Linux/Windows targets, requires progress messages, and confirms a similarly named module with a different SONAME is retained.

I ran python3 tools/check_conventions.py --base upstream/main --head HEAD and git diff --check upstream/main...HEAD; both pass. The author reports the full 296-test relinker suite passing. Hosted Ubuntu, Windows, macOS ARM, and ASan checks pass; macOS x86_64 is still in progress. The WebAssembly module was not built locally because Emscripten is unavailable; its unchanged binding routes modules through the tested Conversion::Convert entry point.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5643395917 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10997#pullrequestreview-5643395917). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T13:31:01Z. **Review:** APPROVED --- Reviewed exact head `479fcec4ee05d861e13051216992a056ed43e945`. `RemoveBackupCopies` centralizes the existing same-directory filename-prefix plus matching-nonempty-SONAME rule, mutates the module list once, and reports skipped paths through the converter progress interface. Both CLI loading and core conversion call it, so online conversion now follows the same rule and prefiltered CLI input remains unchanged. The new `Conversion::Convert` regression covers `.esbak` and `.prxbak` copies for Linux/Windows targets, requires progress messages, and confirms a similarly named module with a different SONAME is retained. I ran `python3 tools/check_conventions.py --base upstream/main --head HEAD` and `git diff --check upstream/main...HEAD`; both pass. The author reports the full 296-test relinker suite passing. Hosted Ubuntu, Windows, macOS ARM, and ASan checks pass; macOS x86_64 is still in progress. The WebAssembly module was not built locally because Emscripten is unavailable; its unchanged binding routes modules through the tested `Conversion::Convert` entry point.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!10997
No description provided.