refactor(relinker): remove relocation types validation already rejects #10357

Merged
roboterspinne merged 1 commit from upstream-pr/10357 into main 2026-10-24 05:20:56 +00:00
roboterspinne commented 2026-10-23 19:08:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by roboterspinne on 2026-10-23T19:08:39Z.


What

Follow-up to #9220. ValidationPolicy rejects R_X86_64_GOT32, PLT32, GOTPCREL, 32S, GOTPCRELX and REX_GOTPCRELX for every DT_RELA and DT_JMPREL entry (RelinkerPipeline.cpp:349) before the Linux patcher runs, and every other writer of those tables emits only types the allowlist accepts. The R_X86_64_32S case of the fixed-base relocation list in LinuxElfPatcher.cpp therefore cannot be reached. It was the only user of R_X86_64_32S, and the other five constants in ElfConstants.hpp have none. This removes the case and the six constants. No behaviour changes: 32S is still rejected with Unsupported relocation type 0xb, as test_linux_fixed_base.py and test_executable_tls_relocations.py check. R_X86_64_IRELATIVE and the default throw of that list stay; this only removes what #9220 dropped from validation.

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, as on main.
  • Relinked the test_executable_tls_relocations.py fixture with every relocation type 0-63 in DT_RELA and in DT_JMPREL, against the null symbol, a defined TLS symbol, a TLS import and a function import, in the default mode (fixed base 0x400000) and with --lazy-binding: exit codes, error messages and outputs are identical with and without this change. No input reaches cannot be placed at a fixed Linux base, and no output holds type 11.
  • git grep finds no other use of the six constants.
  • python3 tools/check_conventions.py --base upstream/main with this title and description passed.
  • python3 tools/pr_overlap.py --repo boykopovar/AnyPS5 --branch claude/new-session-2p8mgt: no overlap with open pull requests.

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:4987955861 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10357). Originally posted by [roboterspinne](https://github.com/roboterspinne) on 2026-10-23T19:08:39Z. --- ### What Follow-up to #9220. `ValidationPolicy` rejects `R_X86_64_GOT32`, `PLT32`, `GOTPCREL`, `32S`, `GOTPCRELX` and `REX_GOTPCRELX` for every `DT_RELA` and `DT_JMPREL` entry (`RelinkerPipeline.cpp:349`) before the Linux patcher runs, and every other writer of those tables emits only types the allowlist accepts. The `R_X86_64_32S` case of the fixed-base relocation list in `LinuxElfPatcher.cpp` therefore cannot be reached. It was the only user of `R_X86_64_32S`, and the other five constants in `ElfConstants.hpp` have none. This removes the case and the six constants. No behaviour changes: 32S is still rejected with `Unsupported relocation type 0xb`, as `test_linux_fixed_base.py` and `test_executable_tls_relocations.py` check. `R_X86_64_IRELATIVE` and the default throw of that list stay; this only removes what #9220 dropped from validation. ### 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, as on `main`. - Relinked the `test_executable_tls_relocations.py` fixture with every relocation type 0-63 in `DT_RELA` and in `DT_JMPREL`, against the null symbol, a defined TLS symbol, a TLS import and a function import, in the default mode (fixed base 0x400000) and with `--lazy-binding`: exit codes, error messages and outputs are identical with and without this change. No input reaches `cannot be placed at a fixed Linux base`, and no output holds type 11. - `git grep` finds no other use of the six constants. - `python3 tools/check_conventions.py --base upstream/main` with this title and description passed. - `python3 tools/pr_overlap.py --repo boykopovar/AnyPS5 --branch claude/new-session-2p8mgt`: no overlap with open pull requests. ### 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)
MarcZX10 commented 2026-10-23 19:18:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T19:18:40Z.

Review: APPROVED


This removes only relocation constants and the unreachable R_X86_64_32S arm from RebasedRelocations. The PR traces the validation paths that reject the relevant types before this writer and includes fixture checks that the rejected 32S diagnostic/output remain unchanged. The diff is appropriately narrow; hosted conventions, eligibility, intake, labels and Linux/Windows/macOS relinker plus ASan checks all pass. I did not rerun the relinker suite locally. I found no blocking issue.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5633347742 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10357#pullrequestreview-5633347742). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T19:18:40Z. **Review:** APPROVED --- This removes only relocation constants and the unreachable `R_X86_64_32S` arm from `RebasedRelocations`. The PR traces the validation paths that reject the relevant types before this writer and includes fixture checks that the rejected `32S` diagnostic/output remain unchanged. The diff is appropriately narrow; hosted conventions, eligibility, intake, labels and Linux/Windows/macOS relinker plus ASan checks all pass. I did not rerun the relinker suite locally. I found no blocking issue.
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!10357
No description provided.