fix(libc): restore the macOS build by modelling the RTTI sub-kind masks #27201

Closed
fishingpvalues wants to merge 1 commit from upstream-pr/27201 into main
fishingpvalues commented 2026-11-25 11:35:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fishingpvalues on 2026-11-25T11:35:52Z.


What

core/libs/prx/libc/src/exception/Runtime.cpp (added by bd637b7686, "implement RTTI cast result callbacks") uses __cxxabiv1::__class_type_info::__contained_virtual_mask, __contained_public_mask, __contained_ambig and __contained_public. On Linux and Windows those come from the system libstdc++ cxxabi.h. On macOS the project ships its own model of the Itanium RTTI classes in core/libs/prx/libc/include/specifics/itanium/CxxAbi.hpp, and that model only had enum __sub_kind { __unknown = 0 }, so the full macOS build stopped at:

Runtime.cpp:296:91: error: no member named '__contained_virtual_mask' in '__cxxabiv1::__class_type_info'

This extends the model enumerator to the libstdc++ values the callbacks were written against (__not_contained, __contained_ambig, __contained_virtual_mask = 1, __contained_public_mask = 2, __contained_mask = 4, __contained_private, __contained_public = 6). It only affects the _LIBCPPABI_VERSION branch used on macOS; Linux and Windows keep the system declarations.

Tested

  • macOS x86-64 (Rosetta, AppleClang, Release): main fails to build libc before the change; with it, cmake --build build --target libc --parallel 14 succeeds (exit 0).
  • python3 tools/check_conventions.py --base origin/main and python3 tools/debt_fold.py --check pass.
  • Not tested on a console; no behaviour changes, only the host-side model declaration.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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:5490561276 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27201). Originally posted by [fishingpvalues](https://github.com/fishingpvalues) on 2026-11-25T11:35:52Z. --- ### What `core/libs/prx/libc/src/exception/Runtime.cpp` (added by `bd637b7686`, "implement RTTI cast result callbacks") uses `__cxxabiv1::__class_type_info::__contained_virtual_mask`, `__contained_public_mask`, `__contained_ambig` and `__contained_public`. On Linux and Windows those come from the system libstdc++ `cxxabi.h`. On macOS the project ships its own model of the Itanium RTTI classes in `core/libs/prx/libc/include/specifics/itanium/CxxAbi.hpp`, and that model only had `enum __sub_kind { __unknown = 0 }`, so the full macOS build stopped at: ``` Runtime.cpp:296:91: error: no member named '__contained_virtual_mask' in '__cxxabiv1::__class_type_info' ``` This extends the model enumerator to the libstdc++ values the callbacks were written against (`__not_contained`, `__contained_ambig`, `__contained_virtual_mask = 1`, `__contained_public_mask = 2`, `__contained_mask = 4`, `__contained_private`, `__contained_public = 6`). It only affects the `_LIBCPPABI_VERSION` branch used on macOS; Linux and Windows keep the system declarations. ### Tested - macOS x86-64 (Rosetta, AppleClang, Release): `main` fails to build `libc` before the change; with it, `cmake --build build --target libc --parallel 14` succeeds (exit 0). - `python3 tools/check_conventions.py --base origin/main` and `python3 tools/debt_fold.py --check` pass. - Not tested on a console; no behaviour changes, only the host-side model declaration. ### 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) and the licence notice of code adapted from upstream (see AGENTS.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
MarcZX10 commented 2026-11-25 11:54:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T11:54:40Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

Reviewed head f89b8a55ea1cf451ef836bbe627df4479b9edfec. No build or tests were run; the description reports a successful macOS build and convention checks, but I did not independently verify them. I read description.md, commits.md, manifest.json, diff.patch, and the changed CxxAbi.hpp in full, plus relevant sections of Runtime.cpp, TypeInfo.cpp, and Runtime.hpp. The review file listing showed no files.json; the manifest lists one changed file and no exclusions.

Results

Check Result Note
Diff and changed file passed One changed file read in full
Related RTTI declarations and callers passed Relevant code inspected
Build and tests not run Description reports results; not independently verified

Negative control

Not run; no build or test environment was available through the review tools.

Findings

Blocking

None.

Non-blocking

The new enum values match the integer values already used by the RTTI callback code. Optional: retain the reported macOS build and convention-check results in CI for this head.

Sources

Not verified

The author-reported macOS build and convention checks were not run by me. Console behavior was not tested, as the change description also notes.

To get this to a good state

Nothing is required. Optional: confirm the reported macOS build and convention checks on this head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6057125571 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27201#pullrequestreview-6057125571). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-25T11:54:40Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this; the points below are optional. ## What I ran Reviewed head `f89b8a55ea1cf451ef836bbe627df4479b9edfec`. No build or tests were run; the description reports a successful macOS build and convention checks, but I did not independently verify them. I read `description.md`, `commits.md`, `manifest.json`, `diff.patch`, and the changed `CxxAbi.hpp` in full, plus relevant sections of `Runtime.cpp`, `TypeInfo.cpp`, and `Runtime.hpp`. The review file listing showed no `files.json`; the manifest lists one changed file and no exclusions. ## Results | Check | Result | Note | |---|---|---| | Diff and changed file | passed | One changed file read in full | | Related RTTI declarations and callers | passed | Relevant code inspected | | Build and tests | not run | Description reports results; not independently verified | ## Negative control Not run; no build or test environment was available through the review tools. ## Findings ### Blocking None. ### Non-blocking The new enum values match the integer values already used by the RTTI callback code. Optional: retain the reported macOS build and convention-check results in CI for this head. ## Sources - [Changed RTTI declarations at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/f89b8a55ea1cf451ef836bbe627df4479b9edfec/core/libs/prx/libc/include/specifics/itanium/CxxAbi.hpp) - [RTTI callback code at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/f89b8a55ea1cf451ef836bbe627df4479b9edfec/core/libs/prx/libc/src/exception/Runtime.cpp) ## Not verified The author-reported macOS build and convention checks were not run by me. Console behavior was not tested, as the change description also notes. ## To get this to a good state Nothing is required. Optional: confirm the reported macOS build and convention checks on this head.
ligmaSec commented 2026-12-03 13:55:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T13:55:32Z.

Review: COMMENTED


Compiled the exact header with Clang 19 and libc++abi and with GCC and libstdc++. Both probes verified all eight enum values. PR #26739 adds the same values to this header.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6171151686 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27201#pullrequestreview-6171151686). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T13:55:32Z. **Review:** COMMENTED --- Compiled the exact header with Clang 19 and libc++abi and with GCC and libstdc++. Both probes verified all eight enum values. PR #26739 adds the same values to this header. AI-assisted: yes.

Pull request closed

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!27201
No description provided.