Skip to content

Backport #203680 and #205044#198

Merged
cuviper merged 2 commits into
rust-lang:rustc/22.1-2026-05-19from
goranmoomin:macho-linkedit-align-backport
Jun 24, 2026
Merged

Backport #203680 and #205044#198
cuviper merged 2 commits into
rust-lang:rustc/22.1-2026-05-19from
goranmoomin:macho-linkedit-align-backport

Conversation

@goranmoomin

Copy link
Copy Markdown

This is a backport of llvm#203680 and llvm#205044 to address rust-lang/rust#157750.

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

According to discourse.llvm.org/t/llvm-22-1-8-released/91084 22.1.8 is the last release expected in the 22.x branch.

All relevant LLVM PRs have been merged into main.

…203680)

Align Mach-O __LINKEDIT entries to the target pointer size when building
the tail layout. This matches the behavior of ld64 and lld-macho.

dyld on macOS 27 rejects loading dylibs with misaligned __LINKEDIT
entries.

See llvm#203678 for details and the motivation of this fix.

AI Tool Use Disclosure:

Regarding the PR and the linked issue, I have personally wrote every
single part of the PR by myself, and have/ran/verified every single part
of the issue report as well without any AI tool usage.

I have used LLM-based coding agents only for debugging purposes, e.g. to
figure out why the dylib was not loading (from the original bug report),
and figuring out how to build, run, and test my local `llvm-objcopy`.

(cherry picked from commit 18c1cbc)
…05044)

This is a follow-up of PR llvm#203680 that added the test case
`linkedit-alignment.test`, which currently fails on big-endian buildbots
(see: https://lab.llvm.org/buildbot/#/builders/98/builds/3084 and
https://lab.llvm.org/buildbot/#/builders/114/builds/906).

The failure seems to be on `yaml2obj`, where `writeDynamicSymbolTable`
emits an indirect symbol table in host byte order rather than the
specified object's byte order (i.e. the `IsLittleEndian` field value).

This PR adds the missing swap and a regression test that round-trips all
endian-sensitive fields with both endianness values.

(cherry picked from commit 6e56216)
@goranmoomin goranmoomin changed the title Backport #203680 and #205044 Backport llvm#203680 and llvm#205044 Jun 23, 2026
@goranmoomin goranmoomin changed the title Backport llvm#203680 and llvm#205044 Backport #203680 and #205044 Jun 23, 2026
@goranmoomin

Copy link
Copy Markdown
Author

Pinging @nikic on getting this backport merged! Sorry if this is noise.

@cuviper

cuviper commented Jun 24, 2026

Copy link
Copy Markdown
Member

LGTM, thanks!

@cuviper cuviper merged commit 3c3f130 into rust-lang:rustc/22.1-2026-05-19 Jun 24, 2026
5 checks passed
@goranmoomin goranmoomin deleted the macho-linkedit-align-backport branch June 25, 2026 03:13
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).
jhpratt added a commit to jhpratt/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-timer added a commit to rust-lang/rust 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).
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.

2 participants