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 维持停用,注释更正为已验证可随时恢复。
kixelated added a commit to moq-dev/moq that referenced this pull request Sep 22, 2026
Cargo passes `-C strip=debuginfo` by default in the release profile, and
below 1.98 rustc strips Mach-O with an llvm-objcopy that writes the symbol
string table straight after the 4-byte-per-entry indirect symbol table with
no padding. Whenever that table has an odd entry count the LINKEDIT string
pool lands 4-byte aligned, and macOS 27's dyld refuses to load the image:

    rustc 1.95 -> stroff=345252  stroff%8=4  (rejected)
    rustc 1.98 -> stroff=328880  stroff%8=0

Every release-profile proc macro is a coin flip, which is what breaks the
macOS OBS plugin build (rustc can't dlopen a derive macro), and so is every
cdylib we ship there: moq-ffi behind the Python/Kotlin/Dart bindings, and
the moq-gst plugin.

Fixed upstream in 1.98.0 by rust-lang/rust#158410, so the build toolchain
pin moves above the relay's 1.95 MSRV. The crates keep their own floors.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
kixelated added a commit to moq-dev/moq that referenced this pull request Sep 22, 2026
Cargo passes `-C strip=debuginfo` by default in the release profile, and
below 1.98 rustc strips Mach-O with an llvm-objcopy that writes the symbol
string table straight after the 4-byte-per-entry indirect symbol table with
no padding. Whenever that table has an odd entry count the LINKEDIT string
pool lands 4-byte aligned, and macOS 27's dyld refuses to load the image:

    rustc 1.95 -> stroff=345252  stroff%8=4  (rejected)
    rustc 1.98 -> stroff=328880  stroff%8=0

Every release-profile proc macro is a coin flip, which is what breaks the
macOS OBS plugin build (rustc can't dlopen a derive macro), and so is every
cdylib we ship there: moq-ffi behind the Python/Kotlin/Dart bindings, and
the moq-gst plugin.

Fixed upstream in 1.98.0 by rust-lang/rust#158410, so the build toolchain
pin moves above the relay's 1.95 MSRV. The crates keep their own floors.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
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
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