fix(libc): define PF_R beside PF_X and PF_W for the macOS ELF types #10659
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10659"
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 imellag on 2026-10-24T15:38:54Z.
What
#9972 made
GuestFlexibleMemoryModule.cppdescribe its segment on macOS withheader.p_flags = PF_R | PF_W. On macOS that file takes its ELF types fromprx/libc/include/specifics/linux/ElfTypes.hpp, which definesPF_XandPF_Wbut notPF_R, so on currentmainthe fixture fails to compile on macOS:This adds
PF_R = 4(the ELF value) beside the other two. None of the files that includeElfTypes.hppalso include<elf.h>or<link.h>, so the name cannot meet the system macro, as withPF_XandPF_W. #7201 adds the same constant to the same header as part of the whole macOS port, inside its own#ifdef __APPLE__block. The two lines are in different places, so a text merge of the second one to land is clean but leaves twoPF_Rdefinitions, a redefinition error on macOS. #7201's head (6687cbac29, 2026-10-16) conflicts withmainand needs a rebase anyway, so the order proposed here is this PR first andPF_Rdropped from #7201's block at its rebase; if #7201 lands first, this PR is not needed and I will close it.Tested
Apple M4 Pro, macOS 27.0.1, Apple clang, x86-64 Release (
-DCMAKE_OSX_ARCHITECTURES=x86_64, Ninja), onmainfee6a14709, whoseElfTypes.hpp,GuestFlexibleMemoryModule.cppandlibkernel/CMakeLists.txtmatch this branch's basec9b75825f3:cmake --build build --target guest_flexible_memory_modulefails with the error above without this change and compiles and linksguest_flexible_memory_module.guest.prxwith it. The test that loads the fixture needslibkernel, which does not build onmainon macOS yet, so it was not run. Not built on Linux or Windows; the header only gains a constant, and the macOS block that uses it is the only user.check_conventions.py --base upstream/mainpasses.pr_overlap.pylists only #7201 as a pull request it could not compare onElfTypes.hpp, because #7201 conflicts withmain.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-24T15:40:03Z.
Review: CHANGES_REQUESTED
The one-line definition matches the ELF
PF_Rvalue (4), and the PR identifies the missing constant in the macOS ELF header as the compile failure. The focused macOS compile is author-reported; hosted policy checks pass, with relinker/register-context jobs still running.git diff --checkpasses.Please coordinate the direct overlap with open #7201 before merging: it adds the same
PF_Rconstant in the same header. The body acknowledges this, but the checklist saysDepends on: noneand does not record which branch lands first or how the second change will avoid a duplicate definition. Please agree and record the integration order (or clarify why the two patches will not conflict), then I can complete the review.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T15:45:36Z.
Review: APPROVED
Re-reviewed exact head
6dfd477eef25bc3a357c38208bfc0c4ad1eb2690. The missing ELFPF_Rdefinition is the direct cause of the reported macOS fixture compile failure, and adding its value besidePF_X/PF_Wis correct. The author has now documented the duplicate-definition hazard with #7201 and a workable ordering: this standalone fix first, then remove #7201’s duplicate at rebase; if #7201 lands first, close this PR. The focused macOS build is author-reported, not independently reproduced. Eligibility, conventions, intake, labels, report, all relinker platforms, ASan, register-context and write-watch checks pass; product build jobs are skipped. I found no remaining blocker on this PR.