Skip to content

test(libkernel): describe the flexible memory fixture's segment on macOS - #9972

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
tkcm01:fix/flexible-memory-fixture-meta-macos
Oct 24, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
tkcm01:fix/flexible-memory-fixture-meta-macos

Conversation

@tkcm01

@tkcm01 tkcm01 commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

What

guest_flexible_memory_declared loads guest_flexible_memory_module.guest.prx, a host-built fixture whose 512 MiB array must count against the flexible memory budget (GuestImageSegmentBytes). On macOS, dl_iterate_phdr (libc/src/specifics/macos/GuestImages.cpp) reports only images that carry the relinker's __APS5DATA,__meta program headers. Every relinked guest module has them, but the host-built fixture doesn't, so it was left out and the test failed at its budget check (GuestFlexibleMemoryBudget.cpp, GuestImageSegmentBytes_nid_no_patch() > 448u * 1024u * 1024u).

On macOS the fixture now fills its own __APS5DATA,__meta at load, with one PT_LOAD header for the array, as ProcessParametersFixture.hpp already does for the test program. The module target gets ${LIBS_INCLUDE_DIR} for ElfTypes.hpp. Linux and Windows are unchanged. The runtime is unchanged too: #7201 would make the test pass by synthesising program headers in dl_iterate_phdr for every host image, which this test alone doesn't need. Announced on #1, where @mugurc listed the failure as known in #7631.

Tested

macOS 27.0.1, Apple M4, Apple clang 21, x86-64 build under Rosetta 2. The libraries do not link on macOS from main alone, so the run is on mugurc's ci/macos-series-2 (53db0ba, main 3fd1cc3) with #7524, the code commits of #7937 and the libSceSsl change from #7332, as described on #1, plus my local macOS fixes listed there. The patch applies to that tree as is.

  • ctest -R '^guest_flexible_memory_': without this change 4 of 5 pass, and declared aborts with Flexible memory budget check failed at .../GuestFlexibleMemoryBudget.cpp:108. With it all 5 pass.
  • Full ctest -j4 with Vulkan (MoltenVK 1.4.2) on the same tree, with and without this change: 1648 tests. guest_flexible_memory_declared is the only test that now passes. The one that differs the other way, agc_driver_pass_input_hazard, failed once under load and passed 20 of 20 on its own and in 4 other full runs. No new failure.
  • python3 tools/check_conventions.py --base upstream/main: passed. tools/pr_overlap.py lists open PRs that change libkernel/CMakeLists.txt, and test: organize library tests and label CTest suites #6044, which moves the test sources; none changes this fixture.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

guest_flexible_memory_declared loads a host-built .guest.prx fixture
whose 512 MiB array must count against the flexible memory budget. On
macOS, dl_iterate_phdr reports only images that carry the relinker's
__APS5DATA,__meta program headers, which every relinked guest module
has but the host-built fixture does not. GuestImageSegmentBytes left
the fixture out and the test failed at its budget check.

On macOS the fixture now fills its own __APS5DATA,__meta at load with
one PT_LOAD header for the array, as ProcessParametersFixture does for
the test program. Linux and Windows are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

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.

Pull request Shared files not compared
PR 4563 core/libs/prx/libkernel/CMakeLists.txt
PR 5021 core/libs/prx/libkernel/CMakeLists.txt
PR 6830 core/libs/prx/libkernel/CMakeLists.txt
PR 6936 core/libs/prx/libkernel/CMakeLists.txt
PR 7090 core/libs/prx/libkernel/CMakeLists.txt
PR 7192 core/libs/prx/libkernel/CMakeLists.txt
PR 7201 core/libs/prx/libkernel/CMakeLists.txt
PR 9284 core/libs/prx/libkernel/CMakeLists.txt
PR 9293 core/libs/prx/libkernel/CMakeLists.txt
PR 9297 core/libs/prx/libkernel/CMakeLists.txt
PR 9302 core/libs/prx/libkernel/CMakeLists.txt
PR 9557 core/libs/prx/libkernel/CMakeLists.txt
PR 9561 core/libs/prx/libkernel/CMakeLists.txt
PR 9566 core/libs/prx/libkernel/CMakeLists.txt
PR 9575 core/libs/prx/libkernel/CMakeLists.txt
PR 9669 core/libs/prx/libkernel/CMakeLists.txt
PR 9693 core/libs/prx/libkernel/CMakeLists.txt
PR 9947 core/libs/prx/libkernel/CMakeLists.txt

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head 2fd0c1b against current main. The fixture metadata uses the same v2 offsets and PT_LOAD representation consumed by the existing macOS dl_iterate_phdr shim, and points the segment at the fixture's 512 MiB array. The change is limited to the host test fixture and its test-target include path; it does not change runtime image enumeration. The reported no-change platform results and macOS before/after tests exercise the intended regression.

The convention check against current main, exact-head 171-script registration audit, and git diff --check pass. The author reports 5/5 targeted macOS tests and a 1,648-test full run with one additional pass; the one intermittent opposite-direction failure is documented with its repeated standalone result. I could not run the macOS tests locally from this Linux workspace. Hosted policy checks pass and product build jobs are skipped. The PR is mergeable, and I found no blocking issue.

@maximilianfv

Copy link
Copy Markdown
Contributor

Independent test: Apple M1 Pro, macOS 27.0.1

Apple M1 Pro, macOS 27.0.1, Apple clang 21, x86-64 Release build under Rosetta 2, BUILD_TESTING=ON, no Vulkan loader. Base: mugurc's ci/macos-series-2 at 27e968974, with this pull request's commit cherry-picked (together with #9971 and #8920, which touch other files).

  • guest_flexible_memory_declared: fails on the series alone (budget check at GuestFlexibleMemoryBudget.cpp:108), and passes with this pull request in 2 of 2 runs.
  • Full ctest -j 6 (mic tests excluded): 15 failures with this change against 20 without, and no test that passed before fails now. The other differences are precise_wait and guest_refused_connect, which are flaky here either way.

AI-assisted: yes (Claude Code ran the build and the tests).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants