feat(libc): read guest va_lists portably in lifted builds #15801
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15801"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by oberonlift on 2026-11-04T16:23:58Z.
Merge after #15800. Until the PRs before it merge, this PR also shows their changes; oberonlift/AnyPS5#11 shows only its own.
ps5lift is a static recompiler for PS5 executables: it lifts a game's x86-64 code to LLVM IR and compiles it ahead of time to aarch64, which runs on Linux against AnyPS5's own libraries with no interpreter or JIT. It runs AnyPS5's PS5-style test programs and a homebrew media player to its home screen; commercial games are not playable yet. Branch
ps5lift-previewmerges all of its PRs (how to try it); native Apple Silicon support is coming along fast. It is a separate approach from the ARM64 compiler in #5021; #1835 has an introduction.This is 5 of 8 PRs that let AnyPS5's libraries run a lifted program; the lifter itself follows them.
x86-64: behaviour unchanged. The shared
APS5_VA_BEGINmacro expands to the code it replaces, Audio3d's delivery loop moved into a helper, and the host-list handling inFormatArguments, the AudioPropagation change and AvPlayer's log printer are compiled only in lifted builds.What
VaListis a SysVva_listbuilt by the guest or by a bridge, so libc formats and scans throughFormatArgumentsand its in-process scanner instead of the host'svprintfandvsscanf.va_listin a taggedVaListthrough the sharedAPS5_VA_BEGINmacro, which libSceLibcInternal'serrandwarnand the formatting and scanning tests now use as well.va_listbuilt around the call's values. It copied its own hostva_list, which has that layout only on an x86-64 host.sceAudioPropagationReportApi, which copies its own hostva_listinto the report, stops as not implemented when host code calls it; guest calls stop at the bridge. The debt file lists it, and the library's test checks the rejection in lifted builds in place of its report checks, which read the report'sva_listas the host's.sceAvPlayerPrintfstarts itsva_listwithAPS5_VA_BEGIN, and without a registered callback a lifted build prints the log through the libc'svprintf, which reads a guestva_list. It copied theVaListas a hostva_list, which has that layout only on an x86-64 host.vasprintfformats throughFormatWindows, as Windows builds do, so it reads only the guest's 24-byteVaList; andprintf_sorients stdout for bytes, as the other builds'printf_sdoes.#5021 also changes some of the same files:
Formatting.cpp,WindowsFormatting.hpp.Tested
Compiled for x86-64 Linux before and after this PR (GCC 13, same flags): 19 of the 24 objects it reaches on both sides are byte-identical; the others are libSceAudio3d's
Export.cpp, whose delivery loop moved into a helper, the two libc tests that gained checks, and AudioPropagation'sExport.cppand libSceLibcInternal'sErr.cpp, which differ only in line-number constants.On a DGX Spark (aarch64 Linux, NVIDIA GB10, LLVM 18), with all eight PRs and ps5lift on top: every library builds for a lifted program, 2,285 of AnyPS5's own tests pass in that build on lavapipe, and ps5lift's 69 tests pass, among them its libc, exceptions, kernel, fiber and module-loading fixtures and upstream's libc test programs.
The conventions check passes on this branch.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Pull request closed