Skip to content

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

Closed
tototomate123 wants to merge 9 commits into
boykopovar:mainfrom
tototomate123:fix/hfw-linux-loader-apr
Closed

tototomate123 wants to merge 9 commits into
boykopovar:mainfrom
tototomate123:fix/hfw-linux-loader-apr

Conversation

@tototomate123

@tototomate123 tototomate123 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Progress report (4b005b2 → 106e057)

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

✅ 2 implemented
Library Name
libSceHttp sceHttpSetRequestStatusCallback
libkernel sceKernelFutimes

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build docs libkernel needs rebase Conflicts with main, rebase needed prx relinker shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants