fix(libkernel): preserve C linkage for the host instance lock release #17140
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/17140"
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 PrivacyOnion on 2026-11-08T11:04:55Z.
What
Closed as obsolete after #17150 was merged in
eb41c5465d: main removed the title instance lock,InstanceLockHost.hpp, and the SystemService release call. There is no remaining helper declaration/import to repair. On maineb41c5465d, a fresh GCC 15.2.0 build and patched_libraries run also passes: 407 patched libraries loaded, 0 failed. The original reproduction and validation below are preserved for reference.Give
ReleaseHostInstanceLock_nid_no_patchC linkage in its shared declaration. The definition and SystemService caller inherit it from this header.After #17076, MinGW still emits
_Z36ReleaseHostInstanceLock_nid_no_patchv. Its trailingvprevents the NID patcher from recognizing the_nid_no_patchsuffix, so the patched kernel export no longer matches the SystemService import. Windows reports error 127 loading SystemService and its dependent libraries. C linkage preserves the intended host helper name through patching.This changes linkage only. Lock acquisition, release and guest export behavior are unchanged. No performance gain is claimed.
Tested
Windows 11 10.0.26200, MinGW GCC, Release build. Reproduced with the unmodified header from main
49f36536321fa3941deb9408d556597dab1e4e28, rebuilt the patched kernel and SystemService, then restored this one-line change and rebuilt them and the instance-lock tests. The branch is rebased onto main105c9e4d91; the intervening merges touch AES unwrap and relative DPP shader instructions, not the linkage or instance-lock code tested here.patched_librariestest fails:392 patched libraries loaded, 15 failed; all 15 failures reportLoadLibraryEx failed with error 127, including SystemService and UserService.407 patched libraries loaded, 0 failed.ctest --test-dir <build> -R "^(patched_libraries|instance_lock.*)$" -V: all 7 tests pass, none skipped. Includes lock behavior, host backend, held-lock startup, unset/off configuration and startup without a title.python tools/check_conventions.py --base upstream/main: passes. The explicitly requested--base origin/mainwas also run; the fork main is stale and reports 18 errors in pre-existing upstream commits, unrelated to this one-line diff.python tools/pr_overlap.py --branch codex/fix-lock-release-linkage --repo boykopovar/AnyPS5: no overlap with the 1,793 other open PRs examined.Revalidated after a fresh full runtime and relinker build with the supported WinLibs GCC 15.2.0 UCRT/POSIX r7 toolchain on main
105c9e4d91plus this one-line change: the same seven CTest tests pass, with407 patched libraries loaded, 0 failed.No export-only test was added; the existing loader and behavioral tests cover the regression.
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 coptergui-ops on 2026-11-08T12:30:21Z.
Review: APPROVED
Reviewed at current head. Change is exactly as described: extern C added to the shared ReleaseHostInstanceLock_nid_no_patch declaration so MinGW stops emitting the mangled _v-suffixed symbol that breaks NID patching (Windows error 127 loading SystemService); definition and other-header copies removed so linkage is declared once; test gains the include. Lock acquisition/release semantics untouched. Conventions checker: no new findings from this diff.
Pull request closed