feat(libc): unwind guest frames and keep the host's exception runtime in lifted builds #15800
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15800"
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:56Z.
Merge after #15799. Until the PRs before it merge, this PR also shows their changes; oberonlift/AnyPS5#10 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 4 of 8 PRs that let AnyPS5's libraries run a lifted program; the lifter itself follows them.
x86-64: unchanged: the code compiles to the same objects, apart from the line numbers in error messages. The new
host_exception_pointertest builds and runs in every build; in CI's lifted build it runs from the last PR of the series on, since libc first compiles for a lifted guest there.What
GuestCpufunctions.ElfTypes.hppredirectsdl_iterate_phdrto the runtime'sGuestCpuIterateImages, which lists the guest images. libc and libkernel includeElfTypes.hppinstead of<link.h>where they walk images (the unwinder, the application heap's process parameters, direct memory, module info and the AGC driver's guest memory), so each of them sees the guest images.Exports.cpp's__cxa_*and_Unwind_*aliases andPersonality.cpp's global__gxx_personality_v0. A lifted executable loads libc before libstdc++ and libgcc_s, so the host's ownthrowbound to libc's versions and aborted.std::current_exception,std::rethrow_exceptionandexception_ptr's members over its own runtime. Host code that caught an exception then got a nullexception_ptr: the AGC driver reported a failed compute dispatch as "null asynchronous failure" and terminated. Lifted builds now give the guest its own exception pointer type, as libc++ builds do, and leave the host's exception pointers to the host runtime;HostExceptionPointertests it. The guest's_Result_basedestructor export releases the guest pointer in place.#5021 also changes some of the same files:
GuestMemory.cpp,GuestAllocations.cpp,DirectMemory.cpp,ModuleInfo.cpp.Tested
Compiled for x86-64 Linux before and after this PR (GCC 13, same flags): 226 of the 227 objects it reaches are byte-identical, and
Exports.cppdiffers only in line-number constants; the newhost_exception_pointertest builds after it only.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