Repository navigation
test(relinker): guard against duplicate module preinit startup - #15255
Merged
oneandonlydean merged 1 commit intoNov 3, 2026
Merged
oneandonlydean merged 1 commit into
oneandonlydean merged 1 commit into
Conversation
Model a module whose initializer dispatches its own preinit callback and assert the exact once-only callback, preserved arguments and return value. Retain zero-address and no-preinit controls and cover deferred Linux initialization. Regression coverage for boykopovar#7636, introduced by boykopovar#6112 and reverted by boykopovar#7646. The new test fails with the actual historical bad relinker at 376c040 and passes on main 9090972. AI-assisted: yes. Independently reviewed staged patch 6e437226c361065dad96478101fc899f65cde86caf51a39415369c01c1725168.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Extend
guest_zero_initializerwith a module whoseDT_INITdispatches its ownDT_PREINIT_ARRAYentry. Record a distinct callback marker and require the exact sequence: one callback, the original initializer arguments, then its return value. Retain the zero-address and no-preinit controls, add a nonzero initializer, and check exact events for deferred Linux initialization.This guards against #7636, the title-startup regression introduced by #6112 and reverted by #7646. The previous preinit fixture callback merely returned 42, so it did not make its invocation count observable. No production code changes and no newly unblocked title are claimed.
Tested
Debian GNU/Linux 13 x86-64, GCC 14.2.0, Python 3.11.15, relinker-only Release configuration (
ANYPS5_RELINKER_ONLY=ON,BUILD_TESTING=ON), synthetic fixtures only.3577e0368a4b4bb3f6c08dd6dd906de867966055: pass.ctest --test-dir build-relinker --output-on-failure --parallel 2: 588/590 pass.masked_store_loweringandamd64_only_converterterminate with SIGILL; both fail identically on unchanged main on this restricted virtual CPU. No new failures.guest_zero_initializer,guest_module_args, deferred dependencies, unused import dependencies, module directory handling, zero finalizers and module finalization.376c040294370ce7de355485947d5d00a9417e29. This test fails on its first native event assertion because the callback marker is emitted twice:On current main and this head, the first marker appears once, followed by the unchanged initializer arguments and return value. This is the reported double-startup mechanism, not a mocked filesystem failure or an unrelated conversion rejection.
Linux native loading executed. Windows PE and macOS Mach-O conversion/structural checks executed; native Windows/macOS loading, full guest libraries, GPU tests and real titles were not run. No performance claim.
python3 tools/check_conventions.py --base origin/mainandgit diff --checkpass.python3 tools/pr_overlap.py --branch test/reported-relinker-regression --repo boykopovar/AnyPS5 --base main --jobs 4completed against 1,730 open PRs with no overlap.Independent read-only review of this exact head checked the x86-64 encodings/RIP-relative targets with
objdump, SysV stack alignment, register/argument preservation and exact event assertions. It reran current and historical binaries and found no blocking logic issues. Native Windows/macOS execution remains unverified.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)