Repository navigation
fix(relinker): scope host dependencies to required guest modules - #6106
Conversation
d3e2f29 to
78b906f
Compare
|
I ran the guest module tests on Linux (glibc 2.44). Setup: head 78b906f merged into main at ff23657 (no conflicts; the PR's base is 315 commits behind), default CMake build (CMAKE_BUILD_TYPE empty, unoptimized), clean environment (
With The Adding a PT_GNU_STACK header with RW flags to I did not check Windows or macOS. AI-assisted: yes |
78b906f to
b50ab4e
Compare
|
Tested on Linux (Arch), This PR and #5614 break Cause: for Linux modules with an init function, this PR now adds Whichever PR lands second should copy the host module as AI-assisted: yes |
b50ab4e to
ed18841
Compare
|
Checked the per-module host dependency scoping against the diff: relinker build and tests in scope 137/137 pass, and reverting |
|
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.
|
boykopovar#6106 made a Linux guest module with an initializer depend on libkernel.prx, which exports the module-argument getter and setter that its DT_INIT stub imports. That check still tested Init != 0, so a module whose DT_INIT is 0 got the stub but not the dependency. With no other libkernel.prx loaded, the executable then stopped with a symbol lookup error, and a --module-dir module failed to load with "undefined symbol: __aps5_get_pending_module_args_nid_no_patch". The check now uses HasInit, like the writers. guest_zero_initializer now checks that the Linux module lists libkernel.prx, and its native load provides one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
boykopovar#6106 made a Linux guest module with an initializer depend on libkernel.prx, which exports the module-argument getter and setter that its DT_INIT stub imports. That check still tested Init != 0, so a module whose DT_INIT is 0 got the stub but not the dependency. With no other libkernel.prx loaded, the executable then stopped with a symbol lookup error, and a --module-dir module failed to load with "undefined symbol: __aps5_get_pending_module_args_nid_no_patch". The check now uses HasInit, like the writers. guest_zero_initializer now checks that the Linux module lists libkernel.prx, and its native load provides one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
boykopovar#6106 made a Linux guest module with an initializer depend on libkernel.prx, which exports the module-argument getter and setter that its DT_INIT stub imports. That check still tested Init != 0, so a module whose DT_INIT is 0 got the stub but not the dependency. With no other libkernel.prx loaded, the executable then stopped with a symbol lookup error, and a --module-dir module failed to load with "undefined symbol: __aps5_get_pending_module_args_nid_no_patch". The check now uses HasInit, like the writers. guest_zero_initializer now checks that the Linux module lists libkernel.prx, and its native load provides one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
A Linux executable with no startup module imports can run normally, but scanning an unused plugin under
--module-dir Media/Pluginsmakes it fail at startup if that plugin declares an unavailable host library. The plugin is already marked deferred; the builder nevertheless adds every discovered module's host dependencies to the executable and to every other guest module.Build each guest's host dependency list from its own declarations, preserving the existing libc alias and the native kernel dependency required by Linux writer-generated initializer helpers. Include a guest's host requirements in the executable only when it is required at startup; Windows keeps its eager host list. Deferred plugins still require their libraries when explicitly loaded, and invalid deferred host names are still rejected. Startup guest selection is unchanged.
The synthetic Linux host fixture explicitly declares an RW, non-executable
PT_GNU_STACK, permitting native loading on glibc 2.41 and later without executable-stack tunables.Tested
Linux x86-64, GCC 13.3, Release relinker-only build on current main
af7db81e6ef71282fdec4f10b089d1da6c75555e, refreshed headed1884134fcde70c9bb8314379115e2f7de391e7: all 185 configured CTests pass in 8.74 seconds, including the merged finalizer regression. Conventions and whitespace checks pass. All four files changed by the original dependency-scoping commit are byte-identical to the earlierb50ab4ebhead; this refresh adds the required finalizer kernel fixture copy on current main.Native Linux loader controls cover unused plugins (startup exits 42), required guest hosts, explicit deferred loading, missing required hosts, and startup/deferred initializers. Metadata controls cover Linux, macOS and Windows. The new controls fail against the unmodified builder; the fixed builder passes. Independent adversarial review checked libc aliases, shared-host deduplication, invalid names and a bundled guest named
libkernel.prx.The earlier hosted Build 38776790189 passed at previous head
b50ab4eb: Linux 181/181 tests, Windows 176/176 and macOS 172/172. Hosted Build 38972981441 passed on refreshed headed1884134fcde70c9bb8314379115e2f7de391e7: the Linux, Windows and macOS relinker jobs succeeded, and the latest Conventions check passed. The full Linux and Windows runtime jobs were skipped under the contribution policy, so this run does not establish a successful full runtime build. No retail-title execution or new local native macOS/Windows loader run is claimed.The reported executable-stack fixture issue was independently reproduced using Debian glibc 2.41 extracted inside the workspace: the original host library fails
dlopenwith “cannot enable executable stack”; the corrected library loads. A corrected library declaring a missing dependency still fails normally. NoGLIBC_TUNABLES,LD_PRELOADor host-library installation was used. The directory suite also passes on host glibc 2.39.Integration
#5614 has merged into main, so its finalizer regression is now present on this branch. This refresh includes the reported one-line fixture correction: copy the existing host fixture to
libs/libkernel.prxalongsidelibs/libc.prx. All finalizer argument and unload assertions remain unchanged.The optional
HasInitguard adjustment for still-open #6684 remains integration-only: that peer adds zero-address initializers and theHasInitmember. A checkout combining both PRs must use that member for the generated helper dependency. The standalone branch follows the current main writer'sInit != 0condition and does not import the unmerged peer.Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repository