test(libSceLibcInternal): run guest_force_tls_destructor on Windows #3858

Merged
LeandroLP23 merged 1 commit from upstream-pr/3858 into main 2026-10-11 22:10:40 +00:00
LeandroLP23 commented 2026-10-11 18:03:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-11T18:03:01Z.


What

According to TechnicalDebt, _sceLibcInternalForceTlsDestructor throws on Windows when the thread has destructors, "as the lookup is Linux only". The module lookup goes through sceKernelGetModuleInfoFromAddr, which has had a Windows path since 77ef75c1d, so the call works there too. Only the test was still Linux-only (if(NOT WIN32), dlsym(RTLD_NEXT)).

  • guest_force_tls_destructor now builds on Windows too. It gets the other module's address with GetProcAddress(GetModuleHandleA("libSceLibcInternal.prx"), ...) where Linux keeps dlsym(RTLD_NEXT), and it gets the same configure_windows_unwind and PATH setup as guest_thread_atexit.
  • The TechnicalDebt entry no longer says the call throws on Windows.

Tested

  • Radeon 860M, Windows 11 (26300), WinLibs GCC 15.2.0 r7, Release, main a11c8f7f7:
    • guest_force_tls_destructor passes 3/3.
    • With FindDsoModule forced to fail (no module found for any dso), the test fails, so it exercises the Windows lookup.
    • guest_thread_atexit, guest_force_tls_destructor and the five guest_module_* tests pass 7/7.
  • tools/check_conventions.py --base origin/main passes.
  • Fork CI: https://github.com/LeandroLP23/AnyPS5/actions/runs/38160042070
    • guest_force_tls_destructor passes on Windows and Linux.
    • The other failures also happen on main: guest_filesystem (#3518), guest_kernel_sys (#3510) and windows_exceptions (#3411) on Windows; agc_driver_emulated_color_compare, agc_driver_image_plane_address_on_line_implicit_lod and guest_kernel_stack_protect on Linux.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4821157915 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3858). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-11T18:03:01Z. --- ### What According to TechnicalDebt, `_sceLibcInternalForceTlsDestructor` throws on Windows when the thread has destructors, "as the lookup is Linux only". The module lookup goes through `sceKernelGetModuleInfoFromAddr`, which has had a Windows path since 77ef75c1d, so the call works there too. Only the test was still Linux-only (`if(NOT WIN32)`, `dlsym(RTLD_NEXT)`). - `guest_force_tls_destructor` now builds on Windows too. It gets the other module's address with `GetProcAddress(GetModuleHandleA("libSceLibcInternal.prx"), ...)` where Linux keeps `dlsym(RTLD_NEXT)`, and it gets the same `configure_windows_unwind` and `PATH` setup as `guest_thread_atexit`. - The TechnicalDebt entry no longer says the call throws on Windows. ### Tested - Radeon 860M, Windows 11 (26300), WinLibs GCC 15.2.0 r7, Release, `main` `a11c8f7f7`: - `guest_force_tls_destructor` passes 3/3. - With `FindDsoModule` forced to fail (no module found for any dso), the test fails, so it exercises the Windows lookup. - `guest_thread_atexit`, `guest_force_tls_destructor` and the five `guest_module_*` tests pass 7/7. - `tools/check_conventions.py --base origin/main` passes. - Fork CI: https://github.com/LeandroLP23/AnyPS5/actions/runs/38160042070 - `guest_force_tls_destructor` passes on Windows and Linux. - The other failures also happen on `main`: `guest_filesystem` (#3518), `guest_kernel_sys` (#3510) and `windows_exceptions` (#3411) on Windows; `agc_driver_emulated_color_compare`, `agc_driver_image_plane_address_on_line_implicit_lod` and `guest_kernel_stack_protect` on Linux. ### 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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes (Claude Code)
adriadam10 commented 2026-10-11 22:10:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T22:10:36Z.


Checked the CMake/test change against the sibling tests in the directory (same configure_windows_unwind + PATH setup as guest_thread_atexit), the Windows path of sceKernelGetModuleInfoFromAddr on main, and the TechnicalDebt entry. Linux build and guest_force_tls_destructor pass; the Windows run is the one reported in the PR. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114410725 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3858#issuecomment-6114410725). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T22:10:36Z. --- Checked the CMake/test change against the sibling tests in the directory (same `configure_windows_unwind` + `PATH` setup as `guest_thread_atexit`), the Windows path of `sceKernelGetModuleInfoFromAddr` on main, and the TechnicalDebt entry. Linux build and `guest_force_tls_destructor` pass; the Windows run is the one reported in the PR. Merging.
github-actions[bot] commented 2026-10-11 22:11:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T22:11:39Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#3694 core/libs/prx/libSceLibcInternal/CMakeLists.txt L57-63
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114422909 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3858#issuecomment-6114422909). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T22:11:39Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #3694 | `core/libs/prx/libSceLibcInternal/CMakeLists.txt` [L57-63](https://github.com/boykopovar/AnyPS5/blob/31bf997b5342b88ebd4fa8f5629b0ee7400fe176/core/libs/prx/libSceLibcInternal/CMakeLists.txt#L57-L63) | | |
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!3858
No description provided.