feat(relinker): analyze function symbols as code roots #15032

Merged
AZLisme merged 8 commits from upstream-pr/15032 into main 2026-11-07 12:40:33 +00:00
AZLisme commented 2026-11-02 11:09:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by AZLisme on 2026-11-02T11:09:58Z.


What

Adds the explicit --function-symbol-roots mode for ELF companion modules whose function-symbol st_size values describe different code. The default strict conversion is unchanged. Fixes #14893 without identifying a title, path, function name or fixed stub pattern.

The mode preserves symbol metadata, validates defined function entries as executable and file-backed, and follows the existing control-flow roots and unwind ranges during Windows/macOS code analysis. It ignores only function-symbol extents; data, TLS and FDE bounds remain checked. In this mode, actual fall-through is followed through zero bytes, direct and resolved indirect targets are validated, and valid targets in another executable segment are analyzed. Unresolved computed jumps retain the existing discovery limits, recorded in docs/dev/debt/relinker.md.

The ELF symbol-table specification distinguishes a symbol address from its optional size. This is an explicit compatibility option for incorrect sizes, not a claim that the original metadata is correct or that all indirect control flow is known.

Integrated frozen main 1e24993fa3a7da25e8fc27152af654687ba64552 in current head bb619a8abbc5ded501c4f368c61d3616e493922f. Preserve main's Windows executable exports, output name and TLS index while applying function-root extent handling to exported functions. Preserve both main's plain/SCE test split and this PR's target/rejection split; all eight groups retain their assertions and original timeouts.

Tested

  • Current head bb619a8abbc5ded501c4f368c61d3616e493922f, Linux x86-64/GCC 16.2.1 Release, relinker-only: built successfully. All 717 registered CTests passed, with no skips, across the full run and 14 corrected-environment retries. The initial 14 failures came from the incomplete CMake on PATH and sandbox restrictions on local HTTP/filesystem tests; the complete CMake and permitted test environment passed all 14 without source or assertion changes. All three function-symbol-root groups, eight guest None groups and Windows executable-export tests passed.
  • Added a Windows visible-function export regression: oversized function metadata actually failed in the output stage before the fix; strict mode still rejects it, while roots mode emits the expected export address and original instruction bytes. Data and TLS overruns are rejected without output in both modes. Independent source review also checked constructor/option propagation and preservation of all 216 None conversions plus four Linux native loads.
  • Current-head conversion of the unchanged public sfiii package from #14893: default strict mode rejects the companion at address 22792 with exit 2 and no output; roots mode exits 0 and creates the executable plus one companion for Linux ELF, Windows PE and macOS Mach-O. All six conversions ran on Linux; input files remained unchanged. No title gameplay or console execution is claimed.
  • Current-head upstream run 41985452480, exact bb619a8a plus frozen main 1e24993f: Linux 717/717, macOS ARM64 706/706, macOS x86-64 under Rosetta 706/706, TLS-only ASan 34/34, all passed without skips. Windows job 127105049968 passed 720/721, with web_release timing out at 20.24 seconds; no skips. All eight None groups, three roots groups and Windows executable-export tests passed there. The Windows aggregate remains failed; there is no proof that main also fails or that it is a flake. That packaging test, its registration/20-second timeout and the three tools it exercises are unchanged from frozen main. Earlier runs keep their original input scopes.
  • Exact-head isolated Windows diagnostic 41987419021 passed the original web_release CTest in 3.17 seconds, with the unchanged 20-second timeout and all 34 internal unittests passing. Product source/tree and its main parent were checked. This was one isolated test on a Windows runner, without the original suite's concurrent workload; it does not erase the upstream timeout or make the full Windows job pass. A maintainer rerun of the failed upstream job has been requested because this account has READ access.
  • git diff origin/main --check and python3 tools/check_conventions.py --base origin/main pass. The overlap check was completed before opening. Known control-flow discovery and noreturn limitations remain in docs/dev/debt/relinker.md.

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
  • Fixes: #14893
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5119319832 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15032). Originally posted by [AZLisme](https://github.com/AZLisme) on 2026-11-02T11:09:58Z. --- ### What Adds the explicit `--function-symbol-roots` mode for ELF companion modules whose function-symbol `st_size` values describe different code. The default strict conversion is unchanged. Fixes #14893 without identifying a title, path, function name or fixed stub pattern. The mode preserves symbol metadata, validates defined function entries as executable and file-backed, and follows the existing control-flow roots and unwind ranges during Windows/macOS code analysis. It ignores only function-symbol extents; data, TLS and FDE bounds remain checked. In this mode, actual fall-through is followed through zero bytes, direct and resolved indirect targets are validated, and valid targets in another executable segment are analyzed. Unresolved computed jumps retain the existing discovery limits, recorded in `docs/dev/debt/relinker.md`. The [ELF symbol-table specification](https://gabi.xinuos.com/elf/05-symtab.html) distinguishes a symbol address from its optional size. This is an explicit compatibility option for incorrect sizes, not a claim that the original metadata is correct or that all indirect control flow is known. Integrated frozen main `1e24993fa3a7da25e8fc27152af654687ba64552` in current head `bb619a8abbc5ded501c4f368c61d3616e493922f`. Preserve main's Windows executable exports, output name and TLS index while applying function-root extent handling to exported functions. Preserve both main's plain/SCE test split and this PR's target/rejection split; all eight groups retain their assertions and original timeouts. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> - Current head `bb619a8abbc5ded501c4f368c61d3616e493922f`, Linux x86-64/GCC 16.2.1 Release, relinker-only: built successfully. All **717 registered CTests passed**, with no skips, across the full run and 14 corrected-environment retries. The initial 14 failures came from the incomplete CMake on PATH and sandbox restrictions on local HTTP/filesystem tests; the complete CMake and permitted test environment passed all 14 without source or assertion changes. All three function-symbol-root groups, eight guest None groups and Windows executable-export tests passed. - Added a Windows visible-function export regression: oversized function metadata actually failed in the output stage before the fix; strict mode still rejects it, while roots mode emits the expected export address and original instruction bytes. Data and TLS overruns are rejected without output in both modes. Independent source review also checked constructor/option propagation and preservation of all 216 None conversions plus four Linux native loads. - Current-head conversion of the unchanged public sfiii package from #14893: default strict mode rejects the companion at address 22792 with exit 2 and no output; roots mode exits 0 and creates the executable plus one companion for Linux ELF, Windows PE and macOS Mach-O. All six conversions ran on Linux; input files remained unchanged. No title gameplay or console execution is claimed. - Current-head [upstream run 41985452480](https://github.com/boykopovar/AnyPS5/actions/runs/41985452480), exact `bb619a8a` plus frozen main `1e24993f`: Linux **717/717**, macOS ARM64 **706/706**, macOS x86-64 under Rosetta **706/706**, TLS-only ASan **34/34**, all passed without skips. [Windows job 127105049968](https://github.com/boykopovar/AnyPS5/actions/runs/41985452480/job/127105049968) passed **720/721**, with `web_release` timing out at 20.24 seconds; no skips. All eight None groups, three roots groups and Windows executable-export tests passed there. The Windows aggregate remains failed; there is no proof that main also fails or that it is a flake. That packaging test, its registration/20-second timeout and the three tools it exercises are unchanged from frozen main. Earlier runs keep their original input scopes. - Exact-head isolated Windows [diagnostic 41987419021](https://github.com/AZLisme/AnyPS5/actions/runs/41987419021/job/127111364541) passed the original `web_release` CTest in **3.17 seconds**, with the unchanged **20-second timeout** and all 34 internal unittests passing. Product source/tree and its main parent were checked. This was one isolated test on a Windows runner, without the original suite's concurrent workload; it does not erase the upstream timeout or make the full Windows job pass. A maintainer rerun of the failed upstream job has been requested because this account has READ access. - `git diff origin/main --check` and `python3 tools/check_conventions.py --base origin/main` pass. The overlap check was completed before opening. Known control-flow discovery and noreturn limitations remain in `docs/dev/debt/relinker.md`. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [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 under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none <!-- #PR, or none --> - [x] Fixes: #14893 <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: n/a <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no -->
MarcZX10 commented 2026-11-02 11:18:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T11:18:11Z.

Review: COMMENTED


Reviewed — no blocking findings

I reviewed all 28 changed files at head 11a32e87545102a39063593df201ce0e0506f8b3; source inspection found no blocker, and the hosted checks were still queued at the final refresh.

What I ran

Reviewed head 11a32e87545102a39063593df201ce0e0506f8b3 against base 3c3b3cda739f9eb00a07fae50d94a3af5f6fb8f2. The exact head previews cleanly against current main. Environment: Debian 12 Linux, Python 3.11.2, GCC 12.2.0. I did not configure or build.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 15032 --output-dir /tmp/review-15032
git diff --check 3c3b3cda739f9eb00a07fae50d94a3af5f6fb8f2...11a32e87545102a39063593df201ce0e0506f8b3
python3 tools/check_conventions.py --base 3c3b3cda739f9eb00a07fae50d94a3af5f6fb8f2 --head 11a32e87545102a39063593df201ce0e0506f8b3 --title 'feat(relinker): analyze function symbols as code roots' --body /tmp/review-15032/pr-body.md
python3 -m py_compile core/relinker/relinker/tests/test_function_symbol_roots.py
python3 tools/check_test_registration.py --scripts
python3 tools/pr_stack_check.py 15032 --repo boykopovar/AnyPS5 --output-dir /tmp/review-15032/stack
python3 tools/pr_test_quality.py --root /tmp/review-15032/test-quality --json core/relinker/relinker/tests/test_function_symbol_roots.py
gh pr checks 15032 --repo boykopovar/AnyPS5

The checks selected from the exact head found no test-quality heuristic findings. The precheck wrapper could not find the optional local heuristic script in its isolated snapshot; I reran that heuristic against the exact-head test and CMake files.

Results

Check Result Note
Patch whitespace passed No diagnostics.
Conventions and PR template passed No findings.
Python syntax passed New test script parses.
Test registration passed 243 repository test scripts are registered; new groups are registered in CMake.
Test-quality heuristic passed No heuristic findings; this is not runtime test evidence.
Merge preview passed Clean against current base.
Hosted checks not run Conventions, eligibility, intake and labels were queued.
Precheck wrapper heuristic step failed Helper missing from isolated snapshot; direct exact-head rerun produced no findings.
Unedited outputs from the checks
Precheck wrapper:
/tmp/review-15032/report.md
/tmp/review-15032/report.json
Conclusion: checks failed

Precheck helper stderr:
/usr/bin/python3: can't open file '/tmp/review-15032/head-11a32e875451-535b92e1/tools/pr_test_quality.py': [Errno 2] No such file or directory

Conventions:
All conventions checks passed.

Test registration:
243 test script(s), each run by an add_test or a workflow

Exact-head test-quality heuristic:
{
  "findings": [],
  "negative_control_candidates": [],
  "limits": [
    "Heuristics can miss weak assertions and can flag valid tests; inspect every finding.",
    "A test that passes against base is not by itself proof that the PR test is inadequate.",
    "Negative controls are only candidates until the test actually runs against base and fails by assertion rather than import/setup error."
  ]
}

Merge preview:
# PR stack check — fresh

Target: https://github.com/boykopovar/AnyPS5/pull/15032
Target branch tip: `3c3b3cda739f9eb00a07fae50d94a3af5f6fb8f2`
All heads unchanged: **True**
Dependency order: #15032

## Individual merge previews

- PR #15032: **clean** against current base; head `11a32e87545102a39063593df201ce0e0506f8b3`; changed paths: none reported

## Dependency relationships

No declared PR dependencies were found in the target PR chain.

Hosted checks at final refresh:
conventions	pending	0	https://github.com/boykopovar/AnyPS5/actions/runs/41434595138/job/125241185665
eligibility	pending	0	https://github.com/boykopovar/AnyPS5/actions/runs/41434595499/job/125241184275
intake	pending	0	https://github.com/boykopovar/AnyPS5/actions/runs/41434595250/job/125241186436
labels	pending	0	https://github.com/boykopovar/AnyPS5/actions/runs/41434595081/job/125241184892

Negative control

Assertion Change to code under test Did the new test fail?
Invalid function-symbol entries, ranges and reachable truncated instructions are rejected. Not changed. Not run; the test requires an exact-head relinker binary, which I did not build.

Findings

Blocking

None found in the complete source review.

Non-blocking

None.

Sources

Not verified

  • I did not build or run CTest or the new relinker scenarios. The PR description reports broader Linux and Windows builds/tests; those results are author-reported and were not independently verified here.
  • All four hosted checks were queued at the final refresh; cross-platform hosted results are not yet known.
  • Native Windows/macOS execution, console behavior and real-game behavior were not verified in this review.
  • The source-only review does not establish behavior for unresolved indirect jumps beyond the documented discovery limits.

To get this to a good state

No code change is requested from this review. Once the hosted checks finish, I will re-check this exact head and its results, then approve if the required checks pass; if the head changes, I will review the new diff and rerun the affected checks.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5735739230 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15032#pullrequestreview-5735739230). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-02T11:18:11Z. **Review:** COMMENTED --- # Reviewed — no blocking findings I reviewed all 28 changed files at head `11a32e87545102a39063593df201ce0e0506f8b3`; source inspection found no blocker, and the hosted checks were still queued at the final refresh. ## What I ran Reviewed head `11a32e87545102a39063593df201ce0e0506f8b3` against base `3c3b3cda739f9eb00a07fae50d94a3af5f6fb8f2`. The exact head previews cleanly against current `main`. Environment: Debian 12 Linux, Python 3.11.2, GCC 12.2.0. I did not configure or build. ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 15032 --output-dir /tmp/review-15032 git diff --check 3c3b3cda739f9eb00a07fae50d94a3af5f6fb8f2...11a32e87545102a39063593df201ce0e0506f8b3 python3 tools/check_conventions.py --base 3c3b3cda739f9eb00a07fae50d94a3af5f6fb8f2 --head 11a32e87545102a39063593df201ce0e0506f8b3 --title 'feat(relinker): analyze function symbols as code roots' --body /tmp/review-15032/pr-body.md python3 -m py_compile core/relinker/relinker/tests/test_function_symbol_roots.py python3 tools/check_test_registration.py --scripts python3 tools/pr_stack_check.py 15032 --repo boykopovar/AnyPS5 --output-dir /tmp/review-15032/stack python3 tools/pr_test_quality.py --root /tmp/review-15032/test-quality --json core/relinker/relinker/tests/test_function_symbol_roots.py gh pr checks 15032 --repo boykopovar/AnyPS5 ``` The checks selected from the exact head found no test-quality heuristic findings. The precheck wrapper could not find the optional local heuristic script in its isolated snapshot; I reran that heuristic against the exact-head test and CMake files. ## Results | Check | Result | Note | |---|---|---| | Patch whitespace | passed | No diagnostics. | | Conventions and PR template | passed | No findings. | | Python syntax | passed | New test script parses. | | Test registration | passed | 243 repository test scripts are registered; new groups are registered in CMake. | | Test-quality heuristic | passed | No heuristic findings; this is not runtime test evidence. | | Merge preview | passed | Clean against current base. | | Hosted checks | not run | Conventions, eligibility, intake and labels were queued. | | Precheck wrapper heuristic step | failed | Helper missing from isolated snapshot; direct exact-head rerun produced no findings. | <details><summary>Unedited outputs from the checks</summary> ```text Precheck wrapper: /tmp/review-15032/report.md /tmp/review-15032/report.json Conclusion: checks failed Precheck helper stderr: /usr/bin/python3: can't open file '/tmp/review-15032/head-11a32e875451-535b92e1/tools/pr_test_quality.py': [Errno 2] No such file or directory Conventions: All conventions checks passed. Test registration: 243 test script(s), each run by an add_test or a workflow Exact-head test-quality heuristic: { "findings": [], "negative_control_candidates": [], "limits": [ "Heuristics can miss weak assertions and can flag valid tests; inspect every finding.", "A test that passes against base is not by itself proof that the PR test is inadequate.", "Negative controls are only candidates until the test actually runs against base and fails by assertion rather than import/setup error." ] } Merge preview: # PR stack check — fresh Target: https://github.com/boykopovar/AnyPS5/pull/15032 Target branch tip: `3c3b3cda739f9eb00a07fae50d94a3af5f6fb8f2` All heads unchanged: **True** Dependency order: #15032 ## Individual merge previews - PR #15032: **clean** against current base; head `11a32e87545102a39063593df201ce0e0506f8b3`; changed paths: none reported ## Dependency relationships No declared PR dependencies were found in the target PR chain. Hosted checks at final refresh: conventions pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41434595138/job/125241185665 eligibility pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41434595499/job/125241184275 intake pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41434595250/job/125241186436 labels pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41434595081/job/125241184892 ``` </details> ## Negative control | Assertion | Change to code under test | Did the new test fail? | |---|---|---| | Invalid function-symbol entries, ranges and reachable truncated instructions are rejected. | Not changed. | Not run; the test requires an exact-head relinker binary, which I did not build. | ## Findings ### Blocking None found in the complete source review. ### Non-blocking None. ## Sources - [Function-symbol entries become code roots only in the explicit mode](https://github.com/boykopovar/AnyPS5/blob/11a32e87545102a39063593df201ce0e0506f8b3/core/relinker/relinker/src/analysis/CodeInstructionCollector.cpp#L295-L309) - [The reader preserves symbol metadata while checking function roots as file-backed code](https://github.com/boykopovar/AnyPS5/blob/11a32e87545102a39063593df201ce0e0506f8b3/core/relinker/relinker/src/guest/GuestImageReader.cpp#L201-L223) - [New executable, module and rejection test groups are registered](https://github.com/boykopovar/AnyPS5/blob/11a32e87545102a39063593df201ce0e0506f8b3/core/relinker/CMakeLists.txt#L675-L679) ## Not verified - I did not build or run CTest or the new relinker scenarios. The PR description reports broader Linux and Windows builds/tests; those results are author-reported and were not independently verified here. - All four hosted checks were queued at the final refresh; cross-platform hosted results are not yet known. - Native Windows/macOS execution, console behavior and real-game behavior were not verified in this review. - The source-only review does not establish behavior for unresolved indirect jumps beyond the documented discovery limits. ## To get this to a good state No code change is requested from this review. Once the hosted checks finish, I will re-check this exact head and its results, then approve if the required checks pass; if the head changes, I will review the new diff and rerun the affected checks.
MarcZX10 commented 2026-11-03 08:57:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-03T08:57:54Z.

Review: COMMENTED


Re-checked — new head, no blocking findings

I reviewed the full new head after its preserving merge from main; the source and test changes have no blocking findings, but the new-head relinker checks are still queued, so this is not an approval.

What I ran

Reviewed all 28 changed files at head ad9c12659454d099fc989663202e5777cef0ef1a against base 4f41f4c375f5abb487dbd184fbc150f31994d762. The exact-head stack preview is clean. Environment: Debian 12, Linux x86_64, Python 3.11.2, Git 2.39.5, GCC 12.2.0 available; I did not compile with GCC.

git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...ad9c12659454d099fc989663202e5777cef0ef1a
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 15032 --output-dir /tmp/anyps5-pr-precheck/15032-20261103T-current
python3 tools/pr_test_quality.py --root /tmp/anyps5-pr-precheck/15032-20261103T-current/head-ad9c12659454-e78a5749 --json core/relinker/relinker/tests/test_function_symbol_roots.py
gh pr checks 15032 --repo boykopovar/AnyPS5

Results

Check Result Note
Diff and conventions passed Whitespace and repository checks passed.
Python syntax and test registration passed Syntax is valid; all test scripts are registered.
Test-quality heuristic passed No heuristic findings; this is not a test execution.
Current-base merge preview passed The exact head merges cleanly with the current base.
Required new-head CI not run Relinker matrix, conventions and labels are queued.
Local build, CTest and negative control not run I did not compile or execute the relinker.
Author-reported Linux tests passed The author reports 683/683 exact-head tests; I did not reproduce them.
Commands and unedited output

Precheck summary:

diff_check: passed
conventions_and_pr_template: passed
changed_export_abi_audit: not_applicable — No changed source or public header under core/libs/prx.
python_syntax: passed
python_test_registration: passed
live_dependency_and_mergeability_check: passed
build_dependent_cpp_tests: not_applicable — no build was run
test_quality_heuristics: failed — tools/pr_test_quality.py is absent from the isolated PR snapshot
negative_controls: not_applicable — no changed Python test module in tools/ can be run as a no-build base-source control

The test-quality helper was then run from the workspace against the exact-head snapshot:

{
  "findings": [],
  "negative_control_candidates": [],
  "limits": [
    "Heuristics can miss weak assertions and can flag valid tests; inspect every finding.",
    "A test that passes against base is not by itself proof that the PR test is inadequate.",
    "Negative controls are only candidates until the test actually runs against base and fails by assertion rather than import/setup error."
  ]
}

Hosted status at the final refresh:

conventions pending
labels pending
relinker (macos-latest, clang++) pending
relinker (macos-latest, clang++, x86_64) pending
relinker (ubuntu-latest, g++) pending
relinker (windows-latest, g++) pending
relinker-asan pending
linux skipping
register-context skipping
write-watch skipping
eligibility pass
edge-watch skipping
windows skipping

Negative control

I did not run a local control because the test requires an exact-head relinker binary. The author reports that strict mode rejects address 22792 while root mode converts the executable and companion; I did not independently reproduce those runs.

Findings

Blocking

None found in the 28 changed files.

Non-blocking

The new-head relinker matrix, conventions check and label check are still pending. The reported 683-test Linux run is author-provided evidence, not a run I performed.

Sources

Not verified

I did not run a build, relinker tests, the test's negative control, Windows/macOS execution, or PS5 behavior. Hosted relinker jobs remain pending.

To get this to a good state

Please let the queued checks complete and address any failures. I will re-check this head and its results when those checks finish or if the head changes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5749391018 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15032#pullrequestreview-5749391018). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-03T08:57:54Z. **Review:** COMMENTED --- # Re-checked — new head, no blocking findings I reviewed the full new head after its preserving merge from `main`; the source and test changes have no blocking findings, but the new-head relinker checks are still queued, so this is not an approval. ## What I ran Reviewed all 28 changed files at head `ad9c12659454d099fc989663202e5777cef0ef1a` against base `4f41f4c375f5abb487dbd184fbc150f31994d762`. The exact-head stack preview is clean. Environment: Debian 12, Linux x86_64, Python 3.11.2, Git 2.39.5, GCC 12.2.0 available; I did not compile with GCC. ```sh git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...ad9c12659454d099fc989663202e5777cef0ef1a python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 15032 --output-dir /tmp/anyps5-pr-precheck/15032-20261103T-current python3 tools/pr_test_quality.py --root /tmp/anyps5-pr-precheck/15032-20261103T-current/head-ad9c12659454-e78a5749 --json core/relinker/relinker/tests/test_function_symbol_roots.py gh pr checks 15032 --repo boykopovar/AnyPS5 ``` ## Results | Check | Result | Note | |---|---|---| | Diff and conventions | passed | Whitespace and repository checks passed. | | Python syntax and test registration | passed | Syntax is valid; all test scripts are registered. | | Test-quality heuristic | passed | No heuristic findings; this is not a test execution. | | Current-base merge preview | passed | The exact head merges cleanly with the current base. | | Required new-head CI | not run | Relinker matrix, conventions and labels are queued. | | Local build, CTest and negative control | not run | I did not compile or execute the relinker. | | Author-reported Linux tests | passed | The author reports 683/683 exact-head tests; I did not reproduce them. | <details> <summary>Commands and unedited output</summary> Precheck summary: ```text diff_check: passed conventions_and_pr_template: passed changed_export_abi_audit: not_applicable — No changed source or public header under core/libs/prx. python_syntax: passed python_test_registration: passed live_dependency_and_mergeability_check: passed build_dependent_cpp_tests: not_applicable — no build was run test_quality_heuristics: failed — tools/pr_test_quality.py is absent from the isolated PR snapshot negative_controls: not_applicable — no changed Python test module in tools/ can be run as a no-build base-source control ``` The test-quality helper was then run from the workspace against the exact-head snapshot: ```json { "findings": [], "negative_control_candidates": [], "limits": [ "Heuristics can miss weak assertions and can flag valid tests; inspect every finding.", "A test that passes against base is not by itself proof that the PR test is inadequate.", "Negative controls are only candidates until the test actually runs against base and fails by assertion rather than import/setup error." ] } ``` Hosted status at the final refresh: ```text conventions pending labels pending relinker (macos-latest, clang++) pending relinker (macos-latest, clang++, x86_64) pending relinker (ubuntu-latest, g++) pending relinker (windows-latest, g++) pending relinker-asan pending linux skipping register-context skipping write-watch skipping eligibility pass edge-watch skipping windows skipping ``` </details> ## Negative control I did not run a local control because the test requires an exact-head relinker binary. The author reports that strict mode rejects address `22792` while root mode converts the executable and companion; I did not independently reproduce those runs. ## Findings ### Blocking None found in the 28 changed files. ### Non-blocking The new-head relinker matrix, conventions check and label check are still pending. The reported 683-test Linux run is author-provided evidence, not a run I performed. ## Sources - [Function-symbol root validation at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/ad9c12659454d099fc989663202e5777cef0ef1a/core/relinker/relinker/src/analysis/CodeInstructionCollector.cpp#L300-L318) - [Exact-head regression tests](https://github.com/boykopovar/AnyPS5/blob/ad9c12659454d099fc989663202e5777cef0ef1a/core/relinker/relinker/tests/test_function_symbol_roots.py) - [Author's merge-resolution and test report](https://github.com/boykopovar/AnyPS5/pull/15032#issuecomment-6599040081) ## Not verified I did not run a build, relinker tests, the test's negative control, Windows/macOS execution, or PS5 behavior. Hosted relinker jobs remain pending. ## To get this to a good state Please let the queued checks complete and address any failures. I will re-check this head and its results when those checks finish or if the head changes.
XairRrR commented 2026-11-03 09:39:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T09:39:44Z.

Review: APPROVED


Reviewed — approved

The opt-in --function-symbol-roots mode builds, its new tests pass and fail where they should, and the default strict conversion path is unchanged; I found nothing blocking.

What I ran

Head fd2d90bf77fa5b1bd0019b39c9af72a59a661aab, main 4f41f4c375f5abb487dbd184fbc150f31994d762, merged tree 252127109c2b7452e83afaa79a422568c9b9ab95 (merged with --no-ff). Debian 13 VM, GCC 14.2.0, Release, Ninja, BUILD_TESTING=ON.

git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...fd2d90bf77fa5b1bd0019b39c9af72a59a661aab
python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762
ctest --test-dir build -j8 --test-load 32 --output-on-failure -R "^(function_symbol_roots_|guest_none_relocations_|gs_trap_entry_roots|windows_tls_protected_entries|tls_function_coverage_)"
ctest --test-dir build -V -R "^(function_symbol_roots_executable|guest_none_relocations_windows)$"
python3 core/relinker/relinker/tests/test_guest_none_relocations.py build/core/relinker/relinker
# negative control (see below)
git show 4f41f4c375f5…:<each changed .cpp/.hpp> > <path>; ninja -C build core/relinker/relinker
python3 core/relinker/relinker/tests/test_function_symbol_roots.py build/core/relinker/relinker {executable,module,rejected}
python3 core/relinker/relinker/tests/test_function_symbol_roots.py build/core/relinker/relinker {executable,module} baseline
# targeted mutation: pass `false` instead of functionSymbolRoots to ExtendControlFlowGraph
python3 core/relinker/relinker/tests/test_function_symbol_roots.py build/core/relinker/relinker rejected
# restore merged files, rebuild, rerun
ctest --test-dir build -j8 --test-load 32 -R "^function_symbol_roots_"
git status --porcelain

Results

Check Result
git diff --check passed, no output
check_conventions.py passed ("All conventions checks passed.")
Configure / build / libs (script) passed
Script test run (826 selected) 823 passed, 2 expected skips, 1 known failure (unwrap_self_UnwrapTest_test_new_output_inherits_the_destination_directory_group, which fails on main too); no new failures or timeouts
function_symbol_roots_{executable,module,rejected} passed (0.19–0.26 s each)
guest_none_relocations_{linux,windows,macos,rejected} passed (0.26–0.51 s each)
Ungrouped test_guest_none_relocations.py (default all) passed
gs_trap_entry_roots, windows_tls_protected_entries, all 34 tls_function_coverage_* passed
Vulkan validation comparison not applicable: no AGC, shader or VideoOut files changed
Focused ctest summary
100% tests passed, 0 tests failed out of 43
Total Test time (real) =  16.52 sec

Negative control

I restored all 24 changed production .cpp/.hpp files from main and rebuilt relinker:

  • All three groups (executable, module, rejected) failed. For example: AssertionError: (... 'overrun-linux-roots/output', 1, '', 'FAIL: unknown option: --function-symbol-roots\n'). On main, the rejected group fails only because the option is unknown.
  • The baseline mode, which runs only the strict-path assertions, passed on main for executable and module. So the fixtures reproduce the strict rejection that the new mode is meant to avoid.

On the merged tree, I also changed only the strictFallThrough argument in CodeInstructionCollector.cpp:542 to false and rebuilt. function_symbol_roots_rejected then failed with AssertionError: ('zero-tail', 'windows', 0, ''), so the new fall-through-through-zero-bytes behaviour is covered.

After restoring the merged files and rebuilding, the three groups pass again, and git status --porcelain is empty.

Findings

Blocking

None.

Non-blocking

  • Strict fall-through also applies after calls, which can reject valid modules in this mode. See core/relinker/relinker/src/analysis/CodeInstructionCollector.cpp:566-571 and core/relinker/relinker/src/analysis/UnusedNidFilter/ControlFlowGraph.cpp:171-174. In root mode, the analysis follows fall-through after Call and IndirectCall, and it no longer trims trailing zero bytes. If a call to a noreturn function is followed by zero padding or non-code, conversion stops with Instruction truncated or fall-through is not executable. This fails closed and only affects the opt-in flag. However, the debt entry (docs/dev/debt/relinker.md:5) lists only unresolved computed jumps as the limit. Suggestion: add one clause to the debt entry saying that noreturn calls are assumed to fall through in this mode.
  • The test split is a separate topic. core/relinker/CMakeLists.txt:649-653 splits guest_none_relocations into four CTests to fix a macOS x86_64 timeout. That test script and its limit are identical on main. The split itself looks correct: the ungrouped invocation still passes locally, and every group finishes in under 1 s here. Still, it is unrelated to function-symbol roots, and CONTRIBUTING asks for one topic per pull request. It is small and test-only, so I am not asking for it to be removed.

Not verified

  • Native Windows and macOS execution. On Linux, the Windows outputs ran through windows_image_runner.py inside the test; the macOS outputs were only checked structurally.
  • The sfiii-ps5 input from #14893: I did not have it, and no title was run.
  • CI timing on macOS x86_64 for the split guest_none_relocations_* tests.
  • The author-reported 686/686 Linux and hosted CI counts.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5749891015 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15032#pullrequestreview-5749891015). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T09:39:44Z. **Review:** APPROVED --- # Reviewed — approved The opt-in `--function-symbol-roots` mode builds, its new tests pass and fail where they should, and the default strict conversion path is unchanged; I found nothing blocking. ## What I ran Head `fd2d90bf77fa5b1bd0019b39c9af72a59a661aab`, `main` `4f41f4c375f5abb487dbd184fbc150f31994d762`, merged tree `252127109c2b7452e83afaa79a422568c9b9ab95` (merged with `--no-ff`). Debian 13 VM, GCC 14.2.0, Release, Ninja, BUILD_TESTING=ON. ```sh git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...fd2d90bf77fa5b1bd0019b39c9af72a59a661aab python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762 ctest --test-dir build -j8 --test-load 32 --output-on-failure -R "^(function_symbol_roots_|guest_none_relocations_|gs_trap_entry_roots|windows_tls_protected_entries|tls_function_coverage_)" ctest --test-dir build -V -R "^(function_symbol_roots_executable|guest_none_relocations_windows)$" python3 core/relinker/relinker/tests/test_guest_none_relocations.py build/core/relinker/relinker # negative control (see below) git show 4f41f4c375f5…:<each changed .cpp/.hpp> > <path>; ninja -C build core/relinker/relinker python3 core/relinker/relinker/tests/test_function_symbol_roots.py build/core/relinker/relinker {executable,module,rejected} python3 core/relinker/relinker/tests/test_function_symbol_roots.py build/core/relinker/relinker {executable,module} baseline # targeted mutation: pass `false` instead of functionSymbolRoots to ExtendControlFlowGraph python3 core/relinker/relinker/tests/test_function_symbol_roots.py build/core/relinker/relinker rejected # restore merged files, rebuild, rerun ctest --test-dir build -j8 --test-load 32 -R "^function_symbol_roots_" git status --porcelain ``` ## Results | Check | Result | |---|---| | `git diff --check` | passed, no output | | `check_conventions.py` | passed ("All conventions checks passed.") | | Configure / build / libs (script) | passed | | Script test run (826 selected) | 823 passed, 2 expected skips, 1 known failure (`unwrap_self_UnwrapTest_test_new_output_inherits_the_destination_directory_group`, which fails on `main` too); no new failures or timeouts | | `function_symbol_roots_{executable,module,rejected}` | passed (0.19–0.26 s each) | | `guest_none_relocations_{linux,windows,macos,rejected}` | passed (0.26–0.51 s each) | | Ungrouped `test_guest_none_relocations.py` (default `all`) | passed | | `gs_trap_entry_roots`, `windows_tls_protected_entries`, all 34 `tls_function_coverage_*` | passed | | Vulkan validation comparison | not applicable: no AGC, shader or VideoOut files changed | <details><summary>Focused ctest summary</summary> ``` 100% tests passed, 0 tests failed out of 43 Total Test time (real) = 16.52 sec ``` </details> ## Negative control I restored all 24 changed production `.cpp`/`.hpp` files from `main` and rebuilt `relinker`: - All three groups (`executable`, `module`, `rejected`) failed. For example: `AssertionError: (... 'overrun-linux-roots/output', 1, '', 'FAIL: unknown option: --function-symbol-roots\n')`. On `main`, the `rejected` group fails only because the option is unknown. - The `baseline` mode, which runs only the strict-path assertions, passed on `main` for `executable` and `module`. So the fixtures reproduce the strict rejection that the new mode is meant to avoid. On the merged tree, I also changed only the `strictFallThrough` argument in `CodeInstructionCollector.cpp:542` to `false` and rebuilt. `function_symbol_roots_rejected` then failed with `AssertionError: ('zero-tail', 'windows', 0, '')`, so the new fall-through-through-zero-bytes behaviour is covered. After restoring the merged files and rebuilding, the three groups pass again, and `git status --porcelain` is empty. ## Findings ### Blocking None. ### Non-blocking - **Strict fall-through also applies after calls, which can reject valid modules in this mode.** See `core/relinker/relinker/src/analysis/CodeInstructionCollector.cpp:566-571` and `core/relinker/relinker/src/analysis/UnusedNidFilter/ControlFlowGraph.cpp:171-174`. In root mode, the analysis follows fall-through after `Call` and `IndirectCall`, and it no longer trims trailing zero bytes. If a call to a noreturn function is followed by zero padding or non-code, conversion stops with `Instruction truncated` or `fall-through is not executable`. This fails closed and only affects the opt-in flag. However, the debt entry (`docs/dev/debt/relinker.md:5`) lists only unresolved computed jumps as the limit. Suggestion: add one clause to the debt entry saying that noreturn calls are assumed to fall through in this mode. - **The test split is a separate topic.** `core/relinker/CMakeLists.txt:649-653` splits `guest_none_relocations` into four CTests to fix a macOS x86_64 timeout. That test script and its limit are identical on `main`. The split itself looks correct: the ungrouped invocation still passes locally, and every group finishes in under 1 s here. Still, it is unrelated to function-symbol roots, and CONTRIBUTING asks for one topic per pull request. It is small and test-only, so I am not asking for it to be removed. ## Not verified - Native Windows and macOS execution. On Linux, the Windows outputs ran through `windows_image_runner.py` inside the test; the macOS outputs were only checked structurally. - The sfiii-ps5 input from #14893: I did not have it, and no title was run. - CI timing on macOS x86_64 for the split `guest_none_relocations_*` tests. - The author-reported 686/686 Linux and hosted CI counts. <!-- anyps5-bots job=3217 head=fd2d90bf77fa5b1bd0019b39c9af72a59a661aab -->
XairRrR commented 2026-11-03 11:00:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T11:00:06Z.

Review: APPROVED


Re-checked — approved

The only change since my last review (fd2d90bf77fa) is commit 59e8f2e00e47, which rewrites one debt entry to record the noreturn-call limitation I raised. Production and test sources are unchanged, and the checks and focused tests still pass.

What changed since my last review

  • 59e8f2e00e47 docs(relinker): record noreturn call analysis limit changes one line in docs/dev/debt/relinker.md, and nothing else (git diff --stat fd2d90bf77fa..59e8f2e00e47: 1 file, +1 −1).
  • The author's comments report hosted CI runs for fd2d90bf77fa and for 59e8f2e00e47, both merged with main 4f41f4c375f5: Linux 686, Windows 690, macOS ARM64 675 and macOS x86_64 675 tests passed. I treat these numbers as author-reported. The Tested section was updated to match.

What I ran

Head 59e8f2e00e477f1a3dd4e656de0408498887d3c5, main 4f41f4c375f5abb487dbd184fbc150f31994d762, merged tree db1bb0df9064f93453080ac51669841c31cfd5fa. Debian 13 VM, GCC 14.2.0, Release, Ninja, BUILD_TESTING=ON.

git show 59e8f2e00e477f1a3dd4e656de0408498887d3c5 --stat -p
git diff --stat fd2d90bf77fa5b1bd0019b39c9af72a59a661aab 59e8f2e00e477f1a3dd4e656de0408498887d3c5
git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...59e8f2e00e477f1a3dd4e656de0408498887d3c5
python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762
ctest --test-dir build -j8 --test-load 32 --output-on-failure -R "^(function_symbol_roots_|guest_none_relocations_)"
git status --porcelain
Check Result
git diff --check passed, no output
check_conventions.py passed ("All conventions checks passed.")
Configure, build and libs (script) passed
Script test run (826 selected tests) 823 passed, 2 expected skips, 1 known failure (unwrap_self_UnwrapTest_test_new_output_inherits_the_destination_directory_group, which also fails on main); no new failures or timeouts
function_symbol_roots_* (3) and guest_none_relocations_* (4) 7/7 passed, 0.18–0.49 s each

I did not rerun the negative control. The tests and production sources are byte-identical to fd2d90bf77fa, where the control already failed as expected (see my previous review).

Previous findings

  • Non-blocking: strict fall-through after calls is not documented. Resolved. docs/dev/debt/relinker.md:5 now says: "Calls, including indirect calls, are assumed to return, so a noreturn call followed by zero padding or non-code can be rejected." This matches the behaviour I described. The entry now states the gap first, as CONTRIBUTING asks.
  • Non-blocking: the guest_none_relocations split is a separate topic. Still open, but I accept it as is. It is unchanged since my last review, and the author's CI report says it removed the macOS x86_64 timeout. I am not asking for a change.

New findings

Blocking

None.

Non-blocking

None.

Not verified

  • Native Windows and macOS execution of the converted outputs.
  • The sfiii-ps5 input from #14893: I did not have it, and no title was run.
  • The hosted CI counts and macOS x86_64 timings, which are author-reported.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5750991610 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15032#pullrequestreview-5750991610). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T11:00:06Z. **Review:** APPROVED --- # Re-checked — approved The only change since my last review (`fd2d90bf77fa`) is commit `59e8f2e00e47`, which rewrites one debt entry to record the noreturn-call limitation I raised. Production and test sources are unchanged, and the checks and focused tests still pass. ## What changed since my last review - `59e8f2e00e47` `docs(relinker): record noreturn call analysis limit` changes one line in `docs/dev/debt/relinker.md`, and nothing else (`git diff --stat fd2d90bf77fa..59e8f2e00e47`: 1 file, +1 −1). - The author's comments report hosted CI runs for `fd2d90bf77fa` and for `59e8f2e00e47`, both merged with `main` `4f41f4c375f5`: Linux 686, Windows 690, macOS ARM64 675 and macOS x86_64 675 tests passed. I treat these numbers as author-reported. The Tested section was updated to match. ## What I ran Head `59e8f2e00e477f1a3dd4e656de0408498887d3c5`, `main` `4f41f4c375f5abb487dbd184fbc150f31994d762`, merged tree `db1bb0df9064f93453080ac51669841c31cfd5fa`. Debian 13 VM, GCC 14.2.0, Release, Ninja, BUILD_TESTING=ON. ```sh git show 59e8f2e00e477f1a3dd4e656de0408498887d3c5 --stat -p git diff --stat fd2d90bf77fa5b1bd0019b39c9af72a59a661aab 59e8f2e00e477f1a3dd4e656de0408498887d3c5 git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...59e8f2e00e477f1a3dd4e656de0408498887d3c5 python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762 ctest --test-dir build -j8 --test-load 32 --output-on-failure -R "^(function_symbol_roots_|guest_none_relocations_)" git status --porcelain ``` | Check | Result | |---|---| | `git diff --check` | passed, no output | | `check_conventions.py` | passed ("All conventions checks passed.") | | Configure, build and libs (script) | passed | | Script test run (826 selected tests) | 823 passed, 2 expected skips, 1 known failure (`unwrap_self_UnwrapTest_test_new_output_inherits_the_destination_directory_group`, which also fails on `main`); no new failures or timeouts | | `function_symbol_roots_*` (3) and `guest_none_relocations_*` (4) | 7/7 passed, 0.18–0.49 s each | I did not rerun the negative control. The tests and production sources are byte-identical to `fd2d90bf77fa`, where the control already failed as expected (see my previous review). ## Previous findings - **Non-blocking: strict fall-through after calls is not documented.** Resolved. `docs/dev/debt/relinker.md:5` now says: "Calls, including indirect calls, are assumed to return, so a noreturn call followed by zero padding or non-code can be rejected." This matches the behaviour I described. The entry now states the gap first, as CONTRIBUTING asks. - **Non-blocking: the `guest_none_relocations` split is a separate topic.** Still open, but I accept it as is. It is unchanged since my last review, and the author's CI report says it removed the macOS x86_64 timeout. I am not asking for a change. ## New findings ### Blocking None. ### Non-blocking None. ## Not verified - Native Windows and macOS execution of the converted outputs. - The sfiii-ps5 input from #14893: I did not have it, and no title was run. - The hosted CI counts and macOS x86_64 timings, which are author-reported. <!-- anyps5-bots job=3293 head=59e8f2e00e477f1a3dd4e656de0408498887d3c5 -->
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!15032
No description provided.