fix(relinker): keep the host libc.prx needed on Linux when a title bundles its own #618
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/618"
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 oneandonlydean on 2026-10-05T07:41:01Z.
What
On Linux, when a title ships its own
sce_module/libc.prx,GuestModuleBuilderdrops the host dependency whose name matches a guest module (addHost), so the executable no longer lists the hostlibc.prx. This PR applies the Windows rule fromWindowsImportBuilder::ReadLibraries(f146a3d0) to the guest module builder: whenlibSceLibcInternal.prxis a host dependency and no hostlibc.prxremains,libc.prxis appended as the last host dependency.DT_NEEDEDand the title's own imports keep binding to its own libc first (9cfdbff1).libc.prx, or when it is left out with--exclude-sce-module libc.prx: the hostlibc.prxis still in the list there.ReadLibrariesalready appendslibc.prxin this case, and now finds it present.Why
Part 1 of #476. Every host prx needs
libc.prx, but theirDT_RUNPATHis empty, so without the executable listing it the loader fails withlibc.prx: cannot open shared object file.This only fixes the load failure. It does not fix part 2 of #476: with both libcs loaded, the host libc's references to its own exports still bind to the title's libc through the global scope (
_Stdoutand friends). Titles such as PPSA21567 and PPSA02929 will get past the loader with this and then crash as described in #476, until that part has its own fix.-Bsymbolicis left out on purpose, since it breaksguest_standard_streams,guest_memoryandguest_system_font(see the comments on #476).Tested
BUILD_TESTING=ON;ctestpasses (269/269).guest_host_libcrelinks a fake executable that importslibkernel.prx,libc.prxandlibSceLibcInternal.prx, and reads the output'sDT_NEEDED:libc.prx: the list ends with the hostlibc.prx, after the guest modules and the other host libraries;libSceLibcInternal.prx: unchanged;libc.prx: unchanged;libc.prxleft out by--exclude-sce-module libc.prx: unchanged.libc.prx.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by ThisIsAkill on 2026-10-05T12:34:14Z.
Tested on PPSA21567 (Astro Bot v01.018, which bundles
sce_module/libc.prx), Linux, oneandonlydean'sastrobotat4be8b3e7with #602 and this PR on top (this PR'sguest_host_libctest imports a helper from #602's test, so it needs #602 underneath).guest_host_libcpasses.Part 1: fixed for libc, but this title still doesn't load without
LD_LIBRARY_PATH.DT_NEEDEDlist with the hostlibc.prx(62 entries, 61 before).LD_LIBRARY_PATH, thelibc.prx: cannot open shared object filefailure is gone. All 4 launches now stop at the next missing library:libSceKeyboard.prx: cannot open shared object file(2 with the-Bsymboliclibc, 2 with the default libc).The cause is the general one from #476, not libc-specific. The host prx carry an empty
DT_RUNPATH, and the executable's own$ORIGIN/libscovers only its ownDT_NEEDED. So any host-to-host dependency that the title doesn't import itself is never found. On this title that's exactly one:libSceVideoOut.prxneedslibSceKeyboard.prx(linked the same way onmain), and PPSA21567's executable doesn't importlibSceKeyboard. I checked the rest of the dependency graph: no other host prx is reachable only through another host prx here. Other titles will differ.Part 2: unchanged, as the PR says. With
LD_LIBRARY_PATHset so that it loads:libc.prx.guest.prx+0x7d35, the same crash as before;-Bsymboliclibc: 2 of 2 run to the end of the 120 s window and render the Crash Site.So
-Bsymbolic(or a real part 2 fix) is still needed for this title.A question for the load half: should the relinker add every transitive host dependency to the executable's
DT_NEEDED, rather than onlylibc.prx? Or should the host prx getDT_RUNPATH=$ORIGIN, so they find each other inlibs/? Either would coverlibSceKeyboardand libc together.