fix: Linux build and runtime fixes found while booting a retail UE title #7

Merged
Pacuka merged 8 commits from upstream-pr/7 into main 2026-09-26 10:04:54 +00:00
Pacuka commented 2026-09-26 09:16:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Pacuka on 2026-09-26T09:16:17Z.


While bringing up a retail Unreal Engine title (The Smurfs – Dreams) on Linux, I hit several build and runtime issues that are independent of the game-specific work. This PR contains only those fixes; larger library implementations will follow in separate PRs.

Build (Linux)

  • fix(build): configure bundled SDL2 without the global -static linker flag. On distributions without static X11 libraries (Arch/CachyOS), SDL2's X11 checks fail during configuration.
  • fix(videoout): drop __stdcall from DisplayWindow::windowProc. GCC rejects it on Linux, and it has no effect on x86-64 Windows.
  • fix(build): link the core/libs tests without -static on non-Windows hosts. They link against the prx shared libraries, which a fully static link rejects.

Runtime

  • fix(libc): the SceLibcMallocReplace table lists calloc before realloc. The heap called the application's calloc for realloc and the other way round, which silently corrupts memory. The heap test now uses the real table layout.
  • fix(kernel): SCE_KERNEL_PROT_CPU_RW and CPU_EXEC imply read access. GPU read/write bits map to host access because the emulated GPU accesses guest memory from the CPU. Previously these produced write-only host pages.
  • fix(kernel): accept the AMPR/ACP device bits (0x40, 0x80), e.g. 0xC2.
  • fix(libc): register the main image on Linux (PT_LOAD segments), so guest mprotect on the executable's own segments works as it already does on Windows.
  • fix(agc): sceAgcCbReleaseMem accepts the SDK's default GDS range (offset 0, size 1), which the inline wrapper passes for every release.

Testing (Linux, GCC)

  • The full build and libs build succeed; the application heap tests pass.
  • ctest: 22/28 pass. The 6 failures (guest_rendering_wait, guest_buffer_reuse, guest_shader_link, guest_system_exit_parameters, guest_memory, guest_search) abort the same way on main with only the build fixes applied, so they are pre-existing on Linux and not caused by this PR.
  • Not tested on Windows.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4646147601 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7). Originally posted by [Pacuka](https://github.com/Pacuka) on 2026-09-26T09:16:17Z. --- While bringing up a retail Unreal Engine title (The Smurfs – Dreams) on Linux, I hit several build and runtime issues that are independent of the game-specific work. This PR contains only those fixes; larger library implementations will follow in separate PRs. **Build (Linux)** - `fix(build)`: configure bundled SDL2 without the global `-static` linker flag. On distributions without static X11 libraries (Arch/CachyOS), SDL2's X11 checks fail during configuration. - `fix(videoout)`: drop `__stdcall` from `DisplayWindow::windowProc`. GCC rejects it on Linux, and it has no effect on x86-64 Windows. - `fix(build)`: link the `core/libs` tests without `-static` on non-Windows hosts. They link against the prx shared libraries, which a fully static link rejects. **Runtime** - `fix(libc)`: the `SceLibcMallocReplace` table lists calloc before realloc. The heap called the application's calloc for realloc and the other way round, which silently corrupts memory. The heap test now uses the real table layout. - `fix(kernel)`: `SCE_KERNEL_PROT_CPU_RW` and `CPU_EXEC` imply read access. GPU read/write bits map to host access because the emulated GPU accesses guest memory from the CPU. Previously these produced write-only host pages. - `fix(kernel)`: accept the AMPR/ACP device bits (`0x40`, `0x80`), e.g. `0xC2`. - `fix(libc)`: register the main image on Linux (PT_LOAD segments), so guest `mprotect` on the executable's own segments works as it already does on Windows. - `fix(agc)`: `sceAgcCbReleaseMem` accepts the SDK's default GDS range (offset 0, size 1), which the inline wrapper passes for every release. **Testing (Linux, GCC)** - The full build and `libs` build succeed; the application heap tests pass. - `ctest`: 22/28 pass. The 6 failures (`guest_rendering_wait`, `guest_buffer_reuse`, `guest_shader_link`, `guest_system_exit_parameters`, `guest_memory`, `guest_search`) abort the same way on `main` with only the build fixes applied, so they are pre-existing on Linux and not caused by this PR. - Not tested on Windows. 🤖 Generated with [Claude Code](https://claude.com/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!7
No description provided.