fix(relinker): reject relocatable ELF conversion inputs #5148

Merged
AaravMehta-07 merged 1 commit from upstream-pr/5148 into main 2026-10-14 01:35:54 +00:00
AaravMehta-07 commented 2026-10-13 12:57:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by AaravMehta-07 on 2026-10-13T12:57:31Z.


What

Reject ET_REL at the executable-conversion pipeline boundary before interpreting program headers or producing output. A relocatable object needs linking rather than executable-image conversion; the Linux-output path previously accepted the modified fixture and wrote an ELF as though conversion had succeeded. The Windows image path already rejects this object type.

The ELF GABI header table distinguishes ET_REL relocatable objects from executable and shared-object images. The documented relinker input is a clean ELF executable. This guard rejects only ET_REL, without introducing a whitelist that excludes SCE-specific executable types.

Tested

Windows, MinGW-w64 GCC 15.2.0, Release relinker-only build with testing enabled. The Linux-output CLI test is Windows-hosted; it does not claim Linux runtime testing.

  • Actual regression fails without the guard: CLI returns success and creates the relocatable output.
  • Earlier complete standalone CTest with the patch: 140/140 passed, 556.77 seconds total; after the main refactor, 144/144 passed in 131.21 seconds.
  • After restoring the patch following the baseline probe, rebuilt and reran elf_header: passed in 15.4 seconds.
  • Rebased onto main at 0f2683cb7. The standalone all-target relinker-only build succeeded and the complete current CTest suite passed 145/145 in 84.52 seconds.
  • The pipeline initialization/signature hunk overlaps #5116, but that PR does not implement ET_REL rejection. Its author agreed to a separate fix and rebasing in either merge order. Neither fix semantically requires the other; Depends on is none. I will rebase if #5116 lands first, and its author offered the corresponding rebase if this guard lands first.
  • Conventions and diff check passed. The complete live overlap scanner reports only the coordinated #5116 pipeline hunk described above.

No PS5 hardware or commercial-title validation and no performance claim.

Checklist

  • Based on current main; no other open PR implements this ET_REL guard. The independent overlapping pipeline refactor in #5116 is coordinated above.
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; no silent stubs added
  • No notes, investigation files or images added to the repository
  • No new third-party code
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • AI-assisted: yes; investigation, code, tests and description. The patch and runtime evidence were reviewed before submission.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4843576727 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5148). Originally posted by [AaravMehta-07](https://github.com/AaravMehta-07) on 2026-10-13T12:57:31Z. --- ### What Reject `ET_REL` at the executable-conversion pipeline boundary before interpreting program headers or producing output. A relocatable object needs linking rather than executable-image conversion; the Linux-output path previously accepted the modified fixture and wrote an ELF as though conversion had succeeded. The Windows image path already rejects this object type. The [ELF GABI header table](https://refspecs.linuxfoundation.org/elf/gabi4%2B/ch4.eheader.html) distinguishes `ET_REL` relocatable objects from executable and shared-object images. The [documented relinker input](https://github.com/boykopovar/AnyPS5/blob/main/docs/user/USAGE.md) is a clean ELF executable. This guard rejects only `ET_REL`, without introducing a whitelist that excludes SCE-specific executable types. ### Tested Windows, MinGW-w64 GCC 15.2.0, Release relinker-only build with testing enabled. The Linux-output CLI test is Windows-hosted; it does not claim Linux runtime testing. - Actual regression fails without the guard: CLI returns success and creates the relocatable output. - Earlier complete standalone CTest with the patch: 140/140 passed, 556.77 seconds total; after the main refactor, 144/144 passed in 131.21 seconds. - After restoring the patch following the baseline probe, rebuilt and reran `elf_header`: passed in 15.4 seconds. - Rebased onto `main` at `0f2683cb7`. The standalone all-target relinker-only build succeeded and the complete current CTest suite passed 145/145 in 84.52 seconds. - The pipeline initialization/signature hunk overlaps #5116, but that PR does not implement ET_REL rejection. Its author [agreed to a separate fix and rebasing in either merge order](https://github.com/boykopovar/AnyPS5/pull/5116#issuecomment-6145937026). Neither fix semantically requires the other; `Depends on` is none. I will rebase if #5116 lands first, and its author offered the corresponding rebase if this guard lands first. - Conventions and diff check passed. The complete live overlap scanner reports only the coordinated #5116 pipeline hunk described above. No PS5 hardware or commercial-title validation and no performance claim. ### Checklist - [x] Based on current `main`; no other open PR implements this ET_REL guard. The independent overlapping pipeline refactor in #5116 is coordinated above. - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw; no silent stubs added - [x] No notes, investigation files or images added to the repository - [x] No new third-party code - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: none - [x] AI-assisted: yes; investigation, code, tests and description. The patch and runtime evidence were reviewed before submission.
github-actions[bot] commented 2026-10-13 13:14:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T13:14:37Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#5116 core/relinker/relinker/src/pipeline/RelinkerPipeline.cpp L47
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6146384782 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5148#issuecomment-6146384782). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-13T13:14:37Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #5116 | `core/relinker/relinker/src/pipeline/RelinkerPipeline.cpp` [L47](https://github.com/boykopovar/AnyPS5/blob/b9e0e4ed30031b0132e1c3ccc6bbc0d18ac4bf2d/core/relinker/relinker/src/pipeline/RelinkerPipeline.cpp#L47) | | |
xXPBSXx commented 2026-10-13 15:35:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T15:35:31Z.


Windows test: head 6f0f7c746 merged onto current main 60fb61870, together with 9 other open pull requests in one build (the merges were conflict-free); a failure would have been bisected per PR. Windows 10, MinGW GCC (WinLibs), Ninja Release, -j2: full build 0 errors; ctest for the tests this change adds or touches: elf_header passed; python tools/check_conventions.py --base upstream/main passed for the combined tree. I did not run the new tests against main without the change.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6149216484 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5148#issuecomment-6149216484). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-13T15:35:31Z. --- Windows test: head `6f0f7c746` merged onto current `main` `60fb61870`, together with 9 other open pull requests in one build (the merges were conflict-free); a failure would have been bisected per PR. Windows 10, MinGW GCC (WinLibs), Ninja Release, `-j2`: full build 0 errors; ctest for the tests this change adds or touches: elf_header passed; `python tools/check_conventions.py --base upstream/main` passed for the combined tree. I did not run the new tests against `main` without the change. AI-assisted (Claude Code).
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!5148
No description provided.