Skip to content

fix(bootstrap/darwin): fix rpath for distributed LLD - #163954

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
rami3l:fix/bootstrap-darwin-lld
Oct 9, 2026
Merged

rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
rami3l:fix/bootstrap-darwin-lld

Conversation

@rami3l

@rami3l rami3l commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Closes #163947 by mirroring the existing rpath tweak for linux on darwin.

Concerns

  • Is there an easy way to reliably test the effect of this fix (there doesn't seem to be dist tests for darwin in particular)? I'd love to add one if possible.

@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 7, 2026
@rami3l
rami3l force-pushed the fix/bootstrap-darwin-lld branch from c260a22 to 271295a Compare October 7, 2026 17:05
@rustbot rustbot added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Oct 7, 2026
@rami3l

rami3l commented Oct 8, 2026 •

Copy link
Copy Markdown
Member Author

Verification

Verified manually via the following sequence:

Before

> otool -l build/aarch64-apple-darwin/stage2/lib/rustlib/aarch64-apple-darwin/bin/rust-lld | 'grep' -A3 LC_RPATH
          cmd LC_RPATH
      cmdsize 32
         path @loader_path/../lib (offset 12)
Load command 18
          cmd LC_RPATH
      cmdsize 80
         path /Users/runner/work/rust/rust/build/aarch64-apple-darwin/llvm/lib (offset 12)
Load command 19
> ls -lh build/host/stage2/lib/libLLVM.dylib
-rw-r--r--  7 rami3l  staff   137M Oct  3 22:27 build/host/stage2/lib/libLLVM.dylib

After

> ./x.py build --stage 2 compiler/rustc
[..]
> otool -l build/aarch64-apple-darwin/stage2/lib/rustlib/aarch64-apple-darwin/bin/rust-lld | 'grep' -A3 LC_RPATH
          cmd LC_RPATH
      cmdsize 40
         path @loader_path/../../../ (offset 12)
Load command 19
          cmd LC_RPATH
      cmdsize 32
         path @loader_path/../lib (offset 12)
Load command 20
          cmd LC_RPATH
      cmdsize 88
         path [local]/rust/build/aarch64-apple-darwin/llvm/lib (offset 12)
Load command 21

As such, I think this PR can be considered ready for review.

For the possibility of writing a regression test about it, I consulted @Kobzol and his conclusion was that that may be too much for this small fix.

@rami3l
rami3l marked this pull request as ready for review October 8, 2026 13:22
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 8, 2026
@rustbot

rustbot commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp.

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Oct 8, 2026
@rustbot

rustbot commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

r? @clubby789

rustbot has assigned @clubby789.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: bootstrap
  • bootstrap expanded to 6 candidates
  • Random selection from Mark-Simulacrum, clubby789

@rami3l

rami3l commented Oct 8, 2026

Copy link
Copy Markdown
Member Author

r? @Kobzol for maximal context retention from #163947.

@rustbot rustbot assigned Kobzol and unassigned clubby789 Oct 8, 2026
@rustbot

rustbot commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

Kobzol is not on the review rotation at the moment.
They may take a while to respond.

@Kobzol

Kobzol commented Oct 8, 2026

Copy link
Copy Markdown
Member

@bors r+

@rust-bors

rust-bors Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 7b151cf has been approved by Kobzol

It is now in the queue for this repository.

@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 Oct 8, 2026
@jieyouxu

jieyouxu commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

We'll almost certainly have a stable point release this cycle (#163917), so we should backport this too IMO. Thanks @rami3l for the fix.
@rustbot label: +stable-nominated +beta-nominated

@rustbot rustbot added beta-nominated Nominated for backporting to the compiler in the beta channel. stable-nominated Nominated for backporting to the compiler in the stable channel. labels Oct 9, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 9, 2026
…=Kobzol

fix(bootstrap/darwin): fix rpath for distributed LLD

Closes rust-lang#163947 by mirroring the existing rpath tweak for linux on darwin.

## Concerns

- [ ] Is there an easy way to reliably test the effect of this fix (there doesn't seem to be dist tests for darwin in particular)? I'd love to add one if possible.
rust-bors Bot pushed a commit that referenced this pull request Oct 9, 2026
…uwer

Rollup of 7 pull requests

Successful merges:

 - #162652 (Syntactically reject leading parenthesized precise capturing lists in bare trait object types (`(use<…>)+`))
 - #163337 (MIR move elimination [3/6]: PreciseLiveness)
 - #163954 (fix(bootstrap/darwin): fix rpath for distributed LLD)
 - #163956 (Pass the unremapped path to the `rustc` invocation for doctests)
 - #163634 (move overflow lint computation into decorator)
 - #163727 (rigid aliases to non-rigid for fully normalized check)
 - #163745 (replace `fully_monomorphized` with `cx.typing_env()`)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 9, 2026
…=Kobzol

fix(bootstrap/darwin): fix rpath for distributed LLD

Closes rust-lang#163947 by mirroring the existing rpath tweak for linux on darwin.

## Concerns

- [ ] Is there an easy way to reliably test the effect of this fix (there doesn't seem to be dist tests for darwin in particular)? I'd love to add one if possible.
rust-bors Bot pushed a commit that referenced this pull request Oct 9, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - #162652 (Syntactically reject leading parenthesized precise capturing lists in bare trait object types (`(use<…>)+`))
 - #163337 (MIR move elimination [3/6]: PreciseLiveness)
 - #163954 (fix(bootstrap/darwin): fix rpath for distributed LLD)
 - #163956 (Pass the unremapped path to the `rustc` invocation for doctests)
 - #163634 (move overflow lint computation into decorator)
 - #163666 (Updates the expect message library/core/src/time.rs)
 - #163727 (rigid aliases to non-rigid for fully normalized check)
 - #163745 (replace `fully_monomorphized` with `cx.typing_env()`)
 - #164000 (When mentioning that closure doesn't implement trait, point at closure)
 - #164007 ([rustdoc] Prefer local paths over remote ones when foreign item is locally reexported)
 - #164017 (cg_llvm: Avoid some explicit casts to `*const c_char`)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 9, 2026
…=Kobzol

fix(bootstrap/darwin): fix rpath for distributed LLD

Closes rust-lang#163947 by mirroring the existing rpath tweak for linux on darwin.

## Concerns

- [ ] Is there an easy way to reliably test the effect of this fix (there doesn't seem to be dist tests for darwin in particular)? I'd love to add one if possible.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 9, 2026
…=Kobzol

fix(bootstrap/darwin): fix rpath for distributed LLD

Closes rust-lang#163947 by mirroring the existing rpath tweak for linux on darwin.

## Concerns

- [ ] Is there an easy way to reliably test the effect of this fix (there doesn't seem to be dist tests for darwin in particular)? I'd love to add one if possible.
rust-bors Bot pushed a commit that referenced this pull request Oct 9, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - #162652 (Syntactically reject leading parenthesized precise capturing lists in bare trait object types (`(use<…>)+`))
 - #163337 (MIR move elimination [3/6]: PreciseLiveness)
 - #163954 (fix(bootstrap/darwin): fix rpath for distributed LLD)
 - #163193 (cfi: mangle `f128` as `e` rather than `g` on platforms without `_Float128`)
 - #163634 (move overflow lint computation into decorator)
 - #163666 (Updates the expect message library/core/src/time.rs)
 - #163727 (rigid aliases to non-rigid for fully normalized check)
 - #163745 (replace `fully_monomorphized` with `cx.typing_env()`)
 - #163912 (Fix debug assert failure in `note_obligation_cause_code_inner`)
 - #163972 (const-eval: ICE when we hit a non-const fn)
 - #164000 (When mentioning that closure doesn't implement trait, point at closure)
 - #164007 ([rustdoc] Prefer local paths over remote ones when foreign item is locally reexported)
 - #164017 (cg_llvm: Avoid some explicit casts to `*const c_char`)
 - #164025 (Less `CanonicalVarValues`)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 9, 2026
…=Kobzol

fix(bootstrap/darwin): fix rpath for distributed LLD

Closes rust-lang#163947 by mirroring the existing rpath tweak for linux on darwin.

## Concerns

- [ ] Is there an easy way to reliably test the effect of this fix (there doesn't seem to be dist tests for darwin in particular)? I'd love to add one if possible.
rust-bors Bot pushed a commit that referenced this pull request Oct 9, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - #162652 (Syntactically reject leading parenthesized precise capturing lists in bare trait object types (`(use<…>)+`))
 - #163337 (MIR move elimination [3/6]: PreciseLiveness)
 - #163954 (fix(bootstrap/darwin): fix rpath for distributed LLD)
 - #163193 (cfi: mangle `f128` as `e` rather than `g` on platforms without `_Float128`)
 - #163634 (move overflow lint computation into decorator)
 - #163666 (Updates the expect message library/core/src/time.rs)
 - #163727 (rigid aliases to non-rigid for fully normalized check)
 - #163745 (replace `fully_monomorphized` with `cx.typing_env()`)
 - #163912 (Fix debug assert failure in `note_obligation_cause_code_inner`)
 - #163950 (don't treat inherited opaques as defining)
 - #164000 (When mentioning that closure doesn't implement trait, point at closure)
 - #164007 ([rustdoc] Prefer local paths over remote ones when foreign item is locally reexported)
 - #164017 (cg_llvm: Avoid some explicit casts to `*const c_char`)
 - #164025 (Less `CanonicalVarValues`)
rust-bors Bot pushed a commit that referenced this pull request Oct 9, 2026
…uwer

Rollup of 24 pull requests

Successful merges:

 - #161998 ( Support type-relative assoc item paths in generic param defaults & const param types)
 - #162106 (Helpful suggestions for incorrect address-of mutability (2))
 - #162652 (Syntactically reject leading parenthesized precise capturing lists in bare trait object types (`(use<…>)+`))
 - #163337 (MIR move elimination [3/6]: PreciseLiveness)
 - #163938 (-Zassumptions-on-binders: rewrite alias outlives constraints more goodly)
 - #163939 (Better debug impls for some assumptions on binders types)
 - #163954 (fix(bootstrap/darwin): fix rpath for distributed LLD)
 - #163956 (Pass the unremapped path to the `rustc` invocation for doctests)
 - #164042 (Allow testing cg-gcc on any target)
 - #162443 (Do not retain `Normalization` goal errors in nested goals for `BestObligationVisitor:: non_trivial_candidates `)
 - #162908 (Fix - const parameters rejected when identical)
 - #163193 (cfi: mangle `f128` as `e` rather than `g` on platforms without `_Float128`)
 - #163634 (move overflow lint computation into decorator)
 - #163666 (Updates the expect message library/core/src/time.rs)
 - #163727 (rigid aliases to non-rigid for fully normalized check)
 - #163745 (replace `fully_monomorphized` with `cx.typing_env()`)
 - #163912 (Fix debug assert failure in `note_obligation_cause_code_inner`)
 - #163950 (don't treat inherited opaques as defining)
 - #163972 (const-eval: ICE when we hit a non-const fn)
 - #164000 (When mentioning that closure doesn't implement trait, point at closure)
 - #164007 ([rustdoc] Prefer local paths over remote ones when foreign item is locally reexported)
 - #164008 (properly ignore the current goal's usages)
 - #164017 (cg_llvm: Avoid some explicit casts to `*const c_char`)
 - #164025 (Less `CanonicalVarValues`)
@rust-bors
rust-bors Bot merged commit bd1692d into rust-lang:main Oct 9, 2026
14 checks passed
@rustbot rustbot added this to the 1.101.0 milestone Oct 9, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 9, 2026
Rollup merge of #163954 - rami3l:fix/bootstrap-darwin-lld, r=Kobzol

fix(bootstrap/darwin): fix rpath for distributed LLD

Closes #163947 by mirroring the existing rpath tweak for linux on darwin.

## Concerns

- [ ] Is there an easy way to reliably test the effect of this fix (there doesn't seem to be dist tests for darwin in particular)? I'd love to add one if possible.
danieljhkim added a commit to danieljhkim/rust that referenced this pull request Oct 10, 2026
`rust-objcopy` is a renamed copy of `llvm-objcopy` shipped in the `rustc`
component at `lib/rustlib/$host/bin`. When LLVM is linked dynamically it
only carries LLVM's default `$ORIGIN/../lib` (`@loader_path/../lib` on
darwin) rpath, which does not reach the `libLLVM` shipped in `lib/`, so it
fails to load outside rustup's library path overrides.

Mirror the rpath entry `Lld::run` already adds for `rust-lld` (rust-lang#163954)
on the LLVM tools themselves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rami3l
rami3l deleted the fix/bootstrap-darwin-lld branch October 10, 2026 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beta-nominated Nominated for backporting to the compiler in the beta channel. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. stable-nominated Nominated for backporting to the compiler in the stable channel. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rust-lld on aarch64-apple-darwin cannot load libLLVM.dylib when the toolchain rustc is invoked directly (1.99.0, regression from 1.96.1)

5 participants