feat(libfontconfig): match firmware configuration export behavior #15294
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15294"
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 hyvvs on 2026-11-02T22:53:23Z.
What
Match the three
libfontconfigconfiguration exports to the inspected firmware 13.42 module rather than desktop Fontconfig behavior:FcConfigCreate()returns null,FcConfigReference(config)returns null for both null and nonnull arguments, andFcConfigDestroy(config)is a no-op for both. The public calls retain typedAPS5_VABIsignatures and are documented as firmware-observed silent stubs, not fabricated success values.Reviewer BunnyFl provided the complete short disassemblies in the review, from
system_ex/common_ex/lib/libfontconfig.sprxSHA-25674d7414445f8687c1d22a92fa3c994d2e5fa304e6699dc84dcc5459af7da8472: creation and reference each cleareaxand return; destroy returns without touching its argument. This is firmware disassembly, not console execution, and behavior on other firmware is not established. The previous host Fontconfig reference-counted objects and null-reference throw were incompatible with this evidence; they have been removed. The change does not implement font discovery, rule substitution or configuration loading.The focused test source-links
Config.cpp, keeps Release assertions enabled, checks both null and nonnull reference/destroy inputs and unchanged caller storage, and usesconfigure_host_test_executableas requested in review. The production PRX retains its own Windows unwind configuration. Silent-stub scope and firmware limitations are described indocs/dev/debt/libfontconfig.md. Independent of #15283 at the function level; it shares the module'sCMakeLists.txtand debt file and could need textual merge resolution.Tested
-O3 -DNDEBUG -Wall -Wextra -Werror -pedantic -fasynchronous-unwind-tables -static -static-libgcc -static-libstdc++: focusedGuestFontconfigConfig.cpp+Config.cppbuilt and executed, exit 0; 256 repeated cycles of all three firmware-return contracts, including a nonnull pointer without dereference.ASAN_OPTIONS=detect_leaks=1:halt_on_error=1: focused test passed.upstream/mainExport.cppaborted on its first unsupported export as expected; it does not pass simply because assertions were disabled.Not tested: physical PS5 firmware execution, cross-firmware equivalence, full integrated library CTest in local worktree, or Mac. No new third-party code.
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)Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-03T02:57:57Z.
Review: CHANGES_REQUESTED
The PR follows Fontconfig 2.15.0, but the console's module behaves differently. In firmware 13.42's
system_ex/common_ex/lib/libfontconfig.sprx(sha25674d7414445f8687c1d22a92fa3c994d2e5fa304e6699dc84dcc5459af7da8472), all three of these exports are stubs. Each body below is read to its return, disassembly only, not measured on a console:So on the console:
FcConfigCreatereturns NULL.FcConfigReferencereturns NULL for any argument, including NULL. It does not dereference it.FcConfigDestroydoes nothing for any argument.The neighbouring
FcConfigGetCurrent(0x130) is the samexor %eax,%eax; ret, so the module has no configuration objects at all.With this PR, a title that checks
FcConfigCreate() == NULLgets a live handle instead.FcConfigReference(NULL)throws, where the console returns NULL. Could you implement the three as the module does (return NULL, return NULL, no-op), with a test that usesmainas its negative control? Please record indocs/dev/debt/libfontconfig.mdthat this follows the 13.42 disassembly and isn't measured on a console. The reference-counting code and its concurrency test would then go away.Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-03T13:43:46Z.
Review: APPROVED
Re-checked — approved
@hyvvs thanks.
FcConfigCreateandFcConfigReferencenow return NULL for every argument, andFcConfigDestroydoes nothing. That matches the 13.42 bodies I posted. The debt entry also says this comes from the disassembly and was not measured on a console.On Windows (WinLibs GCC), with head
fa5b2d281dmerged intomain,guest_fontconfig_configpasses.mainhas noConfig.cppto swap back in, so I broke the code instead. The test fails both whenFcConfigCreatereturns a non-NULL pointer and whenFcConfigDestroywrites through its argument.Non-blocking:
core/libs/prx/libfontconfig/CMakeLists.txtkeeps-fasynchronous-unwind-tablesandtarget_link_libraries(libfontconfig PRIVATE libc)from the reference-counting version. Nothing inConfig.cppthrows any more, and the loop incore/libs/CMakeLists.txtalready linkslibcto every library, so both lines could go.libfontconfig.hpp, the debt file, and its ownstruct FcConfig;declaration. It answersFcConfigGetCurrent(NULL) andFcInitBringUptoDate(1). Whichever lands second needs a small rebase, and the debt sentence "FcConfigGetCurrent... still throw" would then need updating.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-11-07T03:48:17Z.
Review: CHANGES_REQUESTED
The firmware-13.42 behaviour (null create/reference, no-op destroy) matches the disassembly BunnyFl posted, and the test pins it, but the hosted Windows build fails on this head:
core/libs/prx/libfontconfig/CMakeLists.txt:6-7: theif(MINGW) target_compile_options(libfontconfig PRIVATE -fasynchronous-unwind-tables)block breaksExport.cpp. The compile line then carries-fno-asynchronous-unwind-tables -fasynchronous-unwind-tables, and the assembler rejects it:Error: .seh_handlerdata used outside of .seh_proc block(Build run 42308148378, jobwindows,libfontconfig.dir/Export.cpp.obj). The flag was added for the earlier exception-basedConfig.cpp;Config.cppno longer throws, andconfigure_windows_unwind(libfontconfig)on the line above already handles the unwind setup. Please drop the block and check that the Windows job goes green.Everything else I checked is fine (typed signatures, debt entry under Silent stubs, test pins null returns and unchanged storage for null and nonnull inputs).