fix(libs): keep a $ORIGIN runpath in the patched prx libraries #732
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/732"
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 alfalfa-star on 2026-10-05T18:20:36Z.
What
Since #225,
libSceVideoOut.prxhasDT_NEEDED libSceKeyboard.prx. A title that does not import libSceKeyboard itself fails at startup on Linux:The executable's
DT_RUNPATH($ORIGIN/libs) does not apply to the dependencies of a library, and the patched prx libraries ship with an empty runpath. The NID patcher rebuilds.dynstrkeeping only theDT_NEEDEDandDT_SONAMEstrings, soDT_RUNPATHkept a stale offset; the absolute build directory in it became"", or could have become a fragment of another name. A prx could load only the sibling prx that the executable already loads. libSceVideoOut's other dependencies (AgcDriver, Pad, Mouse) only work for the same reason.DT_RPATHandDT_RUNPATHstrings likeDT_NEEDEDandDT_SONAME.$ORIGINrunpath (BUILD_WITH_INSTALL_RPATH,INSTALL_RPATH "$ORIGIN") instead of the build directory, so they find each other in any directory they are copied to, and no build path is shipped. Windows ignores these properties.Tested
33e9a121. Newnid_patcher_dynamic_stringstest (Linux, Python): the patchedguest_module_fixturekeepsRUNPATH $ORIGINand validNEEDEDnames. With the patcher change reverted it fails with(29, ''). Full ctest: 293/293 apart from the three wave64 pixel tests that fail onmainon this GPU (RX 9070 XT, RADV).build/core/libs/libs/*.prxnow all haveRUNPATH [$ORIGIN].dlopenof the patchedlibSceVideoOut.prxfrom another directory withoutLD_LIBRARY_PATHsucceeds; the previous build fails on its first sibling dependency.LD_LIBRARY_PATH=libsto start before this change.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-05T22:56:47Z.
The Linux re-run fails in the new test (run 37355223174):
The runpath check passes; it's the
neededassertion that fails, because the fixture has noDT_NEEDEDentry at all on the runner.GuestModuleFixture.cppuses nothing from libstdc++ or libc, and Ubuntu's GCC links with--as-neededby default, so every library gets dropped. Without--as-needed(my Linux setup, where the test passed) the same fixture needs libstdc++, libm, libgcc_s and libc. I checked that with a one-function shared library built both ways.Either of these should fix it: link the fixture with
-Wl,--no-as-neededso it keeps itsDT_NEEDEDentries, or point the test at one of the patched host prx that has a realDT_NEEDEDon another prx. Dropping the non-empty check would also pass, but then the test no longer covers the needed names on CI.The rest still looks good to me, and Windows is green.
Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-06T23:34:06Z.
Tested with a real title on Linux: Demon's Souls (PPSA01341, v1.07), RTX 5070 Ti, Fedora 44. On
main(c1241ad0) the relinked executable fails to start withlibSceMouse.prx: cannot open shared object file.LD_DEBUGshows it is needed bylibs/libSceVideoOut.prx, which has an empty RUNPATH. With this PR merged, the executable loads its libraries withoutLD_LIBRARY_PATHand reaches the title's main loop.Imported from boykopovar/AnyPS5. Originally posted by ThisIsAkill on 2026-10-06T23:40:50Z.
Tested on PPSA21567 (Linux, RTX 3070, default build, PPSA21567 relinked with
main's relinker, noLD_LIBRARY_PATH).main5895ea72alone: the executable stops at load withlibSceKeyboard.prx: cannot open shared object file.libSceVideoOut.prxneeds it, andreadelf -dshowsLibrary runpath: []onlibSceVideoOut.prx,libSceKeyboard.prxandlibkernel.prx.1d52422d): the patched prx reportRUNPATH [$ORIGIN], and the loader finishes in 3 of 3 launches. Two of those were onmain+ this PR, the third with #285 added. Each later stopped at an unrelated GPU error.Details on #476.