-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Reland optimized-compiler-builtins
config
#102579
Conversation
This comment has been minimized.
This comment has been minimized.
fbb4c86
to
37c21a3
Compare
src/bootstrap/lib.rs
Outdated
fn is_rust_llvm(&self, target: TargetSelection) -> bool { | ||
match self.config.target_config.get(&target) { | ||
// We're using a pre-built version of LLVM, but the user has promised that pre-built version has our patches. |
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.
We may not be using a pre-built version of LLVM. Specifically the use case I want to support is cd into src/llvm-project
, check out a vanilla commit, and set submodules = false
, llvm-has-rust-patches = false
in config.
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.
That seems totally bizarre, though. Why would you want that?
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.
To build against a more recent version of LLVM.
If you separately build and supply your own llvm-config, then you hit the other assumptions in here about not needing to distribute the LLVM libraries because it's probably system installed. So basically this was unsupported before.
Plus it's desirable to have bootstrap manage the configuration of LLVM if all you want to vary is the version.
src/bootstrap/compile.rs
Outdated
@@ -313,12 +313,17 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car | |||
let compiler_builtins_c_feature = if builder.config.optimized_compiler_builtins { | |||
if !builder.is_rust_llvm(target) { |
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.
You can use compiler-rt
without Rust patches. I think the important thing is that compiler-rt
is built from the same sources as LLVM. So.. either llvm-config
is unset, or llvm_from_ci is active and we're managing submodules?
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.
Yeah, as I wrote in #101833 (comment) enabling optimized_compiler_builtins
is kinda required on some targets, and from my understanding the only requirement is that the sources of compiler-rt
has to be the same as the custom LLVM's. We probably need a way to supply the custom sources in those cases.
@rustbot author |
…iltins, r=jyn514 Revert "Make the `c` feature for `compiler-builtins` opt-in instead of inferred" This reverts commit 3acb505 (PR rust-lang#101833). The changes in this commit caused several bugs/incompatibilities (rust-lang#101833 (comment), rust-lang#102560). For now we're reverting this commit and will re-land it alongside fixes for those bugs. Re-opens rust-lang#101172 cc rust-lang#102560 cc rust-lang#102579
☔ The latest upstream changes (presumably #103797) made this pull request unmergeable. Please resolve the merge conflicts. |
@tmandry I am still very confused how
3 defines LLVM_RUSTLLVM, which is eventually used in rust/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp Lines 308 to 311 in 693c631
--system-llvm for an in-tree commit with submodules = false and patches = false . How is llvm_has_rust_patches tested? how is it supposed to work? I ran llvm-config --ldflags --system-llvm locally and it didn't even exit successfully ...
|
37c21a3
to
7945458
Compare
ugh I misread, it's a compiletest flag, not an llvm-config flag. so I think what was happening before is that some tests were silently being ignored, which we don't have any sort of checks for: rust/src/tools/compiletest/src/header.rs Lines 1059 to 1061 in d5fd1af
I'll fix 1 at the same time as I address your and pietro's comments. |
This comment has been minimized.
This comment has been minimized.
50baed3
to
a8b210d
Compare
Ok, pushed a few changes. @pietroalbini @tmandry let me know if you think this will work better. |
@rustbot author (I think there are some outstanding concerns from Pietro to be addressed) |
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.
Looks good, thanks for checking! I left some nits, feel free to fix or ignore and r=me
☔ The latest upstream changes (presumably #114148) made this pull request unmergeable. Please resolve the merge conflicts. |
38392fb
to
eb945e2
Compare
This PR modifies If appropriate, please update This PR modifies If appropriate, please update |
This comment has been minimized.
This comment has been minimized.
i am going to remove the check that the in-tree llvm matches the llvm we're linking to, actually. i am not sure the difference matters, and it wasn't enforced before. |
in particular, this makes the `c` feature for compiler-builtins an explicit opt-in, rather than silently detected by whether `llvm-project` is checked out on disk. exposing this is necessary because the `cc` crate doesn't support cross-compiling to MSVC, and we want people to be able to run `x check --target foo` regardless of whether they have a c toolchain available. this also uses the new option in CI, where we *do* want to optimize compiler_builtins. the new option is off by default for the `dev` channel and on otherwise.
eb945e2
to
a10b1be
Compare
r? bootstrap |
@rustbot ready |
☔ The latest upstream changes (presumably #119373) made this pull request unmergeable. Please resolve the merge conflicts. |
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.
No concerns on my side. Currently, Jyn isn't actively working on the project. I will close this PR; open another one to cherry-pick the commits, resolve conflicts, and then r+ it.
…tins, r=onur-ozkan Reland optimized-compiler-builtins config Copy of rust-lang#102579 PR. From rust-lang#102579: > No concerns on my side. Currently, Jyn isn't actively working on the project. I will close this PR; open another one to cherry-pick the commits, resolve conflicts, and then r+ it. > Fixes rust-lang#102560. Fixes rust-lang#101172. Helps with rust-lang#105065 (although there's some weirdness there - it's still broken when optimized-compiler-builtins is set to true). Fixes rust-lang#102560. Fixes rust-lang#101172. Helps with rust-lang#105065 r? ghost
…ns, r=onur-ozkan Reland optimized-compiler-builtins config Copy of rust-lang#102579 PR. From rust-lang#102579: > No concerns on my side. Currently, Jyn isn't actively working on the project. I will close this PR; open another one to cherry-pick the commits, resolve conflicts, and then r+ it. > Fixes rust-lang#102560. Fixes rust-lang#101172. Helps with rust-lang#105065 (although there's some weirdness there - it's still broken when optimized-compiler-builtins is set to true). Fixes rust-lang#102560. Fixes rust-lang#101172. Helps with rust-lang#105065 r? ghost
this is possible now that compiler-builtins contains the fix in rust-lang/compiler-builtins#532.
in particular, this makes the
c
feature for compiler-builtins an explicit opt-in, rather than silently detected by whetherllvm-project
is checked out on disk.exposing this is necessary because the
cc
crate doesn't support cross-compiling to MSVC, and we want people to be able to runx check --target foo
regardless of whether they have a c toolchain available.this also uses the new option in CI, where we do want to optimize compiler_builtins.
the new option is off by default for the
dev
channel and on otherwise.Fixes #102560. Fixes #101172. Helps with #105065 (although there's some weirdness there - it's still broken when
optimized-compiler-builtins
is set totrue
).r? @tmandry cc @Mark-Simulacrum