fix(relinker): print the unsupported relocation offset once #10390

Merged
roboterspinne merged 2 commits from upstream-pr/10390 into main 2026-10-27 08:34:16 +00:00
roboterspinne commented 2026-10-23 20:45:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by roboterspinne on 2026-10-23T20:45:46Z.


What

The relinker printed the file offset of a relocation type it does not support twice, for example FAIL: Unsupported relocation type 0x9 at offset 0x4700 (offset 0x4700). ValidationPolicy wrote the offset into the message and also passed it as FailureOffset, which the command line appends to every relinker error (main.cpp:469). The message now names only the type, so the line reads FAIL: Unsupported relocation type 0x9 (offset 0x4700). That matches the errors next to it in the same relocation loop, such as Unsupported PLT relocation type and RELATIVE relocation has a nonzero symbol index, which carry the offset only in FailureOffset.

  • relinker_conversion now checks the exact message, as it already does for the PLT error, and executable_tls_relocations checks the (offset 0x4700) suffix, so the duplicate cannot come back.
  • The web converter (wasm/Bindings.cpp) reports only the message, so it no longer shows this error's offset, as for every other error whose offset is only in FailureOffset. Adding FailureOffset to the web converter's error text is a separate change.

Tested

Ubuntu 24.04 x86_64, relinker-only Release build (-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON); synthetic fixtures only, no title or homebrew.

  • ctest --test-dir build-relinker: 240/240 passed.
  • The CLI line for a type 9 relocation reads FAIL: Unsupported relocation type 0x9 (offset 0x4700) on Linux, --windows and --macos.
  • Without the ValidationPolicy.cpp change, relinker_conversion and executable_tls_relocations fail on the doubled offset.
  • python3 tools/check_conventions.py --base upstream/main with this title and description passed.

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: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4989041298 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10390). Originally posted by [roboterspinne](https://github.com/roboterspinne) on 2026-10-23T20:45:46Z. --- ### What The relinker printed the file offset of a relocation type it does not support twice, for example `FAIL: Unsupported relocation type 0x9 at offset 0x4700 (offset 0x4700)`. `ValidationPolicy` wrote the offset into the message and also passed it as `FailureOffset`, which the command line appends to every relinker error (`main.cpp:469`). The message now names only the type, so the line reads `FAIL: Unsupported relocation type 0x9 (offset 0x4700)`. That matches the errors next to it in the same relocation loop, such as `Unsupported PLT relocation type` and `RELATIVE relocation has a nonzero symbol index`, which carry the offset only in `FailureOffset`. - `relinker_conversion` now checks the exact message, as it already does for the PLT error, and `executable_tls_relocations` checks the `(offset 0x4700)` suffix, so the duplicate cannot come back. - The web converter (`wasm/Bindings.cpp`) reports only the message, so it no longer shows this error's offset, as for every other error whose offset is only in `FailureOffset`. Adding `FailureOffset` to the web converter's error text is a separate change. ### 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. --> Ubuntu 24.04 x86_64, relinker-only Release build (`-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON`); synthetic fixtures only, no title or homebrew. - `ctest --test-dir build-relinker`: 240/240 passed. - The CLI line for a type 9 relocation reads `FAIL: Unsupported relocation type 0x9 (offset 0x4700)` on Linux, `--windows` and `--macos`. - Without the `ValidationPolicy.cpp` change, `relinker_conversion` and `executable_tls_relocations` fail on the doubled offset. - `python3 tools/check_conventions.py --base upstream/main` with this title and description passed. ### 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: <!-- #PR, or none --> none - [x] Fixes: <!-- issue it closes as Fixes #N, or none --> none - [x] Unblocks: <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> none - [x] GPUs tested: <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> n/a - [x] AI-assisted: <!-- yes / no --> yes (Claude Code)
harisibrar1 commented 2026-10-24 15:43:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-24T15:43:14Z.

Review: APPROVED


Checked against main c9b75825f3 and the relinker sources (ValidationPolicy.cpp, main.cpp, wasm/Bindings.cpp, test_executable_tls_relocations.py, test_linux_fixed_base.py, ConversionTests.cpp):

  • I confirmed the duplicate on main: main.cpp appends (offset 0x…) from FailureOffset, and ValidationPolicy.cpp:31-33 puts the same offset in the message as well.
  • The new (offset 0x4700) expectation follows from image() writing the relocations at 0x4700, and it isn't a substring of main's doubled line, so the regression check works. The other existing substring checks (0x17, 0x99, 0xb in test_linux_fixed_base.py) still match the shorter message.
  • The branch still merges cleanly with current main and doesn't overlap #10658's change to the same file. Looks good to me.

Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5638826236 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10390#pullrequestreview-5638826236). Originally posted by [harisibrar1](https://github.com/harisibrar1) on 2026-10-24T15:43:14Z. **Review:** APPROVED --- Checked against main c9b75825f3 and the relinker sources (ValidationPolicy.cpp, main.cpp, wasm/Bindings.cpp, test_executable_tls_relocations.py, test_linux_fixed_base.py, ConversionTests.cpp): - I confirmed the duplicate on main: main.cpp appends ` (offset 0x…)` from `FailureOffset`, and ValidationPolicy.cpp:31-33 puts the same offset in the message as well. - The new `(offset 0x4700)` expectation follows from `image()` writing the relocations at 0x4700, and it isn't a substring of main's doubled line, so the regression check works. The other existing substring checks (`0x17`, `0x99`, `0xb` in test_linux_fixed_base.py) still match the shorter message. - The branch still merges cleanly with current main and doesn't overlap #10658's change to the same file. Looks good to me. Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
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!10390
No description provided.