Skip to content

Update LLVM for Mach-O __LINKEDIT alignment fix. - #158410

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
goranmoomin:update-llvm-linkedit-align-157750
Jun 26, 2026
Merged

rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
goranmoomin:update-llvm-linkedit-align-157750

Conversation

@goranmoomin

@goranmoomin goranmoomin commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Update LLVM submodule to pull in changes from rust-lang/llvm-project#198.

Fixes #157750.

This backport has been discussed in: #t-compiler > Backport LLVM change to Rust for macOS 27 support?.

@rustbot rustbot added the A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. label Jun 25, 2026
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 25, 2026
@rustbot

rustbot commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @cuviper (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue
Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @cuviper

@rustbot

rustbot commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

⚠️ Warning ⚠️

@cuviper

cuviper commented Jun 25, 2026

Copy link
Copy Markdown
Member

Note, this also includes the 22.1.8 update from rust-lang/llvm-project#197

@bors r+ rollup=iffy (LLVM rebuild)

@rust-bors

rust-bors Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

📌 Commit b442414 has been approved by cuviper

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 6. This pull request will be tested once the tree is reopened.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 25, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 25, 2026
…lign-157750, r=cuviper

Update LLVM for Mach-O __LINKEDIT alignment fix.

Update LLVM submodule to pull in changes from rust-lang/llvm-project#198.

Fixes rust-lang#157750.

This backport has been discussed in: [#t-compiler > Backport LLVM change to Rust for macOS 27 support?](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Backport.20LLVM.20change.20to.20Rust.20for.20macOS.2027.20support.3F/with/605925959).
rust-bors Bot pushed a commit that referenced this pull request Jun 25, 2026
Rollup of 10 pull requests

Successful merges:

 - #158410 (Update LLVM for Mach-O __LINKEDIT alignment fix.)
 - #157397 (cmse: clear padding when crossing the secure boundary)
 - #158036 (Add -Zinstrument-mcount=fentry to -Zinstrument-mcount)
 - #158330 (llvm: use intrinsics for f16, f32 minimum/maximum)
 - #158359 (fix(tests): allow either branch direction in ilog_known_base)
 - #158067 (LLVM 23: Adapt codegen test to moved assume)
 - #158261 (Move part of the target checking for `#[may_dangle]` to the parser)
 - #158358 (Fix invalid E0609 raw pointer deref suggestion inside macros)
 - #158392 (delegation: add tests for defaults and infers in generics)
 - #158394 (Generate synthetic generic args only for delegation's child segment)
@rust-bors
rust-bors Bot merged commit 9b1c041 into rust-lang:main Jun 26, 2026
13 checks passed
@rustbot rustbot added this to the 1.98.0 milestone Jun 26, 2026
rust-timer added a commit that referenced this pull request Jun 26, 2026
Rollup merge of #158410 - goranmoomin:update-llvm-linkedit-align-157750, r=cuviper

Update LLVM for Mach-O __LINKEDIT alignment fix.

Update LLVM submodule to pull in changes from rust-lang/llvm-project#198.

Fixes #157750.

This backport has been discussed in: [#t-compiler > Backport LLVM change to Rust for macOS 27 support?](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Backport.20LLVM.20change.20to.20Rust.20for.20macOS.2027.20support.3F/with/605925959).
herbygillot added a commit to macports/macports-ports that referenced this pull request Aug 21, 2026
Upstream fixed this in rust-lang/rust#158410, and the LLVM 22.1.8 bundled
in 1.98.0 now aligns every LINKEDIT entry to pointer size rather than just
the symbol strings, so the patch is redundant.  Its LLVM hunk no longer
applies to that refactored MachOLayoutBuilder either, so the patch phase
would fail outright on any system matching the guard.

No revision bump: the guard was `os.major >= 27`, which no buildable
system satisfies, so the patch never applied and the installed files do
not change.

Assisted-by: Claude:claude-opus-5
Colourlessglow added a commit to vill-v-kit/bumpp that referenced this pull request Aug 21, 2026
规避背景(c8f05c8):Xcode 27 链接器为大符号量 cdylib 排布 Mach-O 符号表
时串池不按 8 字节对齐,macOS 27 dyld 对声明 sdk ≥ 27 的二进制 dlopen
拒载,当时以 -Wl,-platform_version 声明 SDK 26.0 走宽容路径规避。

rust-lang/rust#158410(llvm-objcopy Mach-O 串池对齐)已随 rustc 1.98.0
落地,mise 钉版 1.97.1 → 1.98.0;本机 macOS 27 + CLT ld-27037 实测:
去规避后无论 strip 与否,产物声明 sdk 27.0、stroff 8 字节对齐、node
dlopen 均通过。CI macos-latest 为 macOS 26 + Xcode 26.6,本就无此
问题。[profile.release] strip 维持停用,注释更正为已验证可随时恢复。
lizc2003 added a commit to lizc2003/kloop that referenced this pull request Sep 30, 2026
Before 1.98, rustc strips Mach-O release artifacts with an llvm-objcopy
that can leave the LINKEDIT string pool 4-byte aligned; macOS 27's dyld
refuses such images, so a release build there dies with "can't find crate
for `rquickjs_macro`" once the stripped proc-macro dylib will not load
(fixed upstream in rust-lang/rust#158410). On 1.96.1 the stripped kloop
executable itself was misaligned too, so exempting only host artifacts
would not have been enough, and turning strip off would keep std's
debuginfo in Linux release binaries.

- rust-toolchain.toml: 1.96.1 -> 1.98.1; rust-version: 1.96 -> 1.98,
  since the pin is the only toolchain any gate runs.
- 1.98 lints: drop `use anyhow::Context as _` from the three tools/fs
  platform files (the parent's import already arrives via `use super::*`)
  and use as_chunks in a powershell test (chunks_exact_to_as_chunks).
- README and DESIGN.md "Running" name 1.98; DESIGN.md also records why
  1.98 is a floor on macOS 27, and now lists the whole-workspace Windows
  clippy check among the Windows evidence.

Verified with: make check on 1.98.1 (fmt, clippy, all 34 test binaries,
parity); cargo clippy --workspace --target x86_64-pc-windows-msvc
--all-targets --all-features -- -D warnings via the stand-in C compiler;
make build, then every freshly built proc-macro dylib (19) and the kloop
binary have LC_SYMTAB.stroff % 8 == 0 with no OSO stabs left (strip ran).
Under 1.96.1 the same check found rquickjs_macro and kloop at 4. Not run
on macOS 27, Linux or Windows; fallback.rs is not compiled by any
available target.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
djt358 added a commit to djt358/tonalkit that referenced this pull request Oct 4, 2026
rustc below 1.98 strips release debuginfo (Cargo's default) with an llvm-objcopy that can leave
the Mach-O LINKEDIT string pool 4-byte aligned; macOS 27's dyld refuses it ("mis-aligned LINKEDIT
string pool", rust-lang/rust#158410). maturin's strip = false wasn't enough: Cargo's own default
still stripped. strip = "none" in the release profile avoids it on any toolchain.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01CrBBhViD1su1XP2Wq7diSZ
@pronebird pronebird mentioned this pull request Oct 4, 2026
1 task done
pronebird added a commit to nymtech/nym-vpn-client that referenced this pull request Oct 4, 2026
Fixes issues when building on macOS 27
see: rust-lang/rust#158410
pronebird added a commit to nymtech/nym-vpn-client that referenced this pull request Oct 4, 2026
Fixes issues when building on macOS 27
see: rust-lang/rust#158410
michaeltrefry added a commit to SceneWorks/SceneWorks that referenced this pull request Oct 13, 2026
…t#158410)

Replaces the own-target-dir retry: the other release producers on these Macs
already set CARGO_PROFILE_RELEASE_STRIP=none for the same E0463.

Co-Authored-By: Weave Router <[email protected]>
matt2e added a commit to block/buzz that referenced this pull request Oct 26, 2026
…#8598)

## Summary

Bump the pinned Rust toolchain from 1.95.0 to 1.98.1 so release builds
work on macOS 27 hosts.

Rust ≤ 1.97 strips Apple-target artifacts with its bundled
`llvm-objcopy`, which leaves the Mach-O `LC_SYMTAB` string pool
(`__LINKEDIT`) only 4-byte aligned. macOS 27's dyld refuses to `dlopen`
such images (`mis-aligned LINKEDIT string pool`). Because cargo applies
the release profile's default `strip = "debuginfo"` to proc-macro dylibs
too, `cargo build --release` of any crate that uses sqlx macros
(`buzz-db`, `buzz-relay`, `buzz-admin`, …) fails on macOS 27: rustc
cannot load `libsqlx_macros-*.dylib`. Dev builds pass because the dev
profile does not strip, which is why this only shows up as a
release/packaging failure.

The fix (llvm/llvm-project#203680, pulled into rustc by
rust-lang/rust#158410 for rust-lang/rust#157750) first shipped in Rust
1.98.0 and was never backported to 1.97.x. `block/buzz-app` pinned
1.98.1 for the same failure in block/buzz-app#529. With this bump the
`CARGO_PROFILE_RELEASE_BUILD_OVERRIDE_STRIP=none` / custom-linker
workarounds people have been using locally are no longer needed.

### What changes

Two commits: the toolchain bump (with the desktop clippy fixes), then
the workspace clippy fixes.

| Location | Change |
|---|---|
| `rust-toolchain.toml` | `channel = "1.95.0"` → `"1.98.1"` (profile
unchanged) |
| `Dockerfile`, `Dockerfile.push-gateway` | `ARG RUST_VERSION=1.95` →
`1.98` |
| `Dockerfile.sprig` | `rust:1.98-alpine3.22` with the manifest-list
digest verified on Docker Hub (shared by the `1.98` and `1.98.1` tags) |
| `.github/workflows/release.yml` | `dtolnay/rust-toolchain` pinned to
the tip of its `1.98.1` branch (`18f04874`) for the Windows desktop
release job |
| `benchmarks/harbor-buzz-orchestra` | `RUST_IMAGE = rust:1.98-alpine` |
| `_ci-rust.yml`, `windows-canary.yml`, `app_state_tests.rs` | stale
"1.95" comments reworded; the `unknown_lints` allow stays with a
version-agnostic rationale |
| `desktop/src-tauri` | lints clippy 1.98 newly raises under `-D
warnings`: `chunks_exact_to_as_chunks` at five fixed-width PCM/UTF-16
decoders, `needless_borrows_for_generic_args` on the `Copy` `norm`
closure in `config_bridge/reader.rs`, and a redundant `Engine as _`
import in `hpke_key_backup_tests.rs` that `use super::*` already
provides |
| Workspace crates (9) | the 30 lints clippy 1.98 newly raises in `cargo
clippy --workspace --all-targets -- -D warnings`, listed below |

Workspace lint fixes:

| Lint | Sites | Fix |
|---|---|---|
| `result_large_err` (20) | `buzz-relay` `api/git/transport.rs` (8),
`api/git/settings.rs` (6), `api/gifs.rs`, `api/workflows.rs`,
`api/profiles.rs`; `buzz-push-gateway` `verify_installation_assertion` |
Clippy 1.98 now checks `async fn`s, so every `async fn … -> Result<_,
axum::response::Response>` trips it. These follow the existing allow
pattern in `api/media.rs` and `nip_fi_http.rs` ("Response is the natural
error type for axum handlers"): module-level in the two git files,
per-function elsewhere. Boxing `Response` would touch every handler for
no runtime benefit. |
| `chunks_exact_to_as_chunks` (3) | `buzz-media` MP4 brand scan;
`buzz-voice` npy f32 reader and stereo test fixture | `chunks_exact(N)`
→ `as_chunks::<N>().0` |
| `question_mark` (3) | `buzz-acp` queue flush fallback and
slash-command mention skip; `buzz-agent` `find_git_root` | `match … {
None => return None }` → `?` |
| `useless_format` (2) | `buzz-auth` nip_fi startup test policies |
`format!("…")` → `"…".to_string()` |
| `useless_borrows_in_formatting` (1) | `buzz-pairing-cli` secret print
| drop the borrow |
| `manual_noop_waker` (1) | `buzz-sdk` broker test `block_on` |
`Waker::noop()` (stable since 1.85) |

All `as_chunks` rewrites keep `chunks_exact`'s remainder-dropping
semantics, and `as_chunks` is stable since 1.88, which is the MSRV.

One change in `api/git/transport.rs` is not a lint fix. Staging that
file trips the pre-commit secret scanner on its existing test-only ES256
fixture (`GIT_TEST_EC_PEM`), and the scanner only honours a suppression
marker on the flagged line. So the `\`-continued string literal is
rewritten as a byte-identical `concat!` whose `BEGIN` line carries
`sadscan:disable kingfisher.privkey.2`.

Left as is on purpose: `Cargo.toml` `rust-version = "1.88.0"` (MSRV
floor, a separate concern), the README/CONTRIBUTING "1.88+" text, Hermit
(no Rust packages there), the lockfiles, and the `(1.95.0)` comment in
`scripts/start-isolated-test-relay.sh` (the pre-commit secret scanner
flags that file's pre-existing dev-only `DATABASE_URL` whenever it is
staged).

### Related issue
Fixes #8074

### Testing
All under rustc/clippy 1.98.1 on a macOS 27 host (Darwin 27.0.0,
aarch64), with no `RUSTFLAGS` / `SDKROOT` / strip overrides in the
environment:

- `cargo build --release -p buzz-db` (the #8074 repro: the release
profile strips the proc-macro dylib): **builds**. The resulting
`libsqlx_macros-*.dylib` (14 MB) has `LC_SYMTAB stroff % 8 == 0` per
`otool -l`. The same build on 1.95.0 died with `mis-aligned LINKEDIT
string pool`.
- `just clippy` (workspace, `-D warnings`) and `cargo fmt --check`
(workspace and `desktop/src-tauri`): pass
- `just desktop-tauri-clippy` (default and `mesh-llm` feature sets):
pass
- `just test-unit`: every crate passes. The `buzz-acp` binary failed
only under pre-push lane contention; rerun solo it is 1060 passed, 0
failed.
- `just desktop-tauri-test`: 3422 passed, 0 failed
- After the lint fixes: lib/bin unit tests for `buzz-acp`, `buzz-agent`,
`buzz-auth`, `buzz-media`, `buzz-voice`, `buzz-sdk`, `buzz-pairing-cli`,
and `buzz-relay`'s `api::git::transport` tests, including the
Postgres-backed
`enforce_mode_git_pack_routes_missing_assertion_exact_bytes`, which
parses the rewritten PEM: pass

`cfg(windows)` code was not linted locally (no Windows target
installed). CI's Windows Rust job runs workspace clippy for
`x86_64-pc-windows-msvc`, and that passes on this branch. CI also builds
the relay, push-gateway and sprig images on the new `rust:1.98` bases
for amd64 and arm64.

No runtime behavior changes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Matt Toohey <[email protected]>
Co-authored-by: Claude Fable 5.1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stripping debuginfo on macOS produces misaligned dylibs

3 participants