Repository navigation
bootstrap: add an rpath to libLLVM for the distributed rust-objcopy - #164064
Closed
danieljhkim wants to merge 1 commit into
Closed
danieljhkim wants to merge 1 commit into
danieljhkim wants to merge 1 commit into
Conversation
Collaborator
|
This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp. |
Collaborator
|
Thanks for the pull request, and welcome! The Rust Project has assigned @clubby789 (or someone else) to review your changes, you should hear from them (or someone else) within the next two weeks. Please see the contribution instructions and our LLM policy for more information. Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
danieljhkim
force-pushed
the
fix-rust-objcopy-rpath
branch
from
October 10, 2026 00:30
b268d76 to
7cab71b
Compare
This comment has been minimized.
This comment has been minimized.
`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` on the LLVM tools themselves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
danieljhkim
force-pushed
the
fix-rust-objcopy-rpath
branch
from
October 10, 2026 00:32
7cab71b to
d1b7a1e
Compare
Contributor
|
Per our LLM policy, LLMs must not be used to create code, comments and PRs without prior agreement. You can join the LLM mentoring Zulip channel if you want to pre-arrange a reviewer for an LLM-written PR, or write the changes yourself and open a new PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #164063.
rust-objcopyis a renamed copy ofllvm-objcopy, shipped in therustccomponent atlib/rustlib/$host/bin/. When LLVM is linked dynamically, the copy keeps LLVM's default rpath,$ORIGIN/../lib(@loader_path/../libon darwin). That resolves tolib/rustlib/$host/lib/, but therustccomponent shipslibLLVMonly inlib/. Sorust-objcopyfails to load unless rustup'sLD_LIBRARY_PATH/DYLD_FALLBACK_LIBRARY_PATHoverride is in effect or thellvm-toolscomponent is installed. rustc runs it to strip debuginfo, and it reports a failed strip only as a warning, so release binaries silently keep their debuginfo.#163954 fixed the same problem for
rust-lldinLld::run.rust-objcopyis built by theLlvmstep instead, so that fix doesn't reach it. This PR adds the same rpath entry,$ORIGIN/../../../on Linux and@loader_path/../../../on darwin, to the executable linker flags of the main LLVM build, behind the samerpath_enabled/use_host_linkerguards. The extra entry only adds a search path for the other LLVM tools: inllvm-tools, those still resolve throughrustlib/$host/lib.Observed on 1.98.1 outside rustup's overrides:
Library not loaded: @rpath/libLLVM.dylib(SIGABRT). This is a regression since Link LLVM dynamically on aarch64-apple-darwin #157205.libLLVM.so.22.1-rust-1.98.1-stable: cannot open shared object file. The same$ORIGIN/../lib-only runpath is present back to at least 1.89.Testing
cargo checkof bootstrap andrustfmt --checkpass.rust-objcopyexits with SIGABRT as shipped, and works afterinstall_name_tool -add_rpath @loader_path/../../../and an ad-hoc re-sign../x distlocally. Like fix(bootstrap/darwin): fix rpath for distributed LLD #163954, there doesn't seem to be a dist test that covers this, so CI artifacts are the real check.The
download-ci-llvm-stampis bumped because CI LLVM artifacts change.cc @rami3l @sgasho
Disclosure: the diagnosis, patch and description were produced with an LLM (Claude). I reviewed them and checked the observations above on my own machines.
🤖 Generated with Claude Code