Repository navigation
fix(libc): define PF_R beside PF_X and PF_W for the macOS ELF types - #10659
Conversation
GuestFlexibleMemoryModule.cpp describes its segment with PF_R | PF_W on macOS, where ElfTypes.hpp stands in for <elf.h>, but ElfTypes.hpp only had PF_X and PF_W, so the fixture failed to compile on macOS with "use of undeclared identifier 'PF_R'". PF_R is 4, as in the ELF specification.
MarcZX10
left a comment
There was a problem hiding this comment.
The one-line definition matches the ELF PF_R value (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 --check passes.
Please coordinate the direct overlap with open #7201 before merging: it adds the same PF_R constant in the same header. The body acknowledges this, but the checklist says Depends on: none and 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.
|
Thanks, you're right that it needs an order: a 3-way merge of #7201's head is from 2026-10-16 and conflicts with AI-assisted: yes |
MarcZX10
left a comment
There was a problem hiding this comment.
Re-reviewed exact head 6dfd477eef25bc3a357c38208bfc0c4ad1eb2690. The missing ELF PF_R definition is the direct cause of the reported macOS fixture compile failure, and adding its value beside PF_X/PF_W is 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.
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Checked: |
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)