fix(libc): hand out the unwind cursor table through a _nid_no_patch export #5014

Merged
oneandonlydean merged 1 commit from upstream-pr/5014 into main 2026-10-13 08:25:34 +00:00
oneandonlydean commented 2026-10-13 08:13:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T08:13:31Z.


What

The Windows job fails on patched_libraries since #4945 was merged (first seen on builds based on 6d7b873702, and on the push build of fc1f063f51):

libSceAgc.prx: LoadLibraryEx failed with error 127
libSceAgcDriver.prx: LoadLibraryEx failed with error 127
libSceVideoOut.prx: LoadLibraryEx failed with error 127
123 patched libraries loaded, 3 failed

#4945 gave _Unwind_Context a default member initializer that points at LibcUnwind::CursorSlots, a C++ data symbol defined in libc. On Windows LibcUnwind::Frame contains an _Unwind_Context, and libSceAgcDriver builds frames in StackWalk.hpp for the worker sampler, so it now imports _ZN10LibcUnwind11CursorSlotsE from libc.prx. The NID patcher renames that export in the patched libc and does not touch the import (it only rewrites sce* and _nid_postfix names), so the patched libSceAgcDriver has an import nothing exports. libSceAgc and libSceVideoOut link to it and fail the same way. Linux is not affected because Frame has no context member there.

The table is now local to Unwind.cpp and the context reads it through UnwindCursorSlots_nid_no_patch(), the same naming the other libc helpers used across libraries have, so the name is the same in the patched libc and in the importer. Behaviour of #4945 is unchanged.

Tested

Linux, GCC, Release: built libc, all patched libraries and the tests below; patched_libraries, exception_runtime (includes the cursor table check from #4945), exception_personality, exception_c_cleanup, guest_exception_handler, guest_raise_exception, guest_unwind_module_info, guest_dynamic_cast, agc_stack_walk, unwind_record_bounds and the standalone register_context tests pass. The patched libc.prx exports UnwindCursorSlots_nid_no_patch under that name.

Not built on Windows locally. The cause is read from the sources and the CI logs; the Windows job of this PR is what shows the three libraries load again.

The Linux failure of guest_fminf on main (fminf check failed at line 33, from #4592) is a different problem and is not touched here.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none (Windows CI on main)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4840351578 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5014). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T08:13:31Z. --- ### What The Windows job fails on `patched_libraries` since #4945 was merged (first seen on builds based on 6d7b873702, and on the push build of fc1f063f51): ``` libSceAgc.prx: LoadLibraryEx failed with error 127 libSceAgcDriver.prx: LoadLibraryEx failed with error 127 libSceVideoOut.prx: LoadLibraryEx failed with error 127 123 patched libraries loaded, 3 failed ``` #4945 gave `_Unwind_Context` a default member initializer that points at `LibcUnwind::CursorSlots`, a C++ data symbol defined in libc. On Windows `LibcUnwind::Frame` contains an `_Unwind_Context`, and libSceAgcDriver builds frames in `StackWalk.hpp` for the worker sampler, so it now imports `_ZN10LibcUnwind11CursorSlotsE` from `libc.prx`. The NID patcher renames that export in the patched libc and does not touch the import (it only rewrites `sce*` and `_nid_postfix` names), so the patched libSceAgcDriver has an import nothing exports. libSceAgc and libSceVideoOut link to it and fail the same way. Linux is not affected because `Frame` has no context member there. The table is now local to `Unwind.cpp` and the context reads it through `UnwindCursorSlots_nid_no_patch()`, the same naming the other libc helpers used across libraries have, so the name is the same in the patched libc and in the importer. Behaviour of #4945 is unchanged. ### Tested Linux, GCC, Release: built libc, all patched libraries and the tests below; `patched_libraries`, `exception_runtime` (includes the cursor table check from #4945), `exception_personality`, `exception_c_cleanup`, `guest_exception_handler`, `guest_raise_exception`, `guest_unwind_module_info`, `guest_dynamic_cast`, `agc_stack_walk`, `unwind_record_bounds` and the standalone `register_context` tests pass. The patched `libc.prx` exports `UnwindCursorSlots_nid_no_patch` under that name. Not built on Windows locally. The cause is read from the sources and the CI logs; the Windows job of this PR is what shows the three libraries load again. The Linux failure of `guest_fminf` on main (`fminf check failed at line 33`, from #4592) is a different problem and is not touched here. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: none (Windows CI on main) - [x] AI-assisted: yes
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!5014
No description provided.