fix(libc): find guest image pages through dyld on macOS hosts #10366
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10366"
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 krishalivaibhav on 2026-10-23T19:33:52Z.
What
Build fix:
GuestAllocations.cppcollected image pages withdl_iterate_phdrfrom<link.h>, which macOS does not have, solibcdid not compile there. On macOS it now walks the loaded images with_dyld_image_count/_dyld_get_image_headerand reads theLC_SEGMENT_64load commands (collectMachImagePages). The Linux/Windows path is unchanged. The Linux-only anonymous re-backing of the main image (/proc/self/maps,mremap) is excluded on macOS.Extracted from the
feat/macos-portbranch (#8658) as iamthehimansh asked there; the first standalone piece of that split. Commit0f15e1baais theirs.Tested
macOS: Apple Silicon M2, x86_64 build, Release, Vulkan SDK 1.4.363.0. Integration of
maind7948b09f+ #4627 + #10362 + this commit (the first two are needed for the rest oflibcto compile on macOS). Thelibctarget builds, andguest_exit_order,guest_path_lifetime,guest_libc_static_imports,guest_libc_mutex_init_with_name,guest_libc_cnd_init_default_nameandguest_libc_cnd_timed_waitpass.ninja libs -k 0has 10 failed objects, all inlibkernel(outside this PR).guest_libc_threadsneedslibkerneland was not run.No test covers this file on macOS:
guest_image_anonymous_testsis not built there and the memory tests live inlibkernel.Linux/Windows: unchanged code path; not built locally, CI will build them.
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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T19:35:37Z.
Review: APPROVED
Reviewed current head
0f15e1baa3. The Apple path uses dyld's loaded-image headers and LC_SEGMENT_64 protections, while the existing ELF path remains unchanged; the Linux-only /proc and mremap path is correctly excluded on macOS. Segment page permissions are accumulated consistently with the existing ELF collector, including shared boundary pages. The author reports a macOS libc build and focused guest_libc tests in an integration stack that supplies the separately tracked macOS prerequisites; I did not build it locally. Hosted eligibility, conventions, intake, labels and progress-report checks pass; product Linux/Windows jobs are skipped by path policy, and the relinker/memory jobs were still running when I reviewed. No blocking issue found.