build(libkernel): compile NativeStat and Rtld on macOS #11240
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11240"
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 iamthehimansh on 2026-10-25T22:28:15Z.
What
Next part of splitting #8658: two
libkernelfiles that do not compile on macOS. Each change is macOS-only; Linux and Windows compile the same code as before.File/src/NativeStat.cpp: copy the Darwinst_atimespec/st_mtimespec/st_ctimespecfields, since Darwin'sstruct stathas nost_atim/st_mtim/st_ctim. Also stat through a directory descriptor when the host path reachesPATH_MAX. That is 1024 on Darwin, the same as the guest limit, so a guest path near the limit no longer fits once the host root is prepended.System/src/Rtld.cpp: macOS has no<link.h>. Find the image withdladdrand take the extra reference withdlopen(RTLD_NOLOAD), skipping the main executable as the Linux path does.@marion909's #7201 also changes these two files, inside a 100-file port; this PR carries only these two so they can land separately.
DirectMemory.cpp,SharedMemory.cpp,Stdio.cpp,DynamicLoader.cpp,ModuleInfo.cpp,Thread.cpp,Exception.cpp,Process.cppand libc'sGuestAllocations.cppstill fail on macOS; they follow in separate PRs.Tested
macOS 26 on an Apple M2 Pro, x86_64 under Rosetta 2, Release with Ninja, on
mainatb90d009d9: both objects compile, wheremainfails them. Thelibkerneltests cannot run on macOS until the files above build, so this is a compile check only. Both files passed the stat and module tests on #8658's branch. For Linux and Windows, I checked each file's view underunifdef -U__APPLE__, with-D__linux__and with-D_WIN32: it equalsmain.python3 tools/check_conventions.py --base origin/mainpasses.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 MarcZX10 on 2026-10-25T22:35:26Z.
Review: CHANGES_REQUESTED
The rest of the macOS changes are scoped to the platform, and the reported compile checks are useful. I found one permission regression in the long-path fallback; see the inline note.
git diff --checkand the current-main conventions check pass. Hosted eligibility, conventions, intake, labels and report pass; all product build jobs are skipped. I did not run the macOS behavior locally.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T22:49:17Z.
Review: APPROVED
Rechecked exact head
0783152995bab8ecac72893e9a8e116e4a0a80f9against currentmainb90d009d9f73354cbea239a74a8f7e2dcd138772. ReplacingO_RDONLY | O_DIRECTORYwith DarwinO_SEARCHaddresses the execute-only intermediate-directory regression. The author reports a focused x86_64 run on a 1,472-byte path through seven0111directories: the old flags returnedEACCES, andO_SEARCHsucceeded. I did not run that Darwin-only scenario locally, and no automated regression was added; the existing macOS runtime suite remains blocked on the other in-progress port PRs. Exact-worktreegit diff --checkand conventions pass; hosted eligibility, labels and conventions pass, the progress report is still running, and product build/test jobs are skipped by path policy. No other blocking issue found.Pull request closed