-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Allow linking a prebuilt optimized compiler-rt builtins library #143689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
pmur
wants to merge
1
commit into
rust-lang:master
Choose a base branch
from
pmur:murp/external-rt-optimized-compiler-builtins
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+83
−34
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -567,25 +567,29 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car | |
// `compiler-builtins` crate is enabled and it's configured to learn where | ||
// `compiler-rt` is located. | ||
let compiler_builtins_c_feature = if builder.config.optimized_compiler_builtins(target) { | ||
// NOTE: this interacts strangely with `llvm-has-rust-patches`. In that case, we enforce `submodules = false`, so this is a no-op. | ||
// But, the user could still decide to manually use an in-tree submodule. | ||
// | ||
// NOTE: if we're using system llvm, we'll end up building a version of `compiler-rt` that doesn't match the LLVM we're linking to. | ||
// That's probably ok? At least, the difference wasn't enforced before. There's a comment in | ||
// the compiler_builtins build script that makes me nervous, though: | ||
// https://github.com/rust-lang/compiler-builtins/blob/31ee4544dbe47903ce771270d6e3bea8654e9e50/build.rs#L575-L579 | ||
builder.require_submodule( | ||
"src/llvm-project", | ||
Some( | ||
"The `build.optimized-compiler-builtins` config option \ | ||
requires `compiler-rt` sources from LLVM.", | ||
), | ||
); | ||
let compiler_builtins_root = builder.src.join("src/llvm-project/compiler-rt"); | ||
assert!(compiler_builtins_root.exists()); | ||
// The path to `compiler-rt` is also used by `profiler_builtins` (above), | ||
// so if you're changing something here please also change that as appropriate. | ||
cargo.env("RUST_COMPILER_RT_ROOT", &compiler_builtins_root); | ||
if let Some(path) = builder.config.optimized_compiler_builtins_path(target) { | ||
cargo.env("LLVM_BUILTIN_RT_LIB", path); | ||
} else { | ||
// NOTE: this interacts strangely with `llvm-has-rust-patches`. In that case, we enforce `submodules = false`, so this is a no-op. | ||
// But, the user could still decide to manually use an in-tree submodule. | ||
// | ||
// NOTE: if we're using system llvm, we'll end up building a version of `compiler-rt` that doesn't match the LLVM we're linking to. | ||
// That's probably ok? At least, the difference wasn't enforced before. There's a comment in | ||
// the compiler_builtins build script that makes me nervous, though: | ||
// https://github.com/rust-lang/compiler-builtins/blob/31ee4544dbe47903ce771270d6e3bea8654e9e50/build.rs#L575-L579 | ||
Comment on lines
+573
to
+579
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: rewrap comments to 100 chars |
||
builder.require_submodule( | ||
"src/llvm-project", | ||
Some( | ||
"The `build.optimized-compiler-builtins` config option \ | ||
requires `compiler-rt` sources from LLVM.", | ||
), | ||
); | ||
let compiler_builtins_root = builder.src.join("src/llvm-project/compiler-rt"); | ||
assert!(compiler_builtins_root.exists()); | ||
// The path to `compiler-rt` is also used by `profiler_builtins` (above), | ||
// so if you're changing something here please also change that as appropriate. | ||
cargo.env("RUST_COMPILER_RT_ROOT", &compiler_builtins_root); | ||
} | ||
" compiler-builtins-c" | ||
} else { | ||
"" | ||
|
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe
LLVM_COMPILER_RT_LIB
to matchRUST_COMPILER_RT_ROOT
, and since this is probably linking the entire compiler-rt rather than just builtins. Also I believe the LLVM library is called "builtins" rather than "builtin"