-
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
rustc crashing over illegal instruction #14441
Comments
It's dying in LLVM, there's nothing we can really do about it on our side. However, LLVM's build system shouldn't be generating SSE instructions on 32-bit... |
I can't reproduce this. Is it still an issue? Rust generates code for the baseline architecture by default. |
I can reproduce this on an old Pentium 3 box - in my case the latest nightly, the latest release (0.12.0), the latest stage0 snapshot ( An old stage0 snapshot ( |
Last stage0 snapshot that works: AFAICT, these correspond to the following builds respectively: Using GCC 4.9.1 and the (last working) stage0 snapshot from
Looks like we currently need a bleeding-edge stage0 |
Related Issue: #24668 |
If a working stable snapshot were provided this once it should be enough to compile the next stable and so on. So unless it's not technically possible, please provide a baseline x86 version for all the nostalgic people or anyone who still likes to use their old hardware. EDIT: In retrospect, here's a few generic i686 (pentiumpro) stage0 snapshots: https://www.dropbox.com/s/a2txw5iafxyz2eo/stage0-i686_generic-2015-08-11.tar.bz2?dl=0 |
After all this time it can be made to work after all, hooray! My i686 build that should work on any PII class processor: https://www.dropbox.com/s/1sguenpkvjmg6z2/rust-1.3.0-i686_generic-linux.tar.bz2?dl=0 or the 1.5.0 nightly from Oct, 02: https://www.dropbox.com/s/7zl2whf1t9mbhh1/rust-1.5.0-i686_generic_linux.tar.bz2?dl=0 |
It looks like in rust the base CPU for i686 is intentionally set to “pentium4” so that LLVM can generate SIMD instructions. This was originally justified citing the example of Clang. Although it is true that Clang uses pentium4 by default when generating code for the x86 architecture, it does not do it when the target is
Would this be an acceptable solution? FWIW, when currently when we compile for
|
Yes, you've repeated the well established facts (by now). I don't think there's much chance changing this policy so it's probably going to be up to the distros to offer a true i686 build. |
@petevine why do you think that? I'm the one who changed it to pentium4. I think it should be changed to something more reasonable, if pentium4 wasn't the right choice (and it looks like it wasn't: my bad). |
I spent some time and energy discussing that issue and that's what the conclusions were. The choice is not bad at all but rather the inability to easily work around it. Even a simple suggestion of turning the stage0 snapshot into a more compliant version got ignored too, so I'm not interested in further discussing the matter. |
@petevine Sorry, I did not find the relevant discussion. Can you link it so that I can see what objections were raised against the two solutions I suggested? |
If you google reddit, rust users/internals and SSE2 you should get there. In short, re the first point - won't work as you need compatible rlibs too. Once I've demonstrated the obverse is doable (down to i586) and posted stage0 snapshots however, the last dozen interested people should be set. It's probably too niche of a use case to expect more from the official binary distribution. |
Oh, and I had no idea this issue (unlike the other two) was still open. |
I found some threads about the topic, but none which put forth an analysis and comparison with Clang, nor any that proposed an actual solution. I was unable to find any PR or issue in this repository, so I opened #31110 which implements the first solution I proposed. NB: the first solution works just fine, as the ABI does not change no matter what CPU you are targeting.
If the compiler and libraries were compiled for plain i686 (not pentium4), they would work on any i686 processor. If somebody needs some specific instructions (examples: SIMD, POPCNT, AES), it would be sufficient for them to compile their crates with appropriate options to enable those features. This can be done either by changing the target CPU ( |
No kidding? The messiah comes two years late! ABI is not the issue here, don't muddy the waters. In the last part you've just confirmed two separate binary distributions would be necessary to not handicap |
@petevine I might be misjudging your comments, but they feel somewhat aggressive. I do not understand your comment about SSE2 machines being handicapped by a plain |
You don't understand the details of how the rust binaries are created by the compiler, period. And now you're even mixing in |
Moderator Note @petevine If there was any ambiguity before as to whether your comments are "somewhat aggressive", there certainly is not any such ambiguity now. I ask you to please review the Code of Conduct for the project: https://www.rust-lang.org/conduct.html In particular the third bullet, "Please be kind and courteous. There's no need to be mean or rude." The sort of commenting style you are using here may be acceptable in other projects, but in general I don't want people reading these threads to be turned away from the project. If you do not understand the moderation feedback you are receiving, please feel free to email the moderators at [email protected] to request elaboration or clarification. |
@pnkfelix You're making too much of it, I wasn't mean or rude. Nevertheless, I feel offended by this whole affair of some random person coming in and changing everything back even though it wasn't bloody possible back in April, when I actually wanted to use Rust on a machine like that, or the OP close to two years ago! So yeah, I feel turned away already. What do the rules say about getting banned altogether? |
We have an i586-unknown-linux-gnu target now for compiling code without SSE enabled, we're just not producing rustc nightlies for it. This is essentially status quo for other tier 3 targets, so I'm going to close this for now. |
@alexcrichton: Will there be regular releases or at least a |
@rmathew we're regularly releasing a standard library for i586-unknown-linux-gnu but we aren't currently releasing a snapshot for that target. That means that you can compile code to run on an i586 machine but you can't run the compiler itself unless you compile it yourself from another machine. |
On an x86-64 machine, I compiled the released 1.8.0 version like so:
and the binary thus built still crashes with a SIGILL on a P3 box. :-( |
@rmathew could you try and get a stack trace to see where the bad instruction is happening? We may not be handling C++ code correctly. I forget if we had build system support in 1.8.0 as well, it may have come later. |
|
@rmathew out of curiosity, can you use the i586-unknown-linux-gnu nightlies that we're producing to run a hello world? Also, are you sure that you're running the i586 compiler instead of the i686 one by accident? |
@alexcrichton there's some amount of crosstalk in this thread, but just to be clear: can you confirm that we are supposed to be using the "Canadian cross compiler" interpretation of the build/host/target flags to I believe you said as much here: https://www.reddit.com/r/rust/comments/4azl1p/crossbootstrapping_a_rust_compiler_for_i586/d14usne But I figured it would be good to confirm explicitly, especially including the term "Canadian cross" so that others can google what that means with respect to GNU configure scripts, at least for gcc |
(Ah, I did look around and rediscovered a statement from @graydon ( #2302 (comment) ) that the project originally deliberately opted not to support Canadian cross. Not sure what that entails with respect to how the |
@rmathew One more thing - the LLVM issue linked in that thread pertaining to your P3 has been fixed here so be sure to apply the patch. Or you can try my not so old i686 build out. |
@pnkfelix yeah you shouldn't need a form of canadian cross for rustc itself because all compilers can emit code for all targets. In that sense all you need to do is ensure that the compiler can run on your target host, in this case That is, the following should suffice:
(that was all typed from memory so ther emay be typos) |
rustc killed by SIGILL. It is caused by a mfence instruction that belongs to the SSE2 instruction set. Sadly, my 10-year-old CPU does not support SSE2.
The text was updated successfully, but these errors were encountered: