Skip to content

Use ld64.lld (LLVM's Mach-O linker) for Darwin builds#100275

Merged
alexey-milovidov merged 1 commit intomasterfrom
use-lld-on-darwin
Mar 21, 2026
Merged

Use ld64.lld (LLVM's Mach-O linker) for Darwin builds#100275
alexey-milovidov merged 1 commit intomasterfrom
use-lld-on-darwin

Conversation

@alexey-milovidov
Copy link
Copy Markdown
Member

Prefer ld64.lld over Apple's ld (cctools-port ld64) for macOS builds. This should significantly reduce Darwin link times, as cctools-port's ld64 is very slow with -ffunction-sections and -dead_strip. Falls back to ld if ld64.lld is not available.

Works for both native macOS builds and cross-compiled builds from Linux.

#99474 (comment)

Changelog category (leave one):

  • Build/Testing/Packaging Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Prefer ld64.lld over Apple's ld (cctools-port ld64) for macOS builds. This should significantly reduce Darwin link times, as cctools-port's ld64 is very slow with -ffunction-sections and -dead_strip. Falls back to ld if ld64.lld is not available.

Prefer `ld64.lld` over Apple's `ld` (cctools-port ld64) for macOS
builds. This should significantly reduce Darwin link times, as
cctools-port's ld64 is very slow with `-ffunction-sections` and
`-dead_strip`. Falls back to `ld` if `ld64.lld` is not available.

Works for both native macOS builds and cross-compiled builds from Linux.

#99474 (comment)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@clickhouse-gh
Copy link
Copy Markdown
Contributor

clickhouse-gh Bot commented Mar 21, 2026

Workflow [PR], commit [0095d83]

Summary:


AI Review

Summary

This PR updates Darwin linker discovery to prefer ld64.lld (versioned and unversioned names) while keeping ld as fallback. The change is small, localized to cmake/tools.cmake, and aligns with the stated goal of reducing macOS link time without forcing a hard dependency. I did not find correctness, safety, compatibility, or performance-risk issues in the implementation.

Missing context

  • ⚠️ No CI results/logs were provided in the review request context, so this review is limited to static diff/code inspection.

ClickHouse Rules

Item Status Notes
Deletion logging
Serialization versioning
Core-area scrutiny
No test removal
Experimental gate
No magic constants
Backward compatibility
SettingsChangesHistory.cpp
PR metadata quality
Safe rollout
Compilation time

Final Verdict

  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-build Pull request with build/testing/packaging improvement label Mar 21, 2026
@alexey-milovidov
Copy link
Copy Markdown
Member Author

It works.

@alexey-milovidov alexey-milovidov self-assigned this Mar 21, 2026
@alexey-milovidov alexey-milovidov merged commit 976e94e into master Mar 21, 2026
151 of 152 checks passed
@alexey-milovidov alexey-milovidov deleted the use-lld-on-darwin branch March 21, 2026 15:32
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Mar 21, 2026
@Algunenano Algunenano mentioned this pull request Apr 9, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-build Pull request with build/testing/packaging improvement pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants