libc: the Cyberpunk placeholders libcCyberUnknown02/08 are abs and __powidf2; fix branch ready #3161

Closed
opened 2026-10-10 23:39:04 +00:00 by screamm · 4 comments
screamm commented 2026-10-10 23:39:04 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-10T23:39:04Z.


In libc (Export.cpp) two Cyberpunk 2077 (PPSA04029) imports are still placeholder stubs: libcCyberUnknown02 (NID Ye20uNnlglA) and libcCyberUnknown08 (NID H+8UBOwfScI). tools/nid_names.py computes those NIDs from abs and __powidf2, and its database reports both as rename-ready; the imports are listed in #266 and #2010. No run has stopped on them yet.

Fix branch ready: screamm:feat/libc-abs-powidf2 (28422739, one commit on main d2f43cb8). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commit as is. Earlier attempts (#1097, #2158, #2316, #2465, #2604) were closed by intake or for lack of a title; this one is a rewrite on current main.

  • The placeholders are renamed to abs_nid_postfix and __powidf2_nid_postfix the way #2301 renamed their siblings, and implemented in src/Math.cpp: abs(int) negates through unsigned so abs(INT_MIN) returns INT_MIN as FreeBSD's abs.c does (ISO C leaves it undefined); __powidf2(double, int) is a line-for-line port of LLVM compiler-rt powidf2.c (square-and-multiply, reciprocal for a negative exponent), at llvm-project 0ee439b7, byte-identical on current main.
  • TechnicalDebt records the INT_MIN choice, the zero result where pow would give a subnormal, and that compiler-rt is assumed because the SDK compiler is Clang; none of it is checked against the console's libc.
  • guest_math gains abs over negative, zero, positive and INT_MIN; __powidf2 with positive, zero and negative exponents (including 0, -0, inf and NaN bases, INT_MIN/INT_MAX), the pinned rounding of 1.1^4, 1.1^5 and 1.1^-4, a sweep of exponents -40 to 40 for four bases against std::pow within 64 ulp, and reciprocal underflow to 0. Swapping the implementation for std::pow makes the test fail.

Tested on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, full build including libs: guest_math 3/3; ctest -j8 -E "^agc_driver_|^video_out_flip" 475/475; with main's Math.cpp the extended test fails; tools/check_conventions.py --base main and git diff --check pass. Not run on Linux. The branch touches Export.cpp lines next to the ones #3079 edited, so it may need a trivial rebase.

Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5796288829 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3161). Originally posted by [screamm](https://github.com/screamm) on 2026-10-10T23:39:04Z. --- In libc ([Export.cpp](https://github.com/boykopovar/AnyPS5/blob/main/core/libs/prx/libc/Export.cpp)) two Cyberpunk 2077 (PPSA04029) imports are still placeholder stubs: `libcCyberUnknown02` (NID `Ye20uNnlglA`) and `libcCyberUnknown08` (NID `H+8UBOwfScI`). `tools/nid_names.py` computes those NIDs from `abs` and `__powidf2`, and its database reports both as `rename-ready`; the imports are listed in #266 and #2010. No run has stopped on them yet. **Fix branch ready:** [`screamm:feat/libc-abs-powidf2`](https://github.com/screamm/AnyPS5/tree/feat/libc-abs-powidf2) (`28422739`, one commit on `main` `d2f43cb8`). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commit as is. Earlier attempts (#1097, #2158, #2316, #2465, #2604) were closed by intake or for lack of a title; this one is a rewrite on current `main`. - The placeholders are renamed to `abs_nid_postfix` and `__powidf2_nid_postfix` the way #2301 renamed their siblings, and implemented in `src/Math.cpp`: `abs(int)` negates through `unsigned` so `abs(INT_MIN)` returns `INT_MIN` as FreeBSD's `abs.c` does (ISO C leaves it undefined); `__powidf2(double, int)` is a line-for-line port of LLVM compiler-rt `powidf2.c` (square-and-multiply, reciprocal for a negative exponent), at llvm-project `0ee439b7`, byte-identical on current main. - TechnicalDebt records the `INT_MIN` choice, the zero result where `pow` would give a subnormal, and that compiler-rt is assumed because the SDK compiler is Clang; none of it is checked against the console's libc. - `guest_math` gains `abs` over negative, zero, positive and `INT_MIN`; `__powidf2` with positive, zero and negative exponents (including 0, -0, inf and NaN bases, `INT_MIN`/`INT_MAX`), the pinned rounding of 1.1^4, 1.1^5 and 1.1^-4, a sweep of exponents -40 to 40 for four bases against `std::pow` within 64 ulp, and reciprocal underflow to 0. Swapping the implementation for `std::pow` makes the test fail. **Tested** on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, `BUILD_TESTING=ON`, full build including `libs`: `guest_math` 3/3; `ctest -j8 -E "^agc_driver_|^video_out_flip"` 475/475; with `main`'s `Math.cpp` the extended test fails; `tools/check_conventions.py --base main` and `git diff --check` pass. Not run on Linux. The branch touches `Export.cpp` lines next to the ones #3079 edited, so it may need a trivial rebase. Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).
danzaio commented 2026-10-11 01:58:48 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by danzaio on 2026-10-11T01:58:48Z.


Windows validation for this branch, which lists no Windows run.

Windows 11, MinGW-w64 GCC 15.2.0 (WinLibs r7), Ninja, Release, BUILD_TESTING=ON, branch 28422739: guest_math passes 1/1, covering the abs and __powidf2 cases.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6104410470 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3161#issuecomment-6104410470). Originally posted by [danzaio](https://github.com/danzaio) on 2026-10-11T01:58:48Z. --- Windows validation for this branch, which lists no Windows run. Windows 11, MinGW-w64 GCC 15.2.0 (WinLibs r7), Ninja, Release, BUILD_TESTING=ON, branch 28422739: guest_math passes 1/1, covering the abs and __powidf2 cases. AI-assisted: yes.
blawesom commented 2026-10-11 09:52:57 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-11T09:52:57Z.


Independent verification on Linux (the gap noted in the report): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON.

  • Rebased 28422739 onto current main (the branch was 638 commits behind; the report anticipated a trivial rebase next to #3079's edits): Export.cpp no longer needed the branch's stale _Mtx_*/_Cnd_* stub block (main implements the family for real now), GuestMath.cpp needed main's newer rounding declarations and checks kept alongside this branch's CheckAbsoluteValue/CheckIntegerPower, and one TechnicalDebt.md entry was unioned.
  • tools/check_conventions.py --base origin/main and git diff --check pass.
  • guest_math passes (including the pinned 1.1^4/1.1^5/1.1^-4 rounding and the ±40 exponent sweep).
  • Full suite mirroring the Windows run (ctest -j8 -E "^agc_driver_|^video_out_flip"): 520/520 passed.

The rebased branch is available at blawesom:verify/3161 for anyone carrying — the commit is otherwise unchanged.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6107770298 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3161#issuecomment-6107770298). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-11T09:52:57Z. --- Independent verification on **Linux** (the gap noted in the report): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`. - Rebased `28422739` onto current `main` (the branch was 638 commits behind; the report anticipated a trivial rebase next to #3079's edits): `Export.cpp` no longer needed the branch's stale `_Mtx_*`/`_Cnd_*` stub block (main implements the family for real now), `GuestMath.cpp` needed main's newer rounding declarations and checks kept alongside this branch's `CheckAbsoluteValue`/`CheckIntegerPower`, and one `TechnicalDebt.md` entry was unioned. - `tools/check_conventions.py --base origin/main` and `git diff --check` pass. - `guest_math` passes (including the pinned `1.1^4`/`1.1^5`/`1.1^-4` rounding and the ±40 exponent sweep). - Full suite mirroring the Windows run (`ctest -j8 -E "^agc_driver_|^video_out_flip"`): **520/520 passed**. The rebased branch is available at [`blawesom:verify/3161`](https://github.com/blawesom/AnyPS5/tree/verify/3161) for anyone carrying — the commit is otherwise unchanged.
LeandroLP23 commented 2026-10-13 20:14:18 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-13T20:14:18Z.


Both placeholders are implemented on main now (checked at a0f5916a2), so this can be closed:

  • abs (Ye20uNnlglA): #3314
  • __powidf2 (H+8UBOwfScI): #5174

Both are in core/libs/prx/libc/src/Math.cpp.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6154298743 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3161#issuecomment-6154298743). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-13T20:14:18Z. --- Both placeholders are implemented on `main` now (checked at `a0f5916a2`), so this can be closed: - `abs` (`Ye20uNnlglA`): #3314 - `__powidf2` (`H+8UBOwfScI`): #5174 Both are in `core/libs/prx/libc/src/Math.cpp`. AI-assisted: yes (Claude Code)
oneandonlydean commented 2026-10-14 00:09:09 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T00:09:09Z.


Closing: both are on main, abs from #3314 and __powidf2 from #5174 (libc/src/Math.cpp). If a title still stops on either, comment here with the title ID and the log line.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6157875689 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3161#issuecomment-6157875689). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T00:09:09Z. --- Closing: both are on main, `abs` from #3314 and `__powidf2` from #5174 (`libc/src/Math.cpp`). If a title still stops on either, comment here with the title ID and the log line.
Sign in to join this conversation.
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#3161
No description provided.