Linux: a bundled libc.prx loader shim (ps5-native-app-boilerplate) binds libc imports to placeholder exports; DOOM PPSA99666 finds no WAD #1497
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by hikazey on 2026-10-08T09:22:50Z.
Summary
On Linux, imports bound to a bundled
sce_module/libc.prxbuilt by ps5-native-app-boilerplate resolve to placeholder functions that return 0. DOOM Shareware PPSA99666 v1.1.1 (lowbit/ps5-doom, GPL-2.0) ships this module (built at boilerplate commitb1315a9, per itsTHIRD_PARTY_NOTICES.md). Itssnprintf/vsnprintfwrite nothing, so the title never builds a WAD path, finds no game and exits with code 0. #684 fixed the same interception for Windows ("A title's bundledlibc.prxshim can then intercept imports ... with its placeholder exports"); its description notes that Linux keeps the existing behaviour.What the module is
The boilerplate calls it a "loader shim": the PS5 loader needs a
libc.prxnext to a native title. It is generated bytooling/native/libc_builder.cppfromtooling/native/runtime/api-surface.txt(2572 API records: NID, binding, type, size). Inbuild_export_symbols, every function export (type == 2) gets the address0x30,0x40(_longjmp,_setjmp) or0x50. In the shipped module these arexor eax,eax; retand, at0x50,pxor xmm0,xmm0; xor eax,eax; ret. Since the title works on hardware, the console presumably serves these imports from the system libc. I haven't verified that on a console.Evidence (Linux,
main0e173a46+ #1278, #1279, #1307)eboot.bin(unwrapped from the fake-signed SELF) with the bundledlibc.prxbinds 70 of the title's imports to the guest module (#guest), among themsnprintf,vsnprintf,strlen,memcpy,malloc,fopen,qsortandstrcasecmp.plat_alertbuilds its message withsnprintf(request.message, …, "DOOM: %s", message). AnyPS5 prints[notification]with an empty message, and the request layout matchesNotification.cpp(message at offset 45)./download0/doom.log(written throughvsnprintf) stays empty./app0/wadscorrectly:getdents64returns.,..anddoom1.wad, and the guest records match the FreeBSD 11 layout the title parses. But the title never opensdoom1.wad. Instead it opens a bare/download0about 30 times, the result ofsnprintf("%s/%s", …)that writes nothing.Workaround and result
Relinking with
--exclude-sce-module libc.prxbinds those imports to AnyPS5's libraries. The title then findsdoom1.wad, shows its launcher and reaches E1M1 on Linux. Moving and firing work (ammo 50 → 48).Performance (Ubuntu 24.04 container on a Ryzen 9 5900X, Xvfb, no GPU; Mesa llvmpipe for Vulkan):
gpu: frame 1 never completed), and the title switches to its CPU scaler.Question
Should the Linux relinker treat imports whose only provider is a module like this the way #684 does on Windows, binding each qualified import to its declared system module? Or should titles that ship this shim be relinked with
--exclude-sce-module libc.prx? The flag is deprecated and documented as unsuitable for normal use. Any title built with ps5-native-app-boilerplate should hit the same problem.Screenshots of the launcher and E1M1 to follow.
AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by hikazey on 2026-10-08T09:29:35Z.
Imported from boykopovar/AnyPS5. Originally posted by johnmaia on 2026-10-08T09:58:07Z.
Root cause on Linux:
GuestModuleBuilderrenames every executable import whose NID a guest module exports to its guest-suffixed name (GuestModuleBuilder.cpp:180), whatever module the import declares. DOOM PPSA99666 declaressnprintf,vsnprintf,strlen,memcpy,mallocandfopenfromlibSceLibcInternal(#G#H, module 7) and declares nothing fromlibc; the bundled shim exports the same NIDs, so 71 imports become<nid>#guest(eLdDw6l0-bU#guestissnprintf) and bind to its placeholders. On Windows the same build binds by the declared module (WindowsEntryStubBuilder) and opens/app0/wads/doom1.wad(checked withmain+ #1278, #1279, #1307; DOOM built from source at v1.1.1, byte-identical to the release).Plan: on Linux, rename an import to the guest-suffixed name only when the module it declares is that guest module, as Windows binds; imports without import-module metadata keep the current behaviour, so a title's own
libc.prximported fromlibcstill binds to it (7103f390,test_guest_host_libc.py). I'm working on it.(Edited: my first version blamed the
DT_NEEDEDorder; the rename is what binds these imports to the guest module.)Imported from boykopovar/AnyPS5. Originally posted by klosixgaming-arch on 2026-10-08T11:50:14Z.
PR #1529 ("fix(relinker): keep Linux imports declared from host modules off guest exports") directly addresses this issue. The PR fixes the problem where on Linux,
GuestModuleBuilderwas renaming every import whose NID a guest module exports to its guest-suffixed name, regardless of which module the import declares.The fix adds logic to check if an import is declared from a host module vs. a guest module, and only binds to guest exports when appropriate. This should resolve the DOOM PPSA99666 issue where libc imports were being bound to placeholder functions in the bundled libc.prx loader shim.
The PR has been reviewed and approved, pending merge by maintainers.