-
Notifications
You must be signed in to change notification settings - Fork 130
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
cpufeatures: support freestanding/UEFI x86
targets
#821
cpufeatures: support freestanding/UEFI x86
targets
#821
Conversation
This fixes compilation of dependent crates for these targets. For example, `sha2`: Before: ``` $ cargo build --target x86_64-unknown-none --no-default-features Compiling sha2 v0.10.6 (/home/rvolosatovs/src/github.com/rustcrypto/hashes/sha2) LLVM ERROR: Do not know how to split the result of this operator! error: could not compile `sha2` $ cargo build --target x86_64-unknown-uefi --no-default-features Compiling sha2 v0.10.6 (/home/rvolosatovs/src/github.com/rustcrypto/hashes/sha2) LLVM ERROR: Do not know how to split the result of this operator! error: could not compile `sha2` ``` After: ``` $ cargo build --target x86_64-unknown-none --no-default-features Compiling cpufeatures v0.2.5 (/home/rvolosatovs/src/github.com/rustcrypto/utils/cpufeatures) Compiling sha2 v0.10.6 (/home/rvolosatovs/src/github.com/rustcrypto/hashes/sha2) Finished dev [optimized + debuginfo] target(s) in 0.19s $ cargo build --target x86_64-unknown-uefi --no-default-features Compiling cpufeatures v0.2.5 (/home/rvolosatovs/src/github.com/rustcrypto/utils/cpufeatures) Compiling sha2 v0.10.6 (/home/rvolosatovs/src/github.com/rustcrypto/hashes/sha2) Finished dev [optimized + debuginfo] target(s) in 0.19s ``` Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
This is required until RustCrypto/utils#821 is merged and `sha2` is updated to use it Signed-off-by: Roman Volosatovs <roman@profian.com>
I am not sure it's a correct approach. The problem is not with the CPUID instruction. Both The issue is caused by the SHA instructions. To me it looks like an LLVM issue. Have you tried to look into it? For now, you can use the |
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 yeah, interesting... for some reason I thought UEFI didn't have access to CPUID but that seems to be wrong and there are ample resources that describe calling CPUID from UEFI
Thanks, I'll look into LLVM issue |
It seems people are still hitting this, even with the I think we should really try to get a workaround for this added. We've had dozens of reports and it causes very confusing errors. |
I want to use this However, I got the error How I add this crate:
I already add
Target information in file
How I compile the project:
Do you know how to solve it? |
@yaoxin1995 in theory this PR will solve it. Perhaps you could test it out? Add the following to your Cargo.toml: [patch.crates-io.cpufeatures]
git = "https://github.com/rvolosatovs/utils.git"
branch = "freestanding-uefi" |
This fixes compilation of dependent crates for these targets.
For example,
sha2
:Before:
After: