-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Add help for target CPUs, features, relocation and code models. #34845
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Aatch (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
@@ -1,6 +1,6 @@ | |||
[submodule "src/llvm"] | |||
path = src/llvm | |||
url = https://github.com/rust-lang/llvm.git | |||
url = https://github.com/bitshifter/llvm.git |
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.
Needs to be updated once llvm PR is accepted.
It looks like the travis build didn't get my llvm branch - https://travis-ci.org/rust-lang/rust/builds/145171124#L1179 |
I'm a bit stumped at this point why the travis build is failing due to my llvm change not being there. My last commit 87ed467 is pointing the llvm git submodule at rust-lang/llvm@a3c12a7 which looks right. Can anyone else see what's going wrong here? |
@bitshifter oh travis doesn't actually use the LLVM submodule b/c it takes too long to build, but it brings up an important point that we'd still want builds with external LLVM to continue to work. Perhaps the LLVM support here can be disabled if |
@alexcrichton Ah I see, I'll look into it. |
@alexcrichton is there any way of determining if Alternatively I could add a temporary #define to MCSubtargetInfo.h in the rust-lllvm branch that I can check. Even if this patch makes it into LLVM, some kind of preprocessor check for it's existence will be necessary until it makes it into a release and Rust upgrades to that release. |
Remove duplication code gen options and updated help to reflect changes.
If using system llvm don't try use modifications made in the fork.
Got past the compile error, now there is a segfault running the test. I noticed a similar segfault on another recent commit (https://travis-ci.org/rust-lang/rust/builds/146766819 - which I don't think I have) so perhaps it's unrelated to my changes? edit: running |
I updated the title, since "fixes this other issue" isn't very informative. |
@bitshifter Right now I don't think there's a define for that but you can check for |
@alexcrichton thanks, I've added |
@bitshifter yeah you'll want to tweak this build script. The |
⌛ Testing commit fc210a8 with merge 58bdec2... |
@bors retry force clean |
⌛ Testing commit fc210a8 with merge 8d2f6ea... |
💔 Test failed - auto-linux-64-cargotest |
☔ The latest upstream changes (presumably #34743) made this pull request unmergeable. Please resolve the merge conflicts. |
I'm on vacation at the moment, I'll take a look later in the week. |
@alexcrichton I've had a little look into why the @bors homu build failed. On the homu build there was no CMake build of LLVM in the logs. So I assume that it is using an old version. I think part of the CMake build copies headers from src/llvm/include to build/x86_64-unknown-linux-gnu/llvm/include - probably a make install step. I think this is not picking up that LLVM has changed and needs to bu rebuilt. I've had this happen a bit on my local machine and have just been cleaning to fix it but I guess a better solution is required. Are you familiar with this part of the build at all? I'm not sure how to force LLVM to pick up that it needs to rebuild (perhaps when the git revision changes). I'm also addressing the new conflicts and will submit a new PR for rust-lang/llvm shortly. Edit: It looks like I need to edit src/rustllvm/llvm-auto-clean-trigger to fix the bors problem. |
@@ -1,4 +1,4 @@ | |||
# If this file is modified, then llvm will be forcibly cleaned and then rebuilt. | |||
# The actual contents of this file do not matter, but to trigger a change on the | |||
# build bots then the contents should be changed so git updates the mtime. | |||
2016-07-25b | |||
2016-07-25c |
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.
Oh you can actually just change this to today's date, the b
was just because it was modified twice in the same day
Looks and sounds good to me, thanks for the investigation! |
@@ -198,6 +198,10 @@ pub fn rustc<'a>(build: &'a Build, target: &str, compiler: &Compiler<'a>) { | |||
if !build.unstable_features { | |||
cargo.env("CFG_DISABLE_UNSTABLE_FEATURES", "1"); | |||
} | |||
// Flag that rust llvm is in use | |||
if build.config.target_config.get(target).is_none() { |
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.
I think that this needs to check the llvm-config
field in the returned table, as this is currently checking if there is any configuration at all for the 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.
The strange thing is that there seems to be no target returned at this point if --llvm-root has not been specified. If --llvm-root is specified then there is a target and it has an llvm_config set. I could make this code check for no target or a target with no llvm_config, but it seems like maybe there being no target is unexpected?
How do you usually debug this? For now I've just been printf debugging with println! or panic! calls.
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 logic for parsing ./configure
's --llvm-root
option lives here so it only sets it for one target but it should be there?
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.
Looking a bit closer, there are a bunch of code paths that lazily insert a default target into the target_config HashMap but none are being hit it this particular case, e.g. the code you linked to:
let target = self.target_config.entry(self.build.clone())
.or_insert(Target::default());
At the point I'm performing the check, nothing has done this although it could be created if other config.mk variables that lazily insert a target are in use.
In any case as you pointed out, the current code won't work correctly if target does exist, I'll look into a fix tonight.
@bitshifter thanks! Could you also squash the commits? |
@alexcrichton Sure! How do I squash the commits? :) Make a new branch, merge into it and make a new PR? |
Oh sure, no problem! You shouldn't have to make a new PR, I think these instructions should suffice? |
Oh, I thought it wasn't a good idea to rebase things that have been pushed already? From linked article:
|
Yeah for us that's fine as we define "sharing with others" as published to the |
Point llvm @bitshifter branch until PR accepted Use today's date for LLVM auto clean trigger Update LLVM submodule to point at rust-lang fork. Handle case when target is set
704eb0c
to
05045da
Compare
I think I've fixed up the target I squashed the last 5 commits, since I last merged with master. I'm not sure if I should try and squash the other commits, since they're intermingled with merges. |
Add help for target CPUs, features, relocation and code models. Fix for #30961. Requires PR rust-lang/llvm#45 to be accepted first, and the .gitmodules for llvm to be updated before this can be merged.
Fix for #30961. Requires PR rust-lang/llvm#45 to be accepted first, and the .gitmodules for llvm to be updated before this can be merged.