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

Merged
imellag merged 1 commit from upstream-pr/10660 into main 2026-10-27 04:51:04 +00:00
imellag commented 2026-10-24 15:41:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by imellag on 2026-10-24T15:41:36Z.


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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4996771532 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10660). Originally posted by [imellag](https://github.com/imellag) on 2026-10-24T15:41:36Z. --- ### 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 <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-24 15:42:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T15:42:58Z.

Review: APPROVED


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5638825510 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10660#pullrequestreview-5638825510). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T15:42:58Z. **Review:** APPROVED --- 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 commented 2026-10-26 19:15:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-26T19:15:59Z.

Review: APPROVED


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5657673188 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10660#pullrequestreview-5657673188). Originally posted by [THEMANnt](https://github.com/THEMANnt) on 2026-10-26T19:15:59Z. **Review:** APPROVED --- 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.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!10660
No description provided.