fix(relinker): name the bundled module dropped for being a SELF container #4623

Closed
Dextroid17 wants to merge 1 commit from upstream-pr/4623 into main
Dextroid17 commented 2026-10-12 16:59:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-12T16:59:13Z.


What

Fixes #4488.

Since the module scan stopped throwing on a SELF candidate (#3397), a bundled module in a SELF container
is silently left out of the conversion. GuestModuleBuilder::Build computes a self flag for every
candidate and then discards it: isElf returns false for a SELF container exactly as it does for any
other non-ELF file, and the caller only pushes the ones that pass. A user whose module is skipped gets no
line naming the file, and docs/user/USAGE.md still documents the previous behaviour ("A bundled module
in a SELF container is an error, as the executable is").

Wire the flag that is already there into the else of the ELF test, so the drop reports itself:

bool self = false;
if (isElf(entry.path(), self)) paths.push_back(entry.path());
else if (self) std::cout << "Skipping " << Io::Utf8Path(entry.path()) << ": a SELF container, not an ELF" << std::endl;

One call site, no new members, and no change to which files are converted — a skip that already happened
now names itself. The second file corrects the USAGE.md sentence the code now contradicts: "A bundled
module in a SELF container is skipped, and named in the output; the input executable must still be a clean
ELF."

If skipping SELF modules was not the intent and the throw should return, the diagnostic is still the
right first step — it makes the drop visible either way — but that USAGE.md line should then be restored
instead of rewritten. I read #3397 as deliberate and wrote the doc to match.

Tested

CachyOS Linux, GCC 16.2.1, Release, on upstream main 2a5eca11c (this PR's parent commit):

  • the relinker target builds clean, and tools/check_conventions.py --base upstream/main passes;
  • test_guest_module_directories.py passes, including the -self-* cases #3397 changed to expect the
    skip, so the skip itself is unchanged and only the reporting is new;
  • the line fires. Reproducing the test's own SELF case by hand now prints (excerpt — the NID lines that
    sit between the header and the message are elided):
System: Linux; unused-filter=0
sce_module/*.prx processing: enabled
…
Skipping …/False-self-4f153d1d/sce_module/libc.prx: a SELF container, not an ELF

where before there was no line naming the file at all.

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 in TechnicalDebt — no unimplemented path here; this removes a silent drop
  • 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 — none added
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4832533361 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4623). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-12T16:59:13Z. --- ### What Fixes #4488. Since the module scan stopped throwing on a SELF candidate (#3397), a bundled module in a SELF container is silently left out of the conversion. `GuestModuleBuilder::Build` computes a `self` flag for every candidate and then discards it: `isElf` returns `false` for a SELF container exactly as it does for any other non-ELF file, and the caller only pushes the ones that pass. A user whose module is skipped gets no line naming the file, and `docs/user/USAGE.md` still documents the previous behaviour ("A bundled module in a SELF container is an error, as the executable is"). Wire the flag that is already there into the `else` of the ELF test, so the drop reports itself: ```cpp bool self = false; if (isElf(entry.path(), self)) paths.push_back(entry.path()); else if (self) std::cout << "Skipping " << Io::Utf8Path(entry.path()) << ": a SELF container, not an ELF" << std::endl; ``` One call site, no new members, and no change to which files are converted — a skip that already happened now names itself. The second file corrects the USAGE.md sentence the code now contradicts: *"A bundled module in a SELF container is skipped, and named in the output; the input executable must still be a clean ELF."* If skipping SELF modules was *not* the intent and the throw should return, the diagnostic is still the right first step — it makes the drop visible either way — but that USAGE.md line should then be restored instead of rewritten. I read #3397 as deliberate and wrote the doc to match. ### Tested CachyOS Linux, GCC 16.2.1, Release, on upstream `main` `2a5eca11c` (this PR's parent commit): - the `relinker` target builds clean, and `tools/check_conventions.py --base upstream/main` passes; - `test_guest_module_directories.py` passes, including the `-self-*` cases #3397 changed to expect the skip, so the skip itself is unchanged and only the reporting is new; - the line fires. Reproducing the test's own SELF case by hand now prints (excerpt — the NID lines that sit between the header and the message are elided): ``` System: Linux; unused-filter=0 sce_module/*.prx processing: enabled … Skipping …/False-self-4f153d1d/sce_module/libc.prx: a SELF container, not an ELF ``` where before there was no line naming the file at all. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) — no unimplemented path here; this removes a silent drop - [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 — none added - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: none - [x] AI-assisted: yes
adriadam10 commented 2026-10-13 14:46:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T14:46:08Z.


Closing as a duplicate: main already has this change. #4501 added the same else if (self) branch in NativeModules.cpp (it prints Skipping SELF container: <path> (unwrap it before relinking)) and rewrote the matching sentence in docs/user/USAGE.md. #4488 is closed. This PR now conflicts with main and would only change the wording of the message.

Feel free to reopen if something is still missing on top of main (for example a different message format, with a test pinning it).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6148221754 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4623#issuecomment-6148221754). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-13T14:46:08Z. --- Closing as a duplicate: main already has this change. #4501 added the same `else if (self)` branch in `NativeModules.cpp` (it prints `Skipping SELF container: <path> (unwrap it before relinking)`) and rewrote the matching sentence in `docs/user/USAGE.md`. #4488 is closed. This PR now conflicts with main and would only change the wording of the message. Feel free to reopen if something is still missing on top of main (for example a different message format, with a test pinning it).

Pull request closed

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!4623
No description provided.