-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Support compiling rustc without LLVM (try 2) #42932
Conversation
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
cc @rust-lang/compiler |
src/bootstrap/config.toml.example
Outdated
@@ -14,6 +14,9 @@ | |||
# ============================================================================= | |||
[llvm] | |||
|
|||
# Indicates whether rustc will support compilation with LLVM (currently broken) |
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.
The comment seems to imply that the build with llvm is broken, not the build without it. Should be the other way round, right?
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.
Yes
☔ The latest upstream changes (presumably #43051) made this pull request unmergeable. Please resolve the merge conflicts. |
So llvm would just be a cargo feature of |
@oli-obk More or less, yes. |
friendly ping to keep this on your radar, @bjorn3! |
@eddyb is this a bit like you mean. If so I will work it out further in a few days. |
☔ The latest upstream changes (presumably #43059) made this pull request unmergeable. Please resolve the merge conflicts. |
ar = "0.3.0" | ||
|
||
[features] | ||
llvm = ["rustc_trans"] |
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.
Missing newline at the end of file.
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.
Fixed
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.
Now this looks much more streamlined!
@bjorn3 Ahh how I wish I had a way to un-dismiss github notifications... I keep losing track of some I've gone through on my phone 😞. @alexcrichton Thanks for the ping! |
4c5839c
to
7f191bc
Compare
Rebased |
@bjorn3 Can you squash the commits to remove the back-and-forth (X followed by revert X)? |
src/librustc_driver/lib.rs
Outdated
|
||
#[cfg(not(feature="llvm"))] | ||
impl MetadataLoader for NoLLvmMetadataLoader { | ||
fn get_rlib_metadata(&self, _: &Target, filename: &Path) -> Result<ErasedBoxRef<[u8]>, String> { |
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.
Was this copied wholesale from rustc_trans
? Does that mean ar::Archive
is independent of LLVM?
That could make rustc_metadata
target-agnostic in the non-dynamic-library case!
cc @alexcrichton @rkruppe
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.
The ar
crate is a rust only .a
reader and writer.
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.
Then it should be used directly by rustc_metadata
and get_rlib_metadata
shouldn't exist as a pluggable API (but rather the code live in rustc_metadata
) which means loader: Box<MetadataLoader>
in rustc_metadata
becomes just:
get_dylib_metadata: fn(&Target, &Path) -> Result<ErasedBoxRef<[u8]>, String>
When not available, one can just pass in |_, _| Err(String::from("unsupported"))
.
Squashed |
7b64996
to
47cd964
Compare
Doesn't fail locally (mac os) |
Hm so looking over this it looks like this is changing how we're reading rlib metadata? The current construction is done specifically for speed as LLVM's ar parsing/reading is much speedier than many other solutions. Are we sure the Also from a maintainability perspective, this seems like the kind of patch that'd bitrot almost instantly? Is there something we can do to avoid the |
@alexcrichton OH! Uhm, when I asked about it it sounded like we already moved away from using the LLVM support - but if that's not true, then the "Move rlib metadata reading code to rustc_metadata and replace MetadataLoader with a function pointer" commit was a mistake... |
Travis passes. |
@bjorn3 Please squash the original commits with the reverts. |
Squashed and travis passes |
@bors r+ |
📌 Commit e539996 has been approved by |
Support compiling rustc without LLVM (try 2) Now doesn't change rustc_driver. Supersedes #42752
☀️ Test successful - status-appveyor, status-travis |
@eddyb and @bjorn3 did y'all have no comments about the maintainability aspect above? Specifically:
|
@alexcrichton So I took a look at the diff to count them, remembering only 5-6... and now there's a lot more. And they're mostly in b7314c7 "Actually make rustc_driver compile without llvm". |
So that is definitely my fault, and if @alexcrichton wants this reverted then I'm on board. |
Im writing a pr to remove most of the cfg's. It will likely be ready tomorrow. |
Thanks @bjorn3! Feel free to cc or r? me on that |
Cleanup for "Support compiling rustc without LLVM (try 2)" This includes a small patch to allow running tests without llvm. Also check if you are not trying to compile a dylib. cc #42932 r? @alexcrichton
Now doesn't change rustc_driver.
Supersedes #42752