fix(runtime): run converted SDK samples through clean C++ shutdown #98
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/98"
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 SamG-Coder on 2026-09-28T19:17:29Z.
What
Public SDK samples could not receive command-line arguments, load their declared guest shared libraries or initialize their C++ runtime. After those blockers were addressed, the C++ sample still crashed during shutdown because registered guest destructors were invoked with the Windows calling convention.
This change supplies the missing converter/runtime behavior and preserves the SysV calling convention when invoking guest exit callbacks. The community SDK
hello_cxxsource now prints its greeting, sorts a vector on a worker thread, catches exception42, joins and exits with status 0. The sample source is unchanged; its build uses the native-title CRT adaptation described below.The PR contains focused commits for:
__cxa_atexitdestructors andatexitcallbacks. The host callback wrapper preserves Windows registers across SysV guest calls.The inconclusive vblank timing change has been removed from this PR. No graphics-performance improvement is claimed. Shader PR #96 and notification PR #97 remain separate.
Tested
Rebased onto upstream
49a7819. The following checks were rerun on head9e3b3c8, Windows Release, with the explicit NID-patchedlibsbuild:The converted probes exercise:
%ln, width/precision, wide Unicode output and truncation guards.EXIT_ABI_BAD, which the output oracle rejects despite exit 0.All five final C++ sample runs printed:
and exited normally with status 0. Before the destructor ABI fix the same sample reached that output, then faulted and exited
0xc0000409. No exception or shutdown bypass was added.Review notes and limits
NotImplemented_nid_no_patch. Invalid/incomplete formats return errors. This is not complete libc conformance.vswprintf/wprintffunctionality using another helper. It does not replace theseswprintf/scanning/exit-ABI fixes, but the helpers should be reconciled if both land. The file overlap found with that PR is libc's CMake source list. Relevant relinker/library PRs #85, #12, #30, #28 and #86 have no changed-file overlap with this diff.Checklist
NotImplemented_nid_no_patch; no new silent success stubsImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-09-28T20:33:40Z.
Progress report (
8cc16ec→a6ea90b)📈 System libraries: 76.5% (+0.16%, +20 implemented functions)
✅ 20 implemented
___mb_cur_max_nid_postfixbzero_nid_postfixfgetwc_nid_postfixmbrlen_nid_postfixmbrtowc_nid_postfixmbsinit_nid_postfixmbsrtowcs_nid_postfixmbtowc_nid_postfixstrxfrm_nid_postfixswprintf_nid_postfixungetwc_nid_postfixvasprintf_nid_postfixvsscanf_nid_postfixwcrtomb_nid_postfixwcscoll_nid_postfixwcstold_nid_postfixwcstoul_nid_postfixwcstoull_nid_postfixwcsxfrm_nid_postfixpthread_cond_destroy_nid_postfix