feat(libc): implement sinhf and asinl (carried from #3519) #3725

Merged
Recapi merged 2 commits from upstream-pr/3725 into main 2026-10-12 14:07:47 +00:00
Recapi commented 2026-10-11 16:01:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Recapi on 2026-10-11T16:01:07Z.


What

Carries @screamm's sinhf and asinl from #3519 (screamm:feat/libc-sinhf-asinl), with the commits and their authorship unchanged, cherry-picked onto main a11c8f7 without conflicts. Closes #3519.

Both functions are ports of the FreeBSD msun code that the console's libc.prx runs. In #3519 screamm compared them bit for bit against that code, taken from the libc.prx bundled with PPSA28319. The two ports:

  • sinhf: e_sinhf.c, with the expm1f/expf paths it reaches;
  • asinl: e_asinl.c, with the ld80 invtrig.c coefficients.

The details are in #3519. This replaces the host one-liners for the same two functions that I had in #3597 and #3598.

Tested

Linux (Ubuntu, GCC, Release) on a11c8f7. The catalog ZIPs were checked against their sha256, eboot.bin and sce_module/libc.prx were unwrapped as #2605 requires, and each title was relinked with --registry and run in a sandbox with no network:

  • Ruffle Flash (PPSA68091): main stops at 1t1-JoZ0sZQ (sinhf); with this PR it reaches ./app.elf: symbol lookup error: ./app.elf: undefined symbol: EDyhWelj7UY (pause)
  • RetroArch (PPSA99169): main stops at Nx-F5v0-qU8 (asinl); with this PR it reaches ./app.elf: symbol lookup error: ./app.elf: undefined symbol: KvOHPTz595Y (atanl, #3598)
  • guest_math passes 3/3 (--repeat until-fail:3), and check_conventions.py passes

Earlier checks in #3519: screamm ran Windows 11 (WinLibs GCC 15.2.0 r7, guest_math 3/3), blawesom ran the full suite on Linux (832/832), and orishamir ran RetroArch on Windows.

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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4820372182 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3725). Originally posted by [Recapi](https://github.com/Recapi) on 2026-10-11T16:01:07Z. --- ### What Carries @screamm's `sinhf` and `asinl` from #3519 (`screamm:feat/libc-sinhf-asinl`), with the commits and their authorship unchanged, cherry-picked onto `main` a11c8f7 without conflicts. Closes #3519. Both functions are ports of the FreeBSD msun code that the console's `libc.prx` runs. In #3519 screamm compared them bit for bit against that code, taken from the `libc.prx` bundled with PPSA28319. The two ports: - `sinhf`: `e_sinhf.c`, with the `expm1f`/`expf` paths it reaches; - `asinl`: `e_asinl.c`, with the ld80 `invtrig.c` coefficients. The details are in #3519. This replaces the host one-liners for the same two functions that I had in #3597 and #3598. ### Tested Linux (Ubuntu, GCC, Release) on a11c8f7. The catalog ZIPs were checked against their sha256, `eboot.bin` and `sce_module/libc.prx` were unwrapped as #2605 requires, and each title was relinked with `--registry` and run in a sandbox with no network: - Ruffle Flash (PPSA68091): `main` stops at `1t1-JoZ0sZQ` (`sinhf`); with this PR it reaches `./app.elf: symbol lookup error: ./app.elf: undefined symbol: EDyhWelj7UY` (`pause`) - RetroArch (PPSA99169): `main` stops at `Nx-F5v0-qU8` (`asinl`); with this PR it reaches `./app.elf: symbol lookup error: ./app.elf: undefined symbol: KvOHPTz595Y` (`atanl`, #3598) - `guest_math` passes 3/3 (`--repeat until-fail:3`), and `check_conventions.py` passes Earlier checks in #3519: screamm ran Windows 11 (WinLibs GCC 15.2.0 r7, `guest_math` 3/3), blawesom ran the full suite on Linux (832/832), and orishamir ran RetroArch on Windows. ### 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 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
github-actions[bot] commented 2026-10-11 16:01:32 +00:00 (Migrated from github.com)

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


Progress report (33ae282 → 5f3fb3d)

📈 System libraries: 86.26% (+0.01%, +2 implemented functions)

✅ 2 implemented
Library Name
libc asinl_nid_postfix
libc sinhf_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110898977 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3725#issuecomment-6110898977). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T16:01:32Z. --- <!-- progress-report --> ### Progress report (33ae282 → 5f3fb3d) 📈 **System libraries**: 86.26% (+0.01%, +2 implemented functions) <details> <summary>✅ 2 implemented</summary> | Library | Name | | - | - | | libc | `asinl_nid_postfix` | | libc | `sinhf_nid_postfix` | </details>
babyhuey commented 2026-10-11 20:32:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-11T20:32:36Z.


I checked this PR on both OSes with Ruffle (PPSA68091, catalog build), merged onto main 0a8b1d32 (test merge 96897625).

  • main, Windows: FAIL: unresolved ELF import 1t1-JoZ0sZQ (sinhf) from libSceLibcInternal.prx
  • With this PR: sinhf resolves and the next stop is pause (EDyhWelj7UY, #3580) on both.
    • Linux: undefined symbol: EDyhWelj7UY (pause)
    • Windows 11 (MinGW GCC 15.2): FAIL: unresolved ELF import EDyhWelj7UY (pause) from libkernel.prx
  • guest_math passes 5/5 (--repeat until-fail:5) on both. No warnings in Math.cpp or GuestMath.cpp.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6113441412 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3725#issuecomment-6113441412). Originally posted by [babyhuey](https://github.com/babyhuey) on 2026-10-11T20:32:36Z. --- I checked this PR on both OSes with Ruffle (PPSA68091, catalog build), merged onto `main` 0a8b1d32 (test merge 96897625). - `main`, Windows: `FAIL: unresolved ELF import 1t1-JoZ0sZQ (sinhf) from libSceLibcInternal.prx` - With this PR: `sinhf` resolves and the next stop is `pause` (`EDyhWelj7UY`, #3580) on both. - Linux: `undefined symbol: EDyhWelj7UY (pause)` - Windows 11 (MinGW GCC 15.2): `FAIL: unresolved ELF import EDyhWelj7UY (pause) from libkernel.prx` - `guest_math` passes 5/5 (`--repeat until-fail:5`) on both. No warnings in `Math.cpp` or `GuestMath.cpp`.
Recapi commented 2026-10-11 22:06:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Recapi on 2026-10-11T22:06:55Z.


Rebased onto main c7b9719. The only conflict was in TechnicalDebt.md, where a new entry had landed next to the sinhf one, and both are kept. The commits are still @screamm's. Ran on Linux after the rebase: guest_math passes 3/3, Ruffle Flash (PPSA68091) gets past sinhf to pause (#3580), and RetroArch (PPSA99169) gets past asinl to atanl (#3598). The branch also merges cleanly with #3598 as rebased.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114371930 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3725#issuecomment-6114371930). Originally posted by [Recapi](https://github.com/Recapi) on 2026-10-11T22:06:55Z. --- Rebased onto `main` c7b9719. The only conflict was in `TechnicalDebt.md`, where a new entry had landed next to the `sinhf` one, and both are kept. The commits are still @screamm's. Ran on Linux after the rebase: `guest_math` passes 3/3, Ruffle Flash (PPSA68091) gets past `sinhf` to `pause` (#3580), and RetroArch (PPSA99169) gets past `asinl` to `atanl` (#3598). The branch also merges cleanly with #3598 as rebased.
screamm commented 2026-10-12 00:32:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-12T00:32:19Z.


Windows validation with title evidence (Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, full build including libs): PR head 273f5530 merged cleanly onto main bab7b328. guest_math 3/3; ctest -j8 -E "^agc_driver_|^video_out_flip" 582/584, the two failures being the known agc_write_tracking (#4087) and guest_kernel_stack_protect (#4088); conventions and git diff --check pass.

Relinked against this build: RetroArch (PPSA99169) moves from FAIL: unresolved ELF import Nx-F5v0-qU8 from libSceLibcInternal.prx (asinl) to FAIL: unresolved ELF import DxmIMUQ-wXY from libkernel.prx (pthread_attr_getstackaddr, open #3494); Ruffle (PPSA68091) moves from 1t1-JoZ0sZQ (sinhf) to e2G+cdEkOmU (pthread_attr_getscope, #3494). Both stops on main are removed by this PR.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6115638355 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3725#issuecomment-6115638355). Originally posted by [screamm](https://github.com/screamm) on 2026-10-12T00:32:19Z. --- Windows validation with title evidence (Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, `BUILD_TESTING=ON`, full build including `libs`): PR head `273f5530` merged cleanly onto `main` `bab7b328`. `guest_math` 3/3; `ctest -j8 -E "^agc_driver_|^video_out_flip"` 582/584, the two failures being the known `agc_write_tracking` (#4087) and `guest_kernel_stack_protect` (#4088); conventions and `git diff --check` pass. Relinked against this build: RetroArch (PPSA99169) moves from `FAIL: unresolved ELF import Nx-F5v0-qU8 from libSceLibcInternal.prx` (asinl) to `FAIL: unresolved ELF import DxmIMUQ-wXY from libkernel.prx` (pthread_attr_getstackaddr, open #3494); Ruffle (PPSA68091) moves from `1t1-JoZ0sZQ` (sinhf) to `e2G+cdEkOmU` (pthread_attr_getscope, #3494). Both stops on `main` are removed by this PR.
Recapi commented 2026-10-12 03:04:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Recapi on 2026-10-12T03:04:02Z.


Rebased onto main 34a16b7. The only conflict was in TechnicalDebt.md, where the pthread_attr_* entry from #3494 had landed next to the sinhf one, and both are kept. The commits are still @screamm's. Ran on Linux after the rebase: guest_math passes 3/3 and check_conventions.py passes. With #3494 now on main, Ruffle Flash (PPSA68091) loads with no absent imports, and RetroArch (PPSA99169) gets past all its libc imports to sceKernelJitCreateSharedMemory.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6116990748 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3725#issuecomment-6116990748). Originally posted by [Recapi](https://github.com/Recapi) on 2026-10-12T03:04:02Z. --- Rebased onto `main` 34a16b7. The only conflict was in `TechnicalDebt.md`, where the `pthread_attr_*` entry from #3494 had landed next to the `sinhf` one, and both are kept. The commits are still @screamm's. Ran on Linux after the rebase: `guest_math` passes 3/3 and `check_conventions.py` passes. With #3494 now on `main`, Ruffle Flash (PPSA68091) loads with no absent imports, and RetroArch (PPSA99169) gets past all its libc imports to `sceKernelJitCreateSharedMemory`.
oneandonlydean commented 2026-10-12 08:23:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T08:23:53Z.


Conflicts with main in core/libs/tests/GuestMath.cpp; please rebase.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6120515734 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3725#issuecomment-6120515734). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-12T08:23:53Z. --- Conflicts with main in `core/libs/tests/GuestMath.cpp`; please rebase.
screamm commented 2026-10-12 09:11:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-12T09:11:31Z.


@Recapi, to save you the rebase: the two commits are rebased onto current main c36fd0a0 at screamm:feat/libc-sinhf-asinl-rebased (e471aa6c sinhf, 157e6a5c asinl, same author and messages). The only conflict was one hunk in GuestMath.cpp after CheckLongDouble(): main's new CheckFmodErrno() is kept whole, followed by this PR's MakeExtended() and CheckAsinl(); main() calls both. Math.cpp and TechnicalDebt.md merged automatically, nothing is defined twice and no test line is lost (git range-diff against this PR shows only context changes). Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Release, full build including libs: guest_math 3/3; ctest -j8 -E "^agc_driver_|^video_out_flip" 602/602; conventions and git diff --check pass. A force-push of those two commits onto this PR's branch should be all that is needed.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6121218863 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3725#issuecomment-6121218863). Originally posted by [screamm](https://github.com/screamm) on 2026-10-12T09:11:31Z. --- @Recapi, to save you the rebase: the two commits are rebased onto current `main` `c36fd0a0` at [`screamm:feat/libc-sinhf-asinl-rebased`](https://github.com/screamm/AnyPS5/tree/feat/libc-sinhf-asinl-rebased) (`e471aa6c` sinhf, `157e6a5c` asinl, same author and messages). The only conflict was one hunk in `GuestMath.cpp` after `CheckLongDouble()`: `main`'s new `CheckFmodErrno()` is kept whole, followed by this PR's `MakeExtended()` and `CheckAsinl()`; `main()` calls both. `Math.cpp` and `TechnicalDebt.md` merged automatically, nothing is defined twice and no test line is lost (`git range-diff` against this PR shows only context changes). Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Release, full build including `libs`: `guest_math` 3/3; `ctest -j8 -E "^agc_driver_|^video_out_flip"` 602/602; conventions and `git diff --check` pass. A force-push of those two commits onto this PR's branch should be all that is needed.
screamm commented 2026-10-12 10:58:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-12T10:58:48Z.


Correction: the rebased commits are re-pushed to the same branch with the author identity fixed (they carried a placeholder [email protected] from the rebase environment): now 2c6e3f53 sinhf and 5f3fb3dd asinl, content identical to the hashes above. Please take these instead.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6122905903 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3725#issuecomment-6122905903). Originally posted by [screamm](https://github.com/screamm) on 2026-10-12T10:58:48Z. --- Correction: the rebased commits are re-pushed to the same branch with the author identity fixed (they carried a placeholder `[email protected]` from the rebase environment): now `2c6e3f53` sinhf and `5f3fb3dd` asinl, content identical to the hashes above. Please take these instead.
Recapi commented 2026-10-12 13:19:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Recapi on 2026-10-12T13:19:54Z.


Thanks @screamm. The PR head is now your rebased 2c6e3f53 (sinhf) and 5f3fb3dd (asinl), unchanged, with the corrected author identity. It merges cleanly onto main 33ae282. On Linux: guest_math passes 3/3 and check_conventions.py passes. @oneandonlydean the GuestMath.cpp conflict is resolved.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6125107336 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3725#issuecomment-6125107336). Originally posted by [Recapi](https://github.com/Recapi) on 2026-10-12T13:19:54Z. --- Thanks @screamm. The PR head is now your rebased `2c6e3f53` (sinhf) and `5f3fb3dd` (asinl), unchanged, with the corrected author identity. It merges cleanly onto `main` 33ae282. On Linux: `guest_math` passes 3/3 and `check_conventions.py` passes. @oneandonlydean the `GuestMath.cpp` conflict is resolved.
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!3725
No description provided.