Repository navigation
fix(relinker): infer guest dependencies from referenced imports - #6903
Conversation
|
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.
|
|
Windows check of 61fe179 merged onto current Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7 UCRT, Ninja, Release,
Negative control: with Not run: titles or homebrew. AI-assisted: yes |
|
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. |
…st-loading option guest_unused_import_dependencies, added in boykopovar#6903, runs its relinked Linux programs against copies of the instrumented guest_module_args_host.prx in libs/, as guest_module_args, guest_deferred_dependencies, guest_module_fini and guest_zero_initializer do. Those four run with verify_asan_link_order=0 through add_asan_test_options (boykopovar#7147); this one did not, so in an ANYPS5_ENABLE_ASAN build the program of its referenced case exited with 1 and "ASan runtime does not come first in initial library list" instead of 42. It now runs with the same option, which changes nothing outside ASan builds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 repository