fix(relinker): audit dependencies without imported functions #4916
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4916"
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 harry-z-kang on 2026-10-13T04:03:42Z.
What
import_audit.pycan report a converted title as complete when it still needs a library with no imported functions, such asParty.prxin #2776. The import registry has no entries for that dependency.With
--registry, the relinker now writes a companion<prefix>.needed.jsonfor each converted executable (including--executableoutputs) and guest module. It contains the host dependencies retained after bundled guest providers and their aliases are resolved. The audit reads these companions and reports missing dependencies with zero imports. Existing registry arrays and audits of older registries remain supported.Companion files receive the same input-preservation checks as import registries, and a failed Windows PE patch preserves existing registries and companions. This improves the diagnostics associated with #2776; it does not claim to fix Resident Evil 4's runtime stops. The audit conservatively flags a missing dependency even when the Windows loader can omit it because it has no imports.
Overlap coordination
#4425, #4559, and #4606 are merged. This PR is rebased onto main
0defec438. The JSON-report conflict retainsdependency_registries,needed_libraries,stops, and module-aware reference counts, and passes the complete result to main's atomicwrite_json(args.json, result). Upstream input validation, output-directory checks, Linux runpath validation, Windows resource handling, conversion diagnostics, and progress reporting are preserved.#5269 remains the only merge-order dependency, following its author's proposed order. Its call-registry test overlaps our companion assertion. The tested combined resolution keeps
weak: falsein the expected strong-import entry, theweak: truefixture, and the.needed.jsonassertion forlib.so. Its commits are not included in this branch; this PR will be rebased after it lands.Tested
22b190ae0, based on main0defec438.long_paths, because Windows long paths are disabled), 0 failed.7420d0e89combines this head with #5269 atb9acf3480. Release relinker builds and all seven relevant CTest targets passed on Windows and Linux:call_registry,guest_registry,needed_libraries,weak_imports,input_preservation,import_audit, andconversion_diagnostics. Its 62 audit tests completed successfully on each OS, with 2 POSIX-only skips on Windows and 1 Windows-only skip on Linux. This validates the pinned combined checkout, not a future rebase.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)Imported from boykopovar/AnyPS5. Originally posted by harry-z-kang on 2026-10-13T04:21:53Z.
@Lorkydey @MarcZX100 @Nixitov
I've listed #4425, #4559, and #4606 in this PR's Depends on. I will take #4916 after all three, following the existing #4425-before-#4606 agreement; #4559 can land at any point before #4916. I'll rebase this PR once those changes are in main. Please let me know if that conflicts with your planned order.
I checked a separate integration checkout on main
e51428bf2, combining #4425 at05d52e396, #4559 atacd821f7c, #4606 at7eae85946, and this PR atd92f47c90. The conflict resolution preserves:write_json(args.json, result)and all required test imports.needed_libraries=....stopsreport, alongside ourdependency_registriesandneeded_librariesJSON fields.All 58 focused audit tests completed successfully on Windows (56 passed, 2 POSIX-only skips) and Linux (57 passed, 1 Windows-only skip). The zero-import executable/guest-module relinker fixtures passed on both platforms as well. This is validation of the pinned integration checkout, not of a future rebase or a full build of the other PRs.
The published branch carries only our contribution. I made our dependency parameter keyword-only to avoid consuming #4559's module argument positions, and replaced our placeholder module fixture with a valid ELF that #4559 can inspect. After rebasing onto main
e51428bf2, the five affected CTest targets pass on Windows and Linux, and conventions/whitespace checks pass.AI-assisted: yes (Codex).
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T07:24:15Z.
No conflict with my planned order. The current heads of #4425, #4559, and #4606 are still open, and I agree with the proposed sequencing: keep #4425 ahead of #4606, let #4559 land before #4916 at any point, then rebase #4916 after all three are in
main. Thanks for checking the combined integration and preserving each PR's changes.Imported from boykopovar/AnyPS5. Originally posted by Nixitov on 2026-10-13T14:09:27Z.
Confirmed on our side. #4606 only adds a
stopssection (the first unresolved import, inapp.registry.jsonorder) and its tests; it does not change the registry order or anything #4425/#4559 touch. So #4425 → #4606, with #4559 landing before #4916 at any point, works for us.Thanks for checking the combined checkout and for preserving the
stopsreport and registry order in the integration.Imported from boykopovar/AnyPS5. Originally posted by harry-z-kang on 2026-10-13T17:50:01Z.
Rebased #4916 onto current main
18c438b10and resolved the conflicts inmain.cpp,GuestModuleBuilder.cpp, andimport_audit.py. The new head is687be2d8b.#4559 and #4606 are now merged. Their module imports/exports, module-aware reference count, registry order, and
stopsreport are preserved alongside the companion dependency metadata. The relinker's new conversion pipeline and progress reporting are also preserved. Companions now follow the current executable/module indexing, including each--executableoutput and shared guest modules.I added regression cases for an executable and a secondary executable with different zero-import dependencies, followed by resolving the dependency through a shared bundled module, in both Linux and Windows output formats.
Full build/test validation ran on
0b167a486against main8cf6a0bc3. The final rebase to main18c438b10includes only an unrelated PlayGo change; the relinker, audit, and associated test files are identical in the published head.long_paths, because Windows long paths are disabled), 0 failed.Depends on now lists only #4425, which remains open. I also checked a separate integration checkout combining tested head
0b167a486with #4425 at05d52e396, preserving its atomicwrite_json(args.json, result)together with all report fields: the 58 focused audit tests completed successfully on Windows (56 passed, 2 POSIX-only skips) and Linux (57 passed, 1 Windows-only skip), and the expanded relinker fixtures passed on both. Those dependency commits are not carried in this PR; a rebase will still be needed when #4425 lands.AI-assisted: yes (Codex).
Imported from boykopovar/AnyPS5. Originally posted by Nixitov on 2026-10-13T19:22:33Z.
Flagging from the other side of the overlap bot: #5269 adds a
weakfield to each call-registry entry ({"weak": true|false}), and this PR adds the companion dependency metadata to the same test's expected entry. It is a same-file overlap only — resolve by keeping both fields.#5269 is independent and already clean, while this PR waits on #4425, so #5269 can land first; I'll rebase it after #4916 if you'd rather go that way. The published head of #4916 keeps the
stopsreport and registry order, which #5269 relies on.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by harry-z-kang on 2026-10-13T19:46:18Z.
Agreed, @Nixitov: #5269 can land first. #4916 now lists both #4425 and #5269 in Depends on; those two are independent, and I will rebase after both land.
I reproduced the #5269 conflict in a separate checkout. The resolution keeps the expected strong entry's
weak: false, the newweak: truefixture, and our.needed.json == ["lib.so"]assertion. The weak-import stop filtering, registry order, module-aware reference counts, and companion metadata are all retained. Combining #4425 also preserves all report fields and callswrite_json(args.json, result).Pinned validation used main
dacd78525, #4916 at2e2452968, #5269 at8f7edccb3, and #4425 at05d52e396, producing integration checkout042c4923f:call_registry,guest_registry,needed_libraries,weak_imports,input_preservation, andimport_audit.The published branch is rebased onto main
dacd78525and carries only our contribution, retaining the configured Git author/committer. Its relinker, audit, test, and build files are unchanged from the fully validated head documented in the PR; conventions and whitespace checks pass. The dependency commits and combined conflict resolution remain in the separate checkout until they land. This is pinned compatibility validation, with no title runtime or GPU testing.AI-assisted: yes (Codex).
Imported from boykopovar/AnyPS5. Originally posted by harry-z-kang on 2026-10-14T02:46:43Z.
Rebased onto main
0defec438; the new head is22b190ae0.#4425 is now merged. I resolved the JSON-report conflict by retaining
dependency_registries,needed_libraries,stops, and the other existing report fields, then callingwrite_json(args.json, result). The rebase also preserves main's newer input validation, output-directory checks, Linux runpath handling, Windows resource handling, and conversion diagnostics.Validation on the rebased head, using Release relinker-only builds:
long_paths, because Windows long paths are disabled), 0 failed.Depends on now lists only #5269. I refreshed the separate integration checkout against its head
b9acf3480, producing7420d0e89. Both OS builds and all seven relevant CTest targets pass, including conversion diagnostics and the combined weak-import and companion assertions. The 62 audit tests pass with platform skips (Windows 60 passed / 2 skipped; Linux 61 passed / 1 skipped). The published branch does not carry #5269's commits; a final rebase remains after it lands.No full emulator build, title runtime, or GPU testing was performed.
AI-assisted: yes (Codex).
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-14T15:46:27Z.
macOS data point, as a third host next to the Windows and Linux runs.
Apple M2 Max, macOS 27.2 (26B5091g), AppleClang, Ninja Release, relinker-only. Head
22b190ae0merged without conflicts intomain84b01f9cd.ctest --parallel 8 --timeout 30157/157 pass, no skips.import_audit,needed_libraries,call_registry,guest_registry,weak_imports,input_preservationandconversion_diagnosticsall pass.-DCMAKE_OSX_ARCHITECTURES=x86_64, x86_64 Python 3.9): the same seven pass. 6 other tests fail (pr_overlap_encoding,progress_history,stubgen_stdout_newlines,release_package,linux_fixed_base,guest_module_args), the same 6 that fail on unmodifiedmainon this machine (five are Python 3.9 incompatibilities of the only x86_64 Python here;guest_module_argsis the fixture #5362 fixes).Not checked here: the combined checkout with #5269.
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T19:04:40Z.
#5269 is merged, so I rebased this onto current
main. The only conflict was intest_call_registry.py; resolved as proposed in the thread: kept #5269'sweak: truefixture and your.needed.json == ["lib.so"]assertion. Relinker build and theimport_audit,call_registry,guest_registry,needed_libraries,weak_imports,input_preservation,conversion_diagnosticstests pass on the rebased head. Merging once the full Build is green.