Skip to content

fix(tools): normalize qualified ELF module exports - #6113

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
ArjenS-LA:fix/import-audit-export-suffix
Oct 16, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
ArjenS-LA:fix/import-audit-export-suffix

Conversation

@ArjenS-LA

@ArjenS-LA ArjenS-LA commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

What

The import audit incorrectly reports a guest import as absent when its sibling module exports the matching NID with a #library#module suffix and retains ELF section headers. The sectionless reader already resolves the same symbol. Normalize section-based export names at the first #, matching the import reader, sectionless reader, and relinker's GuestImageReader export handling.

The regression fixture audits consumer.prx importing NID#import#module against provider.prx exporting NID#export#module. It covers section headers, sectionless SysV hash and sectionless GNU hash, verifies the JSON provider and importing module, and checks that a different NID remains absent.

Branch: fix/import-audit-export-suffix
Baseline: eea428ca855fb59a3edd394bab9abf99165590f1
Tested commit: fcd477faf8fd0b4959f927db1f36590b317fa2b7.

Tested

Windows 11 build 26200, AMD64, CPython 3.13.7. Python tooling only; no C++ compiler, GPU, title or homebrew execution was required or performed.

  • Same new regression against a separate untouched baseline source copy: fails for the section-header case (audit exit 1 instead of 0), with both sectionless controls passing.
  • Fixed regression: passes, including the unrelated-export negative control.
  • tools/tests/test_import_audit.py: 80 tests, 76 passed and 4 skipped, 2.830 seconds. Two POSIX permission checks are unavailable on Windows, symlink creation lacks privilege, and the existing source-stamp fixture was explicitly excluded because it creates a temporary Git commit. An external runner applied this skip without changing tracked tests.
  • git diff --check: passed.
  • python tools/check_conventions.py --base origin/main: passed on the committed change.

Reproducer: python -m unittest tools.tests.test_import_audit.ImportAuditTests.test_module_export_suffix_is_stripped_with_and_without_sections -v.

Open PR comparison

Checked main eea428ca855fb59a3edd394bab9abf99165590f1 and the complete 466-PR inventory with paginated changed-file lists. Each overlapping head was normalized onto that main with Git tree-only merges, then compared with main as the explicit merge base. No temporary commits were created. This branch merges cleanly with main. The four proposed changes also merge cleanly with one another.

#5713 changes Git stamping; #5571 changes out-of-file section-table fallback. Neither normalizes section-based export names. #5473 has no remaining common-base diff in the shared files.

Checklist

  • Based on current main; no other open PR implements the same functions
  • 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 under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes, OpenAI Codex

@Dextroid17

Copy link
Copy Markdown
Contributor

I ran the test this PR adds, on Linux.

Setup: head fcd477f merged into main at ff23657 (no conflicts), Linux, Python 3.14.8, clean environment (env -i, only HOME and PATH set). python3 -m unittest -v test_import_audit from tools/tests, 3 runs each.

  • with this PR: 3 of 3 runs pass (85 tests, 1 Windows-only test skipped).
  • with tools/import_audit.py put back to main's version (the PR's test changes kept): 3 of 3 runs fail, each time only at the layout='sections' subtest of test_module_export_suffix_is_stripped_with_and_without_sections.

The export path for ELFs with section headers now strips the # suffix, as main already did for section-less dynamic symbols and in elf_imports.
I did not check Windows or macOS.

AI-assisted: yes

@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the one-line change in elf_exports against the other two readers (lines 145 and 208, same # split) and the new test: import_audit passes on the merged tree and fails with tools/import_audit.py reverted. The test covers section headers, sectionless SysV/GNU hash and a different-NID negative control. Also confirmed on Linux by @Dextroid17. Merging.

@adriadam10
adriadam10 merged commit f6a2091 into boykopovar:main Oct 16, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants