fix(import-audit): audit imports from guest modules #4243

Closed
MarcZX10 wants to merge 1 commit from upstream-pr/4243 into main
MarcZX10 commented 2026-10-12 02:06:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T02:06:34Z.


What

Carries Leandro Soares's implementation for #4202, preserving the original commit author. tools/import_audit.py --modules now parses each shipped ELF module's undefined symbols and DT_NEEDED entries. It classifies those imports against built libraries and sibling module exports, attributes records to the importing module, and reports needed libraries missing from both input sets. With no --modules, existing audit output stays unchanged.

The --modules behavior change and supported ELF format are documented in docs/user/USAGE.md. This is an independent tooling fix from open #4196, which changes alias parsing in two shared files. The two current PR heads combine without merge conflicts; a rebase may still be needed depending on merge order.

Tested

Linux, Python 3:

  • python3 -m unittest tools.tests.test_import_audit tools.tests.test_nid_names: passed (24 tests).
  • python3 -m unittest discover -s tools/tests -p 'test_*.py': passed (95 tests).
  • tools/check_conventions.py --base upstream/main --head HEAD: passed.
  • git diff --check upstream/main...HEAD: passed.

This validates the diagnostic tool; no game run or native build was performed.

Checklist

  • Based on current main; no other open PR implements the same behavior
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt (n/a)
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (n/a)
  • Generic behavior, not specific to one title
  • Depends on: none
  • AI-assisted: yes (carried commit from Leandro Soares)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4824083840 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4243). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T02:06:34Z. --- ### What Carries Leandro Soares's implementation for #4202, preserving the original commit author. `tools/import_audit.py --modules` now parses each shipped ELF module's undefined symbols and `DT_NEEDED` entries. It classifies those imports against built libraries and sibling module exports, attributes records to the importing module, and reports needed libraries missing from both input sets. With no `--modules`, existing audit output stays unchanged. The `--modules` behavior change and supported ELF format are documented in `docs/user/USAGE.md`. This is an independent tooling fix from open #4196, which changes alias parsing in two shared files. The two current PR heads combine without merge conflicts; a rebase may still be needed depending on merge order. ### Tested Linux, Python 3: - `python3 -m unittest tools.tests.test_import_audit tools.tests.test_nid_names`: passed (24 tests). - `python3 -m unittest discover -s tools/tests -p 'test_*.py'`: passed (95 tests). - `tools/check_conventions.py --base upstream/main --head HEAD`: passed. - `git diff --check upstream/main...HEAD`: passed. This validates the diagnostic tool; no game run or native build was performed. ### Checklist - [x] Based on current `main`; no other open PR implements the same behavior - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) (n/a) - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (n/a) - [x] Generic behavior, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes (carried commit from Leandro Soares)
oneandonlydean commented 2026-10-12 07:37:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T07:37:30Z.


Closing: a title's sce_module files have no section header table and their symbols carry a #lib#mod suffix, so with this the documented --modules source/sce_module run stops with ELF file without a section header table is not supported. A module's own imports are already audited from its app.<module>.registry.json; reopen if a real module shows an import that misses.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6119863201 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4243#issuecomment-6119863201). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-12T07:37:30Z. --- Closing: a title's `sce_module` files have no section header table and their symbols carry a `#lib#mod` suffix, so with this the documented `--modules source/sce_module` run stops with `ELF file without a section header table is not supported`. A module's own imports are already audited from its `app.<module>.registry.json`; reopen if a real module shows an import that misses.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!4243
No description provided.