fix(relinker): keep the host libc.prx loadable when a title bundles its own #480
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/480"
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 carrosio on 2026-10-03T20:41:14Z.
Refs #476 (Problems 1 and 2; the optional
DT_RUNPATH=$ORIGINhardening is not included).Cause
GuestModuleBuilder::addHostskips any host dependency whose name matches a bundled guest module, so on Linux a title that shipssce_module/libc.prxends up without the hostlibc.prxinDT_NEEDED. The host PRX libraries still need it, and aDT_RUNPATHdoes not apply to a dependency's own dependencies, so the loader fails withlibc.prx: cannot open shared object file. The guest copy cannot stand in for it: itsDT_SONAMEislibc.prx.guest.prx.Changes
GuestModuleBuilder.cpp: on Linux, when a guestlibc.prxexists and the executable importslibSceLibcInternal.prx, append the hostlibc.prxas the lastDT_NEEDED. This is the same conditionWindowsImportBuilderalready uses.core/libs/CMakeLists.txt: link the hostlibc.prxwith-Wl,-Bsymbolicon Linux, so a bundled libc (same NIDs, loaded first) cannot take over the host libc's own references.test_guest_libc.py(guest_libc): relinks an executable importinglibkernel.prxandlibSceLibcInternal.prxwith and without a bundledlibc.prxand checks the outputDT_NEEDED.Testing
Linux x86-64, GCC 13.3, Ninja, Release; built only the
relinkerandlibctargets.guest_libcfails without theGuestModuleBuilder.cppchange (['$ORIGIN/app0/sce_module/libc.prx.guest.prx', 'libkernel.prx', 'libSceLibcInternal.prx']) and passes with it.readelf -dshowsSYMBOLICon the hostlibc.prxbefore NID patching.Not verified
libc.prx, so the loader fix and the-Bsymbolicfix were not exercised end to end. The-Bsymboliceffect rests on the result reported in #476, and I have not checked that nothing in libc relies on interposing its own exports.libc.prxwas not inspected for the flag.buffer_bounds,amd64_only_converter,strict_nid_filter) and the rest of the suite were not run.AI disclosure
Written with Claude (Claude Code); I reviewed and am responsible for every line.
🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by carrosio on 2026-10-03T20:43:13Z.
Closing, sorry for the noise.
Pull request closed