Skip to content

feat(core): route Mach-O by target to ld64.lld on any host; darwin-cc rule (#192) - #198

Merged
zackees merged 2 commits into
mainfrom
feat/meta-work-192
Sep 18, 2026
Merged

zackees merged 2 commits into
mainfrom
feat/meta-work-192

Conversation

@zackees

@zackees zackees commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Closes #192

Summary

  • Mach-O is selected by target, not host: -arch, -platform_version, an Apple --target=/-target triple (new Signal::DriverTarget), or a Mach-O input header route to ld64.lld on any host (log reason target:mach-o).
  • The darwin-cc rule: reject_darwin_cc_argv runs before engine selection for Mach-O links (reads through @file, no RELD_UNSUPPORTED escape). The error names the offending flag and -Clinker-flavor=ld64.lld. DARWIN_CC_DRIVER_FLAGS is separate from the ELF flag table.
  • Unit tests, bridge_route.rs end-to-end tests, docs (polylinker.md, routing-maintenance.md).
  • cross-ship.yml: link a Mach-O hello on ubuntu (hand-written libSystem TAPI v4 stub, -fuse-ld=lld --ld-path=reld) and run it on macos-14.

Validation (local, Linux host)

  • cargo fmt --all -- --check, cargo clippy --workspace --all-targets -- -D warnings: clean.
  • cargo test -p reld-core --lib: 252 passed. cargo test -p reld --test bridge-route: 13 passed.
  • Integration fix: darwin_cc_argv_fails_naming_linker_flavor expected -nodefaultlibs to be reported, but the rejection names the first darwin-cc flag in argv order, which is --target= itself. The assertion now accepts either.
  • Linux-host Mach-O link: unwrapped clang 21 --target=arm64-apple-macos11 -fuse-ld=lld --ld-path=target/release/reld -nostdlib hello.o libSystem.tbd produced Mach-O 64-bit arm64 executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|PIE>. The invocation log has "engine":"ld64.lld" and "reason":"target:mach-o". clang passed -arch arm64 -platform_version macos 11.0.0 11.0.0 to reld. (The NixOS cc-wrapper clang injects -dynamic-linker, so it can't be used for a Darwin target.)
  • reld -arch arm64 -nodefaultlibs ... fails (exit 255) with an error that names -nodefaultlibs and -Clinker-flavor=ld64.lld.
  • act: act -W .github/workflows/ci.yml -j hygiene --pull=false --action-offline-mode -P ubuntu-24.04=catthehacker/ubuntu:act-24.04 passed (Job succeeded): fmt, clippy -D warnings, cargo deny check licenses. --action-offline-mode is needed because act can't clone SHA-pinned actions (remote not found).

🤖 Generated with Claude Code

zackees and others added 2 commits September 18, 2026 13:29
…rwin-cc argv (#192)

Mach-O selection is now target-driven (-arch, -platform_version, Apple
--target triple, Mach-O input header) so a Linux host links Mach-O via
ld64.lld. Darwin cc-driver flags are rejected with a pointer to
-Clinker-flavor=ld64.lld. Adds cross-ship Linux-linked Mach-O hello
run on macos-14.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@zackees
zackees merged commit 50a6c17 into main Sep 18, 2026
30 of 31 checks passed
@zackees
zackees deleted the feat/meta-work-192 branch September 18, 2026 21:58
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.

routing: Mach-O cross from Linux via ld64.lld, and the macOS darwin-cc rule (reld#123 Phase 3, step 3)

1 participant