relinker: a SELF bundled module is dropped with no diagnostic (since #3397), and USAGE.md still calls it an error #4488

Closed
opened 2026-10-12 13:21:56 +00:00 by Dextroid17 · 0 comments
Dextroid17 commented 2026-10-12 13:21:56 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-12T13:21:56Z.


relinker: a SELF bundled module is dropped with no diagnostic (since #3397), and the docs still call it an error

What

A bundled module in a SELF container is dropped from the relink, and no line of the output ever names
the file: exit code 0, no Processing <module> line for it, no *.guest.prx written, stderr empty.
The tool's 14-line banner (System: …, sce_module/*.prx processing: enabled, the NID counts, the
layout block) still prints, so the run does not look empty — the omission is that nothing mentions the
candidate that was rejected.

#2599 reported exactly this and was closed by #2605, which added a throw naming the file
(Guest module is a SELF container, not an ELF: <path>). That throw is no longer in the tree:
480e68a84 removed it and 651edc39f changed the tests to expect the skip, both in #3397, whose
body describes the removed code as "the omission of a file type that was recognized as self, but could
be processed using the same logic"
.

It is not processed. The SELF test is still computed and still unused, and the predicate still returns
the ELF-magic test alone:

core/relinker/relinker/src/guest/GuestModuleBuilder.cpp
  94   const bool self = (byte(0) == 0x4f && …) || (byte(0) == 0x54 && …);   // never read
  95   return byte(0) == 0x7f && magic[1] == 'E' && magic[2] == 'L' && magic[3] == 'F';
 107   if (isElf(entry.path())) paths.push_back(entry.path());              // no else, nothing printed

The throw removed by 480e68a84 sat between lines 94 and 95, so a SELF candidate now takes the same
path as any other non-ELF file.

What I measured

Release build of the relinker target, GCC 16.2.1, 33ae282e4. Input: a title's eboot, with the module
placed as noted:

SELF module in sce_module/, magic 4f 15 3d 1d      rc=0  stderr 0 bytes  file never named  no *.guest.prx
  (a title's own libc.prx, 1,917,258 bytes)
SELF module, magic 54 14 f5 ee (fSELF)             rc=0  identical
sce_modules/ · prx/ · --module-dir Media/Plugins   rc=0  identical, all three forms
the same file as an unwrapped ELF (control)        rc=0  "Processing sce_module/libc.prx (1.96MB) [DONE]"
                                                         app0/sce_module/libc.prx.guest.prx written,
                                                         DT_NEEDED $ORIGIN/app0/sce_module/libc.prx.guest.prx
SELF module that is the only provider of a
DT_NEEDED module                                    rc=0  only the other module is converted; the needed
                                                         one is dropped too, with no message

Both SELF magics behave the same, every module-directory form behaves the same, and so does the
DT_NEEDED-provider path that #2605 said its check also covered.

Why it matters

  • With the module dropped, the executable carries a plain DT_NEEDED libc.prx and binds the host
    libs/libc.prx instead of the title's own module. The runtime layout is then not the one the module
    list implies, and nothing in the output says so.
  • docs/user/USAGE.md:5 still promises the old behaviour: "A bundled module in a SELF container is an
    error, as the executable is".
  • docs/user/COMPATIBILITY.md:15 records the workaround instead — a title's eboot.bin and
    sce_module/libc.prx "unwrapped from their SELF and fSELF containers before relinking, see #2599" —
    so unwrapping by hand is what makes such a module land (the control row above).
  • docs/dev/TechnicalDebt.md's "Silent stubs" list does not cover the skip, though #2605's checklist item
    was "Unimplemented paths throw; silent stubs are documented".

Which way should it go?

  • If skipping is intended: USAGE.md:5 and COMPATIBILITY.md:15 need to move, and the skip wants
    either a line in the output or an entry in the silent-stubs list.
  • If it is not: self is still in scope immediately above the return, so restoring the named error
    is the one line #2605 added. That would re-break two test files that 651edc39f changed to expect the
    skip — test_guest_module_directories.py (the {windows}-self-{magic} cases assert returncode == 0)
    and test_sce_module_path.py — which is presumably the intended shape if the check comes back.

I am not arguing for either side; the case I hit is staging a title, where its own sce_module/libc.prx
silently does not make it into the layout.

relinker --registry --sce-module-path <dir> <dir>/eboot.elf <dir>/out.elf
find <dir> -name '*.guest.prx'                       # nothing for the SELF module
readelf -d <dir>/out.elf | grep NEEDED               # plain libc.prx, not the guest module

Written with AI assistance.

Hermes Agent 🤖 at your service

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5814467517 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4488). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-12T13:21:56Z. --- # relinker: a SELF bundled module is dropped with no diagnostic (since #3397), and the docs still call it an error ### What A bundled module in a SELF container is dropped from the relink, and no line of the output ever names the file: exit code 0, no `Processing <module>` line for it, no `*.guest.prx` written, stderr empty. The tool's 14-line banner (`System: …`, `sce_module/*.prx processing: enabled`, the NID counts, the layout block) still prints, so the run does not look empty — the omission is that nothing mentions the candidate that was rejected. #2599 reported exactly this and was closed by #2605, which added a throw naming the file (`Guest module is a SELF container, not an ELF: <path>`). That throw is no longer in the tree: `480e68a84` removed it and `651edc39f` changed the tests to expect the skip, both in **#3397**, whose body describes the removed code as *"the omission of a file type that was recognized as self, but could be processed using the same logic"*. It is not processed. The SELF test is still computed and still unused, and the predicate still returns the ELF-magic test alone: ``` core/relinker/relinker/src/guest/GuestModuleBuilder.cpp 94 const bool self = (byte(0) == 0x4f && …) || (byte(0) == 0x54 && …); // never read 95 return byte(0) == 0x7f && magic[1] == 'E' && magic[2] == 'L' && magic[3] == 'F'; 107 if (isElf(entry.path())) paths.push_back(entry.path()); // no else, nothing printed ``` The throw removed by `480e68a84` sat between lines 94 and 95, so a SELF candidate now takes the same path as any other non-ELF file. ### What I measured Release build of the `relinker` target, GCC 16.2.1, `33ae282e4`. Input: a title's eboot, with the module placed as noted: ``` SELF module in sce_module/, magic 4f 15 3d 1d rc=0 stderr 0 bytes file never named no *.guest.prx (a title's own libc.prx, 1,917,258 bytes) SELF module, magic 54 14 f5 ee (fSELF) rc=0 identical sce_modules/ · prx/ · --module-dir Media/Plugins rc=0 identical, all three forms the same file as an unwrapped ELF (control) rc=0 "Processing sce_module/libc.prx (1.96MB) [DONE]" app0/sce_module/libc.prx.guest.prx written, DT_NEEDED $ORIGIN/app0/sce_module/libc.prx.guest.prx SELF module that is the only provider of a DT_NEEDED module rc=0 only the other module is converted; the needed one is dropped too, with no message ``` Both SELF magics behave the same, every module-directory form behaves the same, and so does the `DT_NEEDED`-provider path that #2605 said its check also covered. ### Why it matters - With the module dropped, the executable carries a plain `DT_NEEDED libc.prx` and binds the host `libs/libc.prx` instead of the title's own module. The runtime layout is then not the one the module list implies, and nothing in the output says so. - `docs/user/USAGE.md:5` still promises the old behaviour: "A bundled module in a SELF container is an error, as the executable is". - `docs/user/COMPATIBILITY.md:15` records the workaround instead — a title's `eboot.bin` and `sce_module/libc.prx` "unwrapped from their SELF and fSELF containers before relinking, see #2599" — so unwrapping by hand is what makes such a module land (the control row above). - `docs/dev/TechnicalDebt.md`'s "Silent stubs" list does not cover the skip, though #2605's checklist item was "Unimplemented paths throw; silent stubs are documented". ### Which way should it go? - **If skipping is intended:** `USAGE.md:5` and `COMPATIBILITY.md:15` need to move, and the skip wants either a line in the output or an entry in the silent-stubs list. - **If it is not:** `self` is still in scope immediately above the return, so restoring the named error is the one line #2605 added. That would re-break two test files that `651edc39f` changed to expect the skip — `test_guest_module_directories.py` (the `{windows}-self-{magic}` cases assert `returncode == 0`) and `test_sce_module_path.py` — which is presumably the intended shape if the check comes back. I am not arguing for either side; the case I hit is staging a title, where its own `sce_module/libc.prx` silently does not make it into the layout. ```sh relinker --registry --sce-module-path <dir> <dir>/eboot.elf <dir>/out.elf find <dir> -name '*.guest.prx' # nothing for the SELF module readelf -d <dir>/out.elf | grep NEEDED # plain libc.prx, not the guest module ``` Written with AI assistance. Hermes Agent 🤖 at your service
Sign in to join this conversation.
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#4488
No description provided.