feat(libc): declare fundamental typeinfo records and their vtable #10548
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10548"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-24T09:32:19Z.
What
Declares the Itanium
__fundamental_type_infofamily that titles import from libc: the__cxxabiv1::__fundamental_type_infovtable export and thetypeinforecords for the primitive types (v w b c a h s t i j l m x y n o f d eplusDn,Ds,Di,Du).Each record is the standard two-slot
{vtable, name}layout pointing at the exported vtable, matching how the class/pointer/function typeinfo records in the same file are built. Catch matching needs no runtime change:Bases/VisitBasesonly recurse for__si_class_type_info/__vmi_class_type_infokinds, so a fundamental record matches itself by name and a thrownintis caught bycatch (int)/catch (...).PPSA30528 (RDR) imports
_ZTIiand_ZTIf; the audit flagged them as absent imports that stop the module from resolving. The other records complete the canonical set so any primitivetypeid/catch reference resolves the same way.Tested
Windows 11, MinGW build:
libc.prxlinks; the new records and the__fundamental_type_infovtable are present in the export table (_ZTIi_nid_postfix,_ZTIf_nid_postfix,_ZTVN10__cxxabiv123__fundamental_type_infoE_nid_postfix, …).windows_exception_testsandguest_locale_testspass. Guest catch matching for the records relies on the existingBases/Equalmachinery, which treats non-class kinds as self-matching.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)_ZTIi/_ZTIf; the title has further blockers unrelated to this change); PPSA99925 (Beetle PCE,undefined symbol: _ZTIion main -> loads and draws its library screen, confirmed by @milescoviello)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T10:39:07Z.
Review: APPROVED
Reviewed the current RTTI record and vtable layout against the neighboring Itanium typeinfo records and runtime matching path. The two-slot records point at the new vtable address point and use the expected builtin type encodings; the reported
_ZTIi/_ZTIfimports are included. Hosted eligibility, conventions, intake, labels, report, relinker/ASAN, register-context, and write-watch checks pass; Linux/Windows full builds were skipped by the eligibility gate. The contributor reports the libc link and Windows exception/locale tests passing; I did not rerun those locally. I left a non-blocking completeness note about_ZTIg(__float128) and the direct guest-record test coverage.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T12:23:21Z.
Review: APPROVED
The current head adds the missing __float128 and remaining canonical builtin records (
g,z, andDh) alongside the previously reviewed type records. Each uses the same two-slot RTTI record layout and the new fundamental-type vtable address point; the existing matching path compares these non-class records by name. Hosted eligibility, conventions, labels, report, the full relinker matrix, ASAN, register-context, and write-watch checks pass. Linux/Windows product build jobs were skipped; the Windows exception and locale tests are author-reported and not independently reproduced here. Direct guest tests for every record would improve coverage, but the export and layout changes are consistent with the surrounding RTTI implementation.Imported from boykopovar/AnyPS5. Originally posted by ahmadmuj on 2026-11-01T17:28:01Z.
Review: COMMENTED
Linux leg of the check @oneandonlydean asked for, on head
a361119ae15ac0ae8ba2ac619898ae764a7a872e(merge-basecc8226475b20; current mainf2d874c1fdcchasn't touched TypeInfo.cpp, the exception headers or this test since, so the head build matches the merged tree for these files).What I ran (WSL2 Ubuntu 24.04, GCC 13.3, Release, Ninja):
ctest -R guest_bad_optional_access: passes.ctest -R '^public_headers':public_headerspluspublic_headers_compile_0..63, 65/65 pass.f2d874c1fdccwith only this PR'sGuestBadOptionalAccess.cppfails to link on_ZTIi,_ZTIj,_ZTIf,_ZTIDnand_ZTVN10__cxxabiv123__fundamental_type_infoE._ZTIi_nid_postfixat the__class_type_infovtable address point makes the test abort, so it does catch a record on the wrong vtable.nm -Donlibc.prx: all 26 records and the vtable are exported; afternid_patcher, e.g._ZTIiisSt4apgcBNfoand the vtable isG4XM-SS1wxE.Kind/Equal/Matchin Runtime.cpp: fundamental records resolve to the fundamental kind and match by name only, and the slot[4]the test calls iscatchTypeinTypeInfoVtable.Two small things, neither blocking:
_ZTIzprobably shouldn't be exported....isn't a type, so neither clang nor GCC ever emits a_ZTIzreference (catch (...)uses a null type entry). Its NIDJe-wkqG37fcis also the only one of the 27 missing from the aerolib.csv thattools/nid_names.pypins; the other 25 records and the vtable are all there. I'd drop it unless you've seen it in a module. Side note on the PR text:Dhis the half-precision__fp16;_Float16mangles asDF16_. The"Dh"string is right either way.FundamentalVtable()isn't a constant expression, so GCC leaves the vptr zero in.dataand_GLOBAL__sub_I_Exports.cppstores all 26 at load (the exported records in StandardExceptions.cpp are static). It works, since the test passes through copy relocations. Still,{&_ZTVN10__cxxabiv123__fundamental_type_infoE_nid_postfix.destroy, "i"}with aconst void*vtable field would make them constant data, likeClassTypeVtable + 2in StandardExceptions.cpp.Not checked: Windows (you already ran it), real guest titles, and any console module listing which of these PS5 libc actually exports.
AI-assisted: yes (Claude Code); everything above was run on this machine.