fix(linux): resolve loader and APR failures exposed by HFW #1616

Closed
tototomate123 wants to merge 9 commits from upstream-pr/1616 into main
tototomate123 commented 2026-10-08 14:58:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tototomate123 on 2026-10-08T14:58:11Z.


Superseded by six topic PRs: relinker #2785, loader #2786, filesystem #2787, http #2788, apr #2789, shader #2790.

What

Fix Linux loader and APR failures found while bringing up Horizon Forbidden West (PPSA01521), with each fix in a separate commit:

  • Correct ELF section addresses; preserve executable exports and lookup/debug tags; support main-module sceKernelDlsym.
  • Return guest errors from chmod; implement sceKernelFutimes while preserving POSIX futimes behavior.
  • Retain HTTP request-status callbacks/user data with the three-argument ABI; remove registrations on request deletion. The offline backend never dispatches callbacks; handle hierarchy/deletion validation remains incomplete and documented.
  • Set APR guest errno, invalidate failed file IDs/sizes and return the successful ForEach count. This prevented stale package selection and a deserialization crash.
  • Correct APR's 24-byte object layout; encode gather commands in 12 rather than 40 bytes, avoiding HFW's 1 MiB command-buffer exhaustion. Records remain internal to AnyPS5; 40-bit offsets and 32-bit lengths are retained.
  • Evaluate signed minimum in runtime SRT expressions, matching the existing signed IR/GPU lowering; no new GPU opcode is introduced.

The integration build reaches menu/loading UI using these fixes plus local equivalents of #1269 (media), #1339 (VRR), #1586 (unwind) and experimental image-table changes. Missing imports are already merged in #1436. The open #757 => #758 => #920 image-table series overlaps those experiments and should be tested as well; its code is excluded here. Loading still stops at a bounded material-scan limit; gameplay is not reached.

Tested

Linux x86-64, GCC 16.2.1, Release: native libraries and relinker build; all six targeted checks pass (ELF exports, dynamic loader, filesystem, HTTP, APR and shader memory, including signed-min boundary cases). Conventions and whitespace checks pass. The integration ELF was rebuilt on the new main; this smaller branch alone has not been game-tested.

Checklist

  • Based on current main (29e533ac); matching open-PR implementations excluded
  • One topic per PR — combined bring-up fixes, separated into nine commits
  • No new code comments
  • Unimplemented paths throw; HTTP limitations recorded in TechnicalDebt
  • No investigation notes, logs or images committed
  • No new third-party dependencies
  • Generic behavior; no title-specific dispatch
  • Depends on: none for build; HFW integration requirements listed above
  • AI-assisted: yes, Codex, reviewed and tested by Human
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4788704718 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1616). Originally posted by [tototomate123](https://github.com/tototomate123) on 2026-10-08T14:58:11Z. --- **Superseded by six topic PRs:** [relinker #2785](https://github.com/boykopovar/AnyPS5/pull/2785), [loader #2786](https://github.com/boykopovar/AnyPS5/pull/2786), [filesystem #2787](https://github.com/boykopovar/AnyPS5/pull/2787), [http #2788](https://github.com/boykopovar/AnyPS5/pull/2788), [apr #2789](https://github.com/boykopovar/AnyPS5/pull/2789), [shader #2790](https://github.com/boykopovar/AnyPS5/pull/2790). ### What Fix Linux loader and APR failures found while bringing up Horizon Forbidden West (PPSA01521), with each fix in a separate commit: - Correct ELF section addresses; preserve executable exports and lookup/debug tags; support main-module `sceKernelDlsym`. - Return guest errors from chmod; implement `sceKernelFutimes` while preserving POSIX futimes behavior. - Retain HTTP request-status callbacks/user data with the three-argument ABI; remove registrations on request deletion. The offline backend never dispatches callbacks; handle hierarchy/deletion validation remains incomplete and documented. - Set APR guest errno, invalidate failed file IDs/sizes and return the successful ForEach count. This prevented stale package selection and a deserialization crash. - Correct APR's 24-byte object layout; encode gather commands in 12 rather than 40 bytes, avoiding HFW's 1 MiB command-buffer exhaustion. Records remain internal to AnyPS5; 40-bit offsets and 32-bit lengths are retained. - Evaluate signed minimum in runtime SRT expressions, matching [the existing signed IR/GPU lowering](https://github.com/boykopovar/AnyPS5/blob/main/core/shader/recompiler/SpirvBackend/src/SpirvAlu/SpirvAluEmitterMath.cpp); no new GPU opcode is introduced. The integration build reaches menu/loading UI using these fixes **plus** local equivalents of #1269 (media), #1339 (VRR), #1586 (unwind) and experimental image-table changes. Missing imports are already merged in #1436. The open #757 => #758 => #920 image-table series overlaps those experiments and should be tested as well; its code is excluded here. Loading still stops at a bounded material-scan limit; gameplay is not reached. ### Tested Linux x86-64, GCC 16.2.1, Release: native libraries and relinker build; all six targeted checks pass (ELF exports, dynamic loader, filesystem, HTTP, APR and shader memory, including signed-min boundary cases). Conventions and whitespace checks pass. The integration ELF was rebuilt on the new main; this smaller branch alone has not been game-tested. ### Checklist - [x] Based on current main (`29e533ac`); matching open-PR implementations excluded - [x] One topic per PR — combined bring-up fixes, separated into nine commits - [x] No new code comments - [x] Unimplemented paths throw; HTTP limitations recorded in TechnicalDebt - [x] No investigation notes, logs or images committed - [x] No new third-party dependencies - [x] Generic behavior; no title-specific dispatch - [x] Depends on: none for build; HFW integration requirements listed above - [x] AI-assisted: yes, Codex, reviewed and tested by Human
github-actions[bot] commented 2026-10-08 15:07:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T15:07:22Z.


Progress report (4b005b2 → 106e057)

📈 System libraries: 84.8% (+0.04%, +2 implemented functions)

✅ 2 implemented
Library Name
libSceHttp sceHttpSetRequestStatusCallback
libkernel sceKernelFutimes
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6062850813 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1616#issuecomment-6062850813). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-08T15:07:22Z. --- <!-- progress-report --> ### Progress report (4b005b2 → 106e057) 📈 **System libraries**: 84.8% (+0.04%, +2 implemented functions) <details> <summary>✅ 2 implemented</summary> | Library | Name | | - | - | | libSceHttp | `sceHttpSetRequestStatusCallback` | | libkernel | `sceKernelFutimes` | </details>
adriadam10 commented 2026-10-09 21:17:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T21:17:06Z.

Review: CHANGES_REQUESTED


Thanks for the bring-up work. This needs splitting before it can land. CONTRIBUTING asks for one topic per PR, and this one carries six independent changes:

  • relinker: section addresses, DT_HASH/DT_DEBUG, executable exports (+ test_linux_executable_exports.py)
  • loader: sceKernelDlsym on the main module
  • libkernel: chmod errors, sceKernelFutimes
  • libSceHttp: sceHttpSetRequestStatusCallback
  • APR/Ampr: errno, failed-resolution cleanup, object layout, compact gather record
  • shader: SMin32 in the SRT evaluator

Please open one PR per topic (the commits are already separated), each with its own What/Tested, and list the HFW integration dependencies under Depends on. Also, per PR:

  • conventions fails: core/libs/tests/GuestDynamicLoader.cpp:22 uses __declspec; use an existing export mechanism or a plain extern "C" definition.
  • Conflicts with main in core/libs/tests/GuestHttp.cpp and docs/dev/TechnicalDebt.md; rebase. Put the TechnicalDebt line away from the end of the section and from other PRs' lines.
  • APR: the 0x18 object layout and the 12-byte compact record (Apr::Opcode::CompactReadFileGather = 29, 40-bit offset) are justified only by HFW behaviour. Say where each field order comes from (reference or call-site evidence), and keep the comment that the command encoding is ours.
  • HTTP: 0x80431100 for an invalid id has no cited source; record it under "Unknown function info" or cite one.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5475436584 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1616#pullrequestreview-5475436584). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-09T21:17:06Z. **Review:** CHANGES_REQUESTED --- Thanks for the bring-up work. This needs splitting before it can land. CONTRIBUTING asks for one topic per PR, and this one carries six independent changes: - relinker: section addresses, `DT_HASH`/`DT_DEBUG`, executable exports (+ `test_linux_executable_exports.py`) - loader: `sceKernelDlsym` on the main module - libkernel: chmod errors, `sceKernelFutimes` - libSceHttp: `sceHttpSetRequestStatusCallback` - APR/Ampr: errno, failed-resolution cleanup, object layout, compact gather record - shader: `SMin32` in the SRT evaluator Please open one PR per topic (the commits are already separated), each with its own What/Tested, and list the HFW integration dependencies under **Depends on**. Also, per PR: - `conventions` fails: `core/libs/tests/GuestDynamicLoader.cpp:22` uses `__declspec`; use an existing export mechanism or a plain `extern "C"` definition. - Conflicts with `main` in `core/libs/tests/GuestHttp.cpp` and `docs/dev/TechnicalDebt.md`; rebase. Put the TechnicalDebt line away from the end of the section and from other PRs' lines. - APR: the 0x18 object layout and the 12-byte compact record (`Apr::Opcode::CompactReadFileGather = 29`, 40-bit offset) are justified only by HFW behaviour. Say where each field order comes from (reference or call-site evidence), and keep the comment that the command encoding is ours. - HTTP: `0x80431100` for an invalid id has no cited source; record it under "Unknown function info" or cite one.
tototomate123 commented 2026-10-10 15:04:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tototomate123 on 2026-10-10T15:04:31Z.


@adriadam10 Thanks for the review, Ive split this into #2785-#2790, rebased on current main, and addressed the export, APR evidence/encoding and HTTP documentation feedback. The intake bot automatically closed all six replacements; could you reopen them for review?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6098867384 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1616#issuecomment-6098867384). Originally posted by [tototomate123](https://github.com/tototomate123) on 2026-10-10T15:04:31Z. --- @adriadam10 Thanks for the review, Ive split this into #2785-#2790, rebased on current main, and addressed the export, APR evidence/encoding and HTTP documentation feedback. The intake bot automatically closed all six replacements; could you reopen them for review?

Pull request closed

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!1616
No description provided.