fix(tools): do not report weak imports as a title's current stop #5269
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5269"
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 Nixitov on 2026-10-13T16:06:37Z.
What
A weak import is optional: the relinker's entry stub leaves it unresolved (the loader sees null) instead of failing, so a title whose only missing import is weak still runs. The
stopsreport added in #4606 counted those as the title's current stop, so it reported stops that no title actually has.regie5 (PPSA99520) is the example: it weak-links
sceLncUtilLaunchApp(+nRJUD-7qCk, libSceSystemService) as its fallback launcher, and the audit reported that as its stop — but onmainthe title runs past it (it reaches its own code and stops later for an unrelated reason). A contributor following the report would implement a function the title does not need.NidReference::Weak, used by the entry stub); the call registry now records it as aweakfield on each entry.tools/import_audit.pyreads that field and skips weak imports when it computescurrent_stop, sostops(and the JSON report) list only imports the loader cannot resolve.Tested
Windows 11, MinGW-w64 GCC 15.2.0 (WinLibs r7), Release.
core/relinker/relinker/tests/test_call_registry.pynow asserts theweakfield for a global symbol and for aSTB_WEAKone;ctest -R call_registrypasses.tools/tests/test_import_audit.pyadds a case where a weak unresolved import before a strong one is not the stop;ctest -R import_auditpasses (47 tests)."weak": truefor+nRJUD-7qCk, and the recomputed stop list no longer reports PPSA99520 (before:+nRJUD-7qCkat libSceSystemService; after: none). A strong import (2 Ship 2 Harkinian'snsBDTu22CBU) still records"weak": false.python tools/check_conventions.py --base origin/mainpasses.Checklist
main; no other open PR implements the same behaviourNotImplemented_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 Nixitov on 2026-10-13T19:22:32Z.
Thanks bot. Same-file overlap only: both PRs add a field to the expected entry in
test_call_registry.py— this one addsweak(the import's symbol binding) and #4916 adds the dependency metadata for a zero-import dependency. The resolution is to keep both fields; nothing else in the file collides.#5269 is independent and clean, while #4916 waits on #4425, so this can land first. I'm happy to rebase it after #4916 if the maintainer prefers the other order.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T18:11:34Z.
Checked the relinker change (
weakwritten fromNidReference::Weak, consistent with the entry stubs leaving weak imports null on both SysV and Windows),test_call_registry.py(global andSTB_WEAKcases) andtest_import_audit.py(66 tests) locally; all pass. Merging once the full Build is green.