feat(libc): export _Thrd_yield #8352

Merged
akkadbakkad89 merged 1 commit from upstream-pr/8352 into main 2026-10-23 18:41:39 +00:00
akkadbakkad89 commented 2026-10-20 10:50:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-20T10:50:55Z.


What

Exports _Thrd_yield, the last unprovided libc import AC Shadows (PPSA20397) registers from this area: a std::this_thread::yield() wrapper returning threadSuccess, matching the Dinkumware C _Thrd_* entries this library already serves.

The earlier revision of this PR also carried locale facet _Getcat exports; those are now covered by #9038 and were dropped, and the std::__sce_v2 _Thrd family is #8885's scope (its _ZNSt8__sce_v211_Thrd_yieldEv is a different export from this one).

Tested

Windows 11 host, WSL build. The added ThreadHelpers block in guest_libc_threads exercises the export from the caller thread and a second std::thread. tools/check_conventions.py --base origin/main clean.

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
  • Fixes: none
  • Unblocks: PPSA20397 (Assassin's Creed Shadows) libc imports
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4934663417 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8352). Originally posted by [akkadbakkad89](https://github.com/akkadbakkad89) on 2026-10-20T10:50:55Z. --- ### What Exports `_Thrd_yield`, the last unprovided `libc` import AC Shadows (PPSA20397) registers from this area: a `std::this_thread::yield()` wrapper returning `threadSuccess`, matching the Dinkumware C `_Thrd_*` entries this library already serves. The earlier revision of this PR also carried locale facet `_Getcat` exports; those are now covered by #9038 and were dropped, and the `std::__sce_v2` `_Thrd` family is #8885's scope (its `_ZNSt8__sce_v211_Thrd_yieldEv` is a different export from this one). ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Windows 11 host, WSL build. The added `ThreadHelpers` block in `guest_libc_threads` exercises the export from the caller thread and a second `std::thread`. `tools/check_conventions.py --base origin/main` clean. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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: <!-- #PR, or none --> none - [x] Fixes: <!-- issue it closes as Fixes #N, or none --> none - [x] Unblocks: <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> PPSA20397 (Assassin's Creed Shadows) libc imports - [x] GPUs tested: <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> n/a - [x] AI-assisted: <!-- yes / no --> yes
github-actions[bot] commented 2026-10-20 10:51:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T10:51:44Z.


Progress report (80565c5 → 3e0feb4)

➖ System libraries: 42.08% (+0.0%, +1 implemented functions)

✅ 1 implemented
Library Name
libc _Thrd_yield_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6289226800 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8352#issuecomment-6289226800). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-20T10:51:44Z. --- <!-- progress-report --> ### Progress report (80565c5 → 3e0feb4) ➖ **System libraries**: 42.08% (+0.0%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libc | `_Thrd_yield_nid_postfix` | </details>
oneandonlydean commented 2026-10-20 22:48:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T22:48:51Z.


@akkadbakkad89 thanks, the facet layouts and return values check out against the console libc (numpunct _Getcat allocates 0x30 and returns 4 with "", "false" and "true"; codecvt _Getcat allocates 0x10 and returns 2; do_in/do_out return noconv).

One thing blocks it:

  • core/libs/tests/GuestLibcThreads.cpp:280: there is an extra } after the new ThreadHelpers(). The file has no namespace there, so GCC stops with expected declaration before '}' token and guest_libc_threads does not build. The checks on this PR are green only because pull-request CI does not build the tests.

And a small one:

  • core/libs/prx/libc/src/Threads.cpp: the new #include <pthread.h> under #else isn't used (the yield goes through std::this_thread::yield()), so it can go.

Once that is pushed, a full CI run with guest_locale_facets and guest_libc_threads passing on Linux and Windows is the bar.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6303516560 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8352#issuecomment-6303516560). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-20T22:48:51Z. --- @akkadbakkad89 thanks, the facet layouts and return values check out against the console libc (numpunct `_Getcat` allocates 0x30 and returns 4 with "", "false" and "true"; codecvt `_Getcat` allocates 0x10 and returns 2; `do_in`/`do_out` return noconv). One thing blocks it: - `core/libs/tests/GuestLibcThreads.cpp:280`: there is an extra `}` after the new `ThreadHelpers()`. The file has no namespace there, so GCC stops with `expected declaration before '}' token` and `guest_libc_threads` does not build. The checks on this PR are green only because pull-request CI does not build the tests. And a small one: - `core/libs/prx/libc/src/Threads.cpp`: the new `#include <pthread.h>` under `#else` isn't used (the yield goes through `std::this_thread::yield()`), so it can go. Once that is pushed, a full CI run with `guest_locale_facets` and `guest_libc_threads` passing on Linux and Windows is the bar.
akkadbakkad89 commented 2026-10-21 05:22:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-21T05:22:39Z.


Both addressed in 3f138a2326:

  • GuestLibcThreads.cpp:280: stray } removed — my merge resolution had left it behind; the file now compiles.
  • Threads.cpp: the unused #include <pthread.h> under #else is gone (the block collapses to #ifdef _WIN32 / windows.h / #endif).

Verified end-to-end, not just compiled:

  • Linux (GCC, Release): guest_libc_threads_tests builds and exits 0; guest_locale_facets_tests builds and exits 0.
  • Windows (WinLibs MinGW-w64 GCC 15.2.0 r7, Release): guest_libc_threads_tests.exe builds and exits 0 on this host (Windows 11 Pro 10.0.26300, i7-10700).

The Windows run needed the freshly built libc.prx staged next to the test — the earlier failure I chased was a stale staged lib, not the test.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6308725663 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8352#issuecomment-6308725663). Originally posted by [akkadbakkad89](https://github.com/akkadbakkad89) on 2026-10-21T05:22:39Z. --- Both addressed in `3f138a2326`: - `GuestLibcThreads.cpp:280`: stray `}` removed — my merge resolution had left it behind; the file now compiles. - `Threads.cpp`: the unused `#include <pthread.h>` under `#else` is gone (the block collapses to `#ifdef _WIN32 / windows.h / #endif`). Verified end-to-end, not just compiled: - Linux (GCC, Release): `guest_libc_threads_tests` builds and exits 0; `guest_locale_facets_tests` builds and exits 0. - Windows (WinLibs MinGW-w64 GCC 15.2.0 r7, Release): `guest_libc_threads_tests.exe` builds and exits 0 on this host (Windows 11 Pro 10.0.26300, i7-10700). The Windows run needed the freshly built `libc.prx` staged next to the test — the earlier failure I chased was a stale staged lib, not the test.
akkadbakkad89 commented 2026-10-21 05:40:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-21T05:40:42Z.


Rebased onto eb9f904d32 — the conflict was upstream's new PadDetach test in GuestLibcThreads.cpp; the resolution keeps both PadDetach and ThreadHelpers (and both registrations in the extern block). The stray-brace fix from 3f138a2326 was absorbed into the resolution, so the second commit now only drops the unused pthread.h include. Test file compiles under GCC 15.2.0.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6308958950 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8352#issuecomment-6308958950). Originally posted by [akkadbakkad89](https://github.com/akkadbakkad89) on 2026-10-21T05:40:42Z. --- Rebased onto `eb9f904d32` — the conflict was upstream's new `PadDetach` test in `GuestLibcThreads.cpp`; the resolution keeps both `PadDetach` and `ThreadHelpers` (and both registrations in the extern block). The stray-brace fix from `3f138a2326` was absorbed into the resolution, so the second commit now only drops the unused `pthread.h` include. Test file compiles under GCC 15.2.0.
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!8352
No description provided.