feat(libc): export isnanf and __signbitl #3640

Merged
MarcZX10 merged 1 commit from upstream-pr/3640 into main 2026-10-12 03:12:59 +00:00
MarcZX10 commented 2026-10-11 14:35:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T14:35:22Z.


What

Exports the missing isnanf (3pF7bUSIH8o) and __signbitl (Cj81LPErPCc) functions from libSceLibcInternal. XPSemu's import audit lists one reference to each; the following unresolved-import stops are predicted from registry order and have not been observed in a game run:

FAIL: unresolved ELF import 3pF7bUSIH8o from libSceLibcInternal.prx
FAIL: unresolved ELF import Cj81LPErPCc from libSceLibcInternal.prx

isnanf forwards to the existing __isnanf implementation. __signbitl returns exactly 0 or 1 using the host's x87 long double sign bit, with a compile-time size check for the guest ABI. Tests cover NaN, infinities, finite values, signed zero, and signed long-double NaN. Thanks to @screamm for confirming the imported NIDs, recording the FreeBSD 11.4 references, and identifying these XPSemu imports in #3624.

Tested

  • Linux, GCC 12.2, Release: built guest_math_tests; guest_math passed three consecutive runs.
  • python3 tools/check_conventions.py --base upstream/main and git diff upstream/main --check passed.
  • XPSemu was not run.

Checklist

  • Based on current main; no other open PR implements these 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
  • 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:4819820293 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3640). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-11T14:35:22Z. --- ### What Exports the missing `isnanf` (`3pF7bUSIH8o`) and `__signbitl` (`Cj81LPErPCc`) functions from `libSceLibcInternal`. XPSemu's import audit lists one reference to each; the following unresolved-import stops are predicted from registry order and have not been observed in a game run: ```text FAIL: unresolved ELF import 3pF7bUSIH8o from libSceLibcInternal.prx FAIL: unresolved ELF import Cj81LPErPCc from libSceLibcInternal.prx ``` `isnanf` forwards to the existing `__isnanf` implementation. `__signbitl` returns exactly 0 or 1 using the host's x87 `long double` sign bit, with a compile-time size check for the guest ABI. Tests cover NaN, infinities, finite values, signed zero, and signed long-double NaN. Thanks to @screamm for confirming the imported NIDs, recording the FreeBSD 11.4 references, and identifying these XPSemu imports in [#3624](https://github.com/boykopovar/AnyPS5/issues/3624). ### Tested - Linux, GCC 12.2, Release: built `guest_math_tests`; `guest_math` passed three consecutive runs. - `python3 tools/check_conventions.py --base upstream/main` and `git diff upstream/main --check` passed. - XPSemu was not run. ### Checklist - [x] Based on current `main`; no other open PR implements these 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 - [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 14:35:46 +00:00 (Migrated from github.com)

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


Progress report (a11c8f7 → e7c20b3)

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

✅ 2 implemented
Library Name
libc __signbitl_nid_postfix
libc isnanf_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110119578 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3640#issuecomment-6110119578). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T14:35:46Z. --- <!-- progress-report --> ### Progress report (a11c8f7 → e7c20b3) 📈 **System libraries**: 85.82% (+0.01%, +2 implemented functions) <details> <summary>✅ 2 implemented</summary> | Library | Name | | - | - | | libc | `__signbitl_nid_postfix` | | libc | `isnanf_nid_postfix` | </details>
blawesom commented 2026-10-11 15:19:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-11T15:19:51Z.


Independent pre-review on Linux (full CI runs only happen on manual trigger, so recording one): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON.

  • Builds; tools/check_conventions.py --base origin/main passes.
  • Full suite: 832/832 passed (all tests including the Vulkan suites on AMD RX 9070 XT / RADV).
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110518340 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3640#issuecomment-6110518340). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-11T15:19:51Z. --- Independent pre-review on **Linux** (full CI runs only happen on manual trigger, so recording one): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`. - Builds; `tools/check_conventions.py --base origin/main` passes. - Full suite: **832/832 passed** (all tests including the Vulkan suites on AMD RX 9070 XT / RADV).
github-actions[bot] commented 2026-10-11 19:28:55 +00:00 (Migrated from github.com)

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


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
#3905 core/libs/tests/GuestMath.cpp L442
#4164 core/libs/tests/GuestMath.cpp L38-39, L418
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6112835951 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3640#issuecomment-6112835951). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T19:28:55Z. --- <!-- 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 | |---|---|---|---| | #3905 | `core/libs/tests/GuestMath.cpp` [L442](https://github.com/boykopovar/AnyPS5/blob/9eb1486e3981facdd8223497a79077e8769f50f3/core/libs/tests/GuestMath.cpp#L442) | | | | #4164 | `core/libs/tests/GuestMath.cpp` [L38-39](https://github.com/boykopovar/AnyPS5/blob/9eb1486e3981facdd8223497a79077e8769f50f3/core/libs/tests/GuestMath.cpp#L38-L39), [L418](https://github.com/boykopovar/AnyPS5/blob/9eb1486e3981facdd8223497a79077e8769f50f3/core/libs/tests/GuestMath.cpp#L418) | | |
babyhuey commented 2026-10-11 22:46:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-11T22:46:17Z.


I checked this PR on both OSes with Dusklight (PPSA99305, catalog build). With #3598 (logb) merged, Dusklight's next stop on main 5aaf26bd is isnanf:

  • Linux: undefined symbol: 3pF7bUSIH8o (isnanf)
  • Windows: FAIL: unresolved ELF import 3pF7bUSIH8o (isnanf) from libSceLibcInternal.prx
  • With this PR merged locally (408047ac, clean merge), isnanf resolves and the next stop is posix_spawnattr_init (44hlATrd47U, in your #3651) on both:
    • Linux: undefined symbol: 44hlATrd47U (posix_spawnattr_init)
    • Windows 11 (MinGW GCC 15.2, with #4021 stacked so main builds): FAIL: unresolved ELF import 44hlATrd47U (posix_spawnattr_init) from libSceLibcInternal.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:6114749450 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3640#issuecomment-6114749450). Originally posted by [babyhuey](https://github.com/babyhuey) on 2026-10-11T22:46:17Z. --- I checked this PR on both OSes with Dusklight (PPSA99305, catalog build). With #3598 (`logb`) merged, Dusklight's next stop on `main` 5aaf26bd is `isnanf`: - Linux: `undefined symbol: 3pF7bUSIH8o (isnanf)` - Windows: `FAIL: unresolved ELF import 3pF7bUSIH8o (isnanf) from libSceLibcInternal.prx` - With this PR merged locally (408047ac, clean merge), `isnanf` resolves and the next stop is `posix_spawnattr_init` (`44hlATrd47U`, in your #3651) on both: - Linux: `undefined symbol: 44hlATrd47U (posix_spawnattr_init)` - Windows 11 (MinGW GCC 15.2, with #4021 stacked so `main` builds): `FAIL: unresolved ELF import 44hlATrd47U (posix_spawnattr_init) from libSceLibcInternal.prx` - `guest_math` passes 5/5 (`--repeat until-fail:5`) on both. No warnings in `Math.cpp` or `GuestMath.cpp`.
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!3640
No description provided.