-
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
i586-unknown-linux-gnu target generates binaries containing Intel CET opcodes which are illegal on i586 processors #93059
Comments
you may want to look here #82435, it's not exactly the same issue but some informations may be relevant to you |
I was just a little surprised over this considering the vendoring for i586 puts -march=pentium into the mix of cflags. I'm going to try adding -fcf-protection=none to the cflags and see what happens. I didn't think rust actually supported CET opcodes yet considering the ticket is still open. |
Adding -fcf-protection=none to my compilation flags did indeed work. This K6-2/500 system can now compile rust projects ~520 times slower than my Threadripper 1950X desktop XD
|
I'm curious to know where the apparently-default
🐢 |
I used the i386/ubuntu:20.04 docker container to do the build in order to isolate Rust from my host environment (presumably). (rustbuild is just a snapshot of the container I made with all of the required build tooling installed)
|
in gentoo we do some stuff with -fcf-protection but certainly not for gcc version used here and not for i586 and not by default, it's an opt-in thing. but we'll double check on our side. |
I didn't bump into any other packages having problems with -fcf-protection in the whole build. They only ended up in rust and things compiled by rust. I was curious if LLVM might be silently enabling it by default because Intel explicitly chose opcodes that were NOPs on older CPUs (well, as old as i686 anyways). |
yeah I checked specs and we don't even enable it on x86 at all, only x86_64 and only if USE=cet. |
while building for i586 targets we need to explicitly opt out of cet in internal llvm build. we don't even support bootstrapping this target right now as there is no self-hosting version, but may support in the future via our own tarball. Bug: https://bugs.gentoo.org/741708 Issue: rust-lang/rust#93059 Signed-off-by: Georgy Yakovlev <[email protected]>
As the title says, I generated an i586 rust toolchain by doing the following:
However, after installing the toolchain, attempting to run any of the rust tooling throws an illegal instruction exception.
Running rustc under gdb and looking at the failing instruction shows that the binary contains the "endbr32" instruction, which is part of the Intel CET instruction set on Tiger Lake CPUs. These decode as "NOP" on i686 processors and x86_64 CPUs, but they are illegal opcodes for i586 processors. While I recognize that this processor is ancient, there is still one i586 processor series in production - the Vortex86. For any current Linux distros which still support i586, polkit depends on spidermonkey, which is partially written in rust.
Meta
rustc --version --verbose
: (from a chroot on an x86_64 desktop)The text was updated successfully, but these errors were encountered: