Write program headers at e_phoff #19906

Merged
Cri4Key opened 2:23pm on October 21, 2026 wanted to merge 4 Ξ” into rpcs3/rpcs3 master from
patch-1

Pull Request Overview

  • Opened on October 21, 2026
  • Status Merged
  • Commit count 1 with first commit October 21, 2026

Total Delta

4 Total Diff Delta

Open Days

Open 17 weekdays

Test Delta

0 Diff Delta in Test Files
Breakdown by Phase

How long has this pull request spent in each phase of its lifecycle?

Data pending calculation for pull request

Author avatar

Write program headers at e_phoff

WriteElf always wrote the program headers right after the ELF header, which only matches e_phoff set to 0x40. ELFs patched with SPRXPatcher have the table relocated to the end of the file, so the rebuilt ELF has no program headers at e_phoff and fails to load as of PR #19889

Write the program headers at the e_phoff value after the segment data and the section headers so that the segment data cannot overwrite it. Retail SELFs are unaffected (e_phoff is 0x40 and segment 0 already contains identical bytes).

Fixes #19901 (it affects LBP games patched with Refresher using SPRXPatcher in order to patch a dangerous multiplayer exploit and in general any ELF patched by SPRXPatcher), as long as the patched EBOOT provides a correct phdr_offset value (Refresher doesn't, but this is a fix on their tool, not on RPCS3. RPCS3 just needs to handle relocated program headers in order to support SPRXPatcher ELFs again).

Tested on both retail SELF and SPRXPatcher fSELF

Details

First broken build <img width="410" height="1222" alt="Image" src="https://github.com/user-attachments/assets/66a05ff1-d8df-41ac-ae52-cec46b8e95e3" />

Latest master build <img width="423" height="1226" alt="Image" src="https://github.com/user-attachments/assets/9c0bff34-ccc6-49e1-9842-46443bec253f" />

Last working build

v0.0.43.20353-5935028e

First broken build

v0.0.43.20354-b77d4a52

Attach 3 log files

LAST_WORKING_BUILD.log.gz FIRST_BROKEN_BUILD.log LATEST_MASTER_BUILD.log

I have attached all 3 required log files

Yes

Attach the RSX (.rrc) or RenderDoc (.rdc) capture files for visual issues

No response

System configuration

Ryzen 5 [email protected] 16GB DDR4 3200MHz RX 9060XT 16GB | Driver version 26.8.1 Windows 11 Pro Insider Preview Build 26100.ge_release.240331-1435

PR was closed without comments.