-
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
u128 division not working on x86_64-unknown-uefi #86494
Comments
The PR you linked should not be present in Rust compilers before 1.49.0, like 1.48.0. You can download it using rustup with the command The uefi dependency as well as others might not accept that compiler version because it's too old. You might have to hardcode older versions. |
This needs a disassembly at the point UD trap was fired. I suspect CPU features (SSE?) being used that are not available or initialized by firmware by default. |
I'm trying to repro myself and am getting
My best guess is that this function in
I read that you shouldn't use floating point operations in UEFI, and I know that |
The `x86_64-unknown-uefi` target is Windows-like [1], and requires the same altered ABI for some 128-bit integer intrinsics. See also rust-lang/rust#86494. [1]: https://github.com/rust-lang/rust/blob/master/compiler/rustc_target/src/spec/x86_64_unknown_uefi.rs
The `x86_64-unknown-uefi` target is Windows-like [1], and requires the same altered ABI for some 128-bit integer intrinsics. See also rust-lang/rust#86494. [1]: https://github.com/rust-lang/rust/blob/master/compiler/rustc_target/src/spec/x86_64_unknown_uefi.rs
The `x86_64-unknown-uefi` target is Windows-like [1], and requires the same altered ABI for some 128-bit integer intrinsics. See also rust-lang/rust#86494. [1]: https://github.com/rust-lang/rust/blob/master/compiler/rustc_target/src/spec/x86_64_unknown_uefi.rs
The `x86_64-unknown-uefi` target is Windows-like [1], and requires the same altered ABI for some 128-bit integer intrinsics. See also rust-lang/rust#86494. [1]: https://github.com/rust-lang/rust/blob/master/compiler/rustc_target/src/spec/x86_64_unknown_uefi.rs
This turned out to be an ABI problem, fixed in compiler_builtins: rust-lang/compiler-builtins#475 |
I've found that u128 division is not working on the
x86_64-unknown-uefi
target. Depending on the exact code I've seen it give either incorrect results or fail with an invalid opcode error.Fairly minimal example:
The easiest way to actually run this is with QEMU; I've set up a example in this repo: https://github.com/nicholasbishop/uefi-div-bug. The
run.py
script will build it and run it under a QEMU UEFI environment.With this particular example I get this error:
With less minimal examples I've also seen it not fail with an invalid opcode, but instead just give a bogus result. Other u128 operations I tried (add, sub, mul) work fine.
My not-very-informed guess is that there's a bug in the
__udivti3
implementation in compiler_builtins. I was curious if perhaps rust-lang/compiler-builtins#332 was related, but I couldn't figure out how to alter the version of compiler-builtins I tested against.The text was updated successfully, but these errors were encountered: