fix(relinker): infer guest dependencies from referenced imports #6903
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6903"
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 Zinebyte on 2026-10-16T17:34:07Z.
What
A bundled guest module can retain an undefined dynamic symbol without any relocation using it. If a runtime-only plugin exports that symbol, conversion currently infers an initialization dependency and loads the plugin at startup. A native regression shows its initializer runs even though the executable and bundled module never reference it.
Infer module-to-module initialization dependencies from symbols used by non-NONE RELA or PLT relocations, as the executable path already does. Preserve explicitly declared dependencies and normal import resolution. Windows retains its existing eager DLL-loading policy; its initializer state and import-table controls are covered by metadata checks.
Tested
Linux x86-64, GCC 13.3, Release relinker-only build on main
d9b696ddbb: all 183 CTests pass. The 27 focused cases cover Linux, macOS and Windows output: unreferenced strong/weak imports, NONE relocations, real strong/weak and PLT references, explicit needed libraries, missing strong imports and declared dependency cycles. Native Linux processes verify initializer events and exit values. The unchanged baseline runs the supposedly deferred initializer; the fix leaves it deferred. Native macOS/Windows execution and retail titles were not tested locally.Independently reviewed the Windows writer's relocation-based import collection. A clean combined merge with #6105
5c378ece37and #6106b50ab4eb43passes six targeted tests, and component-filtered runs select both new tests. Their production changes are independent. Hosted Build 38940688286 passed on exact head6b14c31437: Linux 183/183 tests, Windows 178/178 and macOS 174/174. The 27-case regression passed on every host. Conventions and whitespace checks pass. After the registration-only follow-up, hosted Build 38951158365 also passed on current head61fe1795fa5c07124f01093f01294745f131087e: the Linux, Windows and macOS relinker jobs succeeded, and Conventions passed. The full Linux and Windows runtime jobs were skipped under the contribution policy.Checklist
main; no other open PR implements the same fix.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-16T18:08:14Z.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/relinker/CMakeLists.txtcore/relinker/CMakeLists.txtcore/relinker/CMakeLists.txtcore/relinker/CMakeLists.txtcore/relinker/CMakeLists.txtcore/relinker/relinker/src/guest/GuestModuleBuilder.cppcore/relinker/CMakeLists.txtImported from boykopovar/AnyPS5. Originally posted by DProkos on 2026-10-18T19:33:48Z.
Windows check of
61fe1795fmerged onto currentmain(c4c2b3aa7, clean merge).Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7 UCRT, Ninja, Release,
ANYPS5_RELINKER_ONLY=ON,BUILD_TESTING=ON, Python 3.11.0.guest_unused_import_dependencies: passed.Negative control: with
GuestModuleBuilder.cpprestored tomainand the new test kept,guest_unused_import_dependenciesfails on theunreferencedcase: the provider still appears in the root module's needed list ($ORIGIN/app0/Media/Plugins/provider.prx.guest.prx).Not run: titles or homebrew.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-20T09:09:00Z.
Checked: module-to-module dependencies now come only from symbols used by non-NONE RELA/PLT relocations, matching the executable path; declared needed libraries are kept. The new test fails without the change (negative control by @DProkos on Windows), and the CMake registration still merges cleanly on current main. Relinker jobs green on all three hosts; merged.