Repository navigation
fix(relinker): select guest startup dependencies from required roots - #5559
Conversation
|
macOS data point, since the description only inspects the macOS dependency lists. Apple M2 Max, macOS 27.2 (26B5091g), AppleClang, Ninja Release, relinker-only (
Runtime check of the
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine. |
|
Small Linux fixture correction for composition with #6106 (
Copying the same existing host fixture under the required kernel name fixes it: diff --git a/core/relinker/relinker/tests/test_guest_deferred_dependencies.py b/core/relinker/relinker/tests/test_guest_deferred_dependencies.py
--- a/core/relinker/relinker/tests/test_guest_deferred_dependencies.py
+++ b/core/relinker/relinker/tests/test_guest_deferred_dependencies.py
@@ -117,6 +117,7 @@ def main():
libraries = case / "libs"
libraries.mkdir()
shutil.copyfile(host, libraries / "libc.prx")
+ shutil.copyfile(host, libraries / "libkernel.prx")
events = case / "startup-events.txt"
output.chmod(0o755)
run = subprocess.run([str(output)], capture_output=True, text=True, timeout=30,Fresh local verification: Linux x86-64, GCC 13.3, Release relinker-only build, main This follows the two-copy fixture pattern already used in Prepared and verified with OpenAI Codex assistance. |
c37a4b8 to
a383149
Compare
|
Checked the dependency selection on the merged tree: relinker build and ctest 133/133 with no skips, and |
What
Choose guest module startup dependencies from the roots that actually need them. Dependencies of runtime-only modules discovered with --module-dir stay deferred until a required root uses them. A relocated executable import resolved to a unique guest provider requires that module and its dependency chain even without a DT_NEEDED entry; previously the import was renamed for guest binding but its provider could remain unloaded. Unreferenced dynamic symbols and R_X86_64_NONE relocations do not require an otherwise deferred module.
The branch includes the earlier unpublished runtime-only dependency fix (original commit b32fd11, preserved as a separate commit) and the executable-import correction. Windows retains its current eager dependency handling. Linux and macOS select startup roots from required modules and executable bindings. Logical export-library namespaces are unchanged.
Tested
Rebased as three linear commits on main
d92a8dad390af1807cc91622b924252141816a5a, published heada38314933da4209c8ee36faafa3e7c6a8f7976ea. The third commit copies the existing synthetic host module underlibkernel.prxas well aslibc.prx, following Zinebyte's reproduction of the required initializer dependency when this topic is composed with #6106. It changes only the test fixture. The branch merges cleanly into current main.Fresh Linux Release relinker-only build passed; 173/173 CTests passed, including
guest_deferred_dependencies, with zero skips. Local conventions and whitespace checks passed. The current PR's relinker CI matrix also passed on Linux, macOS and Windows; full project build jobs were skipped.Composition with current #6106 head
78b906fb67a8edff3969f60d26ced129f981139echerry-picked cleanly and passedguest_deferred_dependencies; 172/173 relinker CTests passed initially. Its newguest_module_dirtest failed to load syntheticlibOptional.prxon this host because the fixture requested an executable stack. I reproduced the identical deterministic failure with #6106 alone on current main. A local two-line non-executable-stack ELF header correction in that test made 172/172 #6106-alone CTests and 173/173 composed CTests pass. That correction is separate and is not part of this PR.Earlier validation
('imported', 'provider', ['libc.prx']).The initial fork review used base
1acfa7f78; those integration results are historical.Full CI run 38323687739 passed at the earlier topic head
25c1cc8ac. Linux: 937 passed and 43 skipped (980 total); Windows: 639 passed and 357 skipped (996 total). All Linux, Windows and macOS relinker jobs, register-context jobs and write-watch jobs passed. These full runs validate the independent topic, beyond the earlier local integration. GitHub conventions passed.Checklist
Historical upstream validation
Former head
c37a4b8b6b85d94cb9bcc6c75b8b86905ebf3c29contains maind1670009fbfdfe57f8f26ee09ced77fe6b18c2ca. The topic's production change is unchanged by the latest rebase. Previous validated build passes at4b26d31b1db2317ca538a3e7fd0e614257db1520against main7a0c838ca48; those results apply to their explicitly recorded earlier head/base. Earlier full Linux and Windows validation passes forc37a4b8b6; expected skips remain unvalidated.Independent macOS validation
jotitadev reports testing former head
c37a4b8b6on main84b01f9cd, Apple M2 Max / macOS 27.2 / AppleClang. The arm64 relinker-only build passed 157/157 cases. Under Rosetta 2, 151/157 passed; the same six failures reproduced on unmodified main, andguest_deferred_dependenciespassed. Dependency inspection confirms that the imported executable loads its required provider while leaving the unused consumer deferred.Their runtime check used the synthetic imported-module fixture, a stand-in startup shim and the separate #5362 fixture correction. With those stated conditions, the relocated call returned 42 and the provider initialized once. The uncorrected fixture fails dyld on both main and this topic. This is contributor-reported fixture evidence, not a native game run or a claim that this branch includes #5362.