Skip to content

build(libkernel): keep the ELF-only module fixture options off Apple - #10660

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
imellag:build/libkernel-elf-fixture-options-not-apple
Oct 27, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
imellag:build/libkernel-elf-fixture-options-not-apple

Conversation

@imellag

@imellag imellag commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

What

guest_module_fixture gets -Wl,--no-as-needed on every host but Windows. Apple's ld64 doesn't know that option, so on current main the fixture fails to link on macOS:

ld: unknown options: --no-as-needed
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

The option keeps the DT_NEEDED entries that nid_patcher_dynamic_strings checks, and test_dynamic_strings.py reads the ELF section headers and dynamic section, so neither applies to the Mach-O fixture. The block that adds both now reads if(NOT WIN32 AND NOT APPLE), the same way it already leaves out Windows' PE fixture. Linux is unchanged. #7201 has the same condition as part of the whole macOS port, on an older form of this block (if(Python3_Interpreter_FOUND AND NOT WIN32 AND NOT APPLE), before the block was nested). Its head (6687cbac29, 2026-10-16) conflicts with main and needs a rebase anyway, so the order proposed here is this PR first, with #7201 keeping main's block at its rebase; both forms leave the option and the test off Apple, so either one alone is enough. 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), on main fee6a14709, whose libkernel/CMakeLists.txt matches this branch's base c9b75825f3: cmake --build build --target guest_module_fixture fails with the error above without this change; with it, libguest_module_fixture.dylib links and the nid_patcher post-build step runs without error, and ctest -N no longer lists nid_patcher_dynamic_strings. guest_dynamic_loader_tests, which loads the fixture, needs libkernel, which does not build on main on macOS yet, so it was not run. Not built on Linux or Windows; the condition is unchanged there.

check_conventions.py --base upstream/main passes. pr_overlap.py lists no pull request with conflicting lines, only 18 it could not compare on libkernel/CMakeLists.txt because they conflict with main; of those, only #7201 changes this block.

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

guest_module_fixture passed -Wl,--no-as-needed on every host but
Windows, and Apple's ld64 rejects that option ("ld: unknown options:
--no-as-needed"), so the fixture failed to link on macOS. The option
keeps the DT_NEEDED entries that nid_patcher_dynamic_strings reads, and
that test parses the ELF dynamic section, so neither applies to the
Mach-O fixture: both now stay off Apple as they stay off Windows.

@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.

The Apple guard is correct for this fixture: -Wl,--no-as-needed and the ELF dynamic-string test do not apply to Mach-O, while the Linux condition remains enabled and Windows remains excluded. The PR describes a focused macOS x86-64 reproduction showing the fixture link fails on the base and succeeds with this condition; I did not independently rerun that macOS build. Eligibility, conventions, intake, labels, and report checks pass. Product test jobs were skipped by the hosted policy.\n\nI checked the overlap with #7201: it contains the same exclusion in the same CMake block, but that PR currently conflicts with main and has no directly mergeable head. This PR is a narrow standalone fix on current main, and its body already documents the overlap.

@THEMANnt THEMANnt 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 5315b24f5b72a924383da3c008c814600a74ffbd. Approve; no actionable finding in this focused review.

The ELF dynamic-string fixture and GNU --no-as-needed option are now restricted to non-Windows, non-Apple builds. The surrounding symbol-version test remains outside that restriction.

Validation: Interpreted the submitted CMake block for Darwin, Linux and Windows on head and base. The head omits the ELF-only option/test on Darwin and Windows and retains both on Linux.

Scope / next step: This is CMake branch/registration evidence; no Apple linker or full libkernel build was run.

@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the condition at libkernel/CMakeLists.txt:263: Linux keeps --no-as-needed and nid_patcher_dynamic_strings, Windows and Apple skip both, and nid_patcher_symbol_versions stays outside the block. The macOS link fix rests on the author's run, which we can't reproduce here; merged.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants