fix(libc): declare the type_info class, the wide size clamp and environ that Apple clang needs #18905

Merged
atinseau merged 3 commits from upstream-pr/18905 into main 2026-11-13 02:09:02 +00:00
atinseau commented 2026-11-12 13:07:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by atinseau on 2026-11-12T13:07:06Z.


What

Three declarations that Apple clang and libc++ need and that main lacks, each one line:

  • libc takes typeid(__cxxabiv1::__fundamental_type_info) for its fundamental type_info records (#10548), but libc++abi defines that class only in a private header; libc stops compiling on macOS. The itanium specifics header already declares the other libc++abi type_info classes the same way.
  • BasicString.cpp of libSceLibcInternal takes the smaller of a std::size_t and the std::uint64_t size of the guest string (#17668). On macOS the first is unsigned long and the second unsigned long long, so std::min cannot deduce one type; both calls now clamp as std::size_t, as #17532 did for the narrow helper.
  • VulkanDevice.cpp reads environ for the device-fault report and gets it from no header on macOS; it declares it, as the non-Windows branch needs.

Tested

macOS 27.0.1, Apple M3 Max (36 GB), Release build with -DBUILD_TESTING=ON, x86_64 under Rosetta 2, on main 3b7f31fa7 with the macOS port (the squash of #8658, which its author upstreams in parts).

  • libc, libSceLibcInternal and libSceAgcDriver compile and link with the three changes (a full Release build of the tree, 9,248 build steps, no error).
  • python3 tools/check_conventions.py --base origin/main passes. No open pull request changes BasicString.cpp or the type_info header; many open pull requests touch VulkanDevice.cpp, and the added line sits in its include block.

Not tested: Linux and Windows (the changes compile on libstdc++ and the MSVC-style ABIs unchanged: std::size_t and std::uint64_t are the same type there).

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: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5277948211 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18905). Originally posted by [atinseau](https://github.com/atinseau) on 2026-11-12T13:07:06Z. --- ### What Three declarations that Apple clang and libc++ need and that `main` lacks, each one line: - `libc` takes `typeid(__cxxabiv1::__fundamental_type_info)` for its fundamental type_info records (#10548), but libc++abi defines that class only in a private header; `libc` stops compiling on macOS. The itanium specifics header already declares the other libc++abi type_info classes the same way. - `BasicString.cpp` of `libSceLibcInternal` takes the smaller of a `std::size_t` and the `std::uint64_t` size of the guest string (#17668). On macOS the first is `unsigned long` and the second `unsigned long long`, so `std::min` cannot deduce one type; both calls now clamp as `std::size_t`, as #17532 did for the narrow helper. - `VulkanDevice.cpp` reads `environ` for the device-fault report and gets it from no header on macOS; it declares it, as the non-Windows branch needs. ### Tested macOS 27.0.1, Apple M3 Max (36 GB), Release build with `-DBUILD_TESTING=ON`, x86_64 under Rosetta 2, on `main` `3b7f31fa7` with the macOS port (the squash of #8658, which its author upstreams in parts). - `libc`, `libSceLibcInternal` and `libSceAgcDriver` compile and link with the three changes (a full Release build of the tree, 9,248 build steps, no error). - `python3 tools/check_conventions.py --base origin/main` passes. No open pull request changes `BasicString.cpp` or the type_info header; many open pull requests touch `VulkanDevice.cpp`, and the added line sits in its include block. Not tested: Linux and Windows (the changes compile on libstdc++ and the MSVC-style ABIs unchanged: `std::size_t` and `std::uint64_t` are the same type there). ### 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: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
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!18905
No description provided.