-
Notifications
You must be signed in to change notification settings - Fork 735
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
Illegal instruction when running on Raspberry Pi when building with RUSTFLAGS
containing -C target_cpu=cortex-a72
#1858
Comments
@jupyterkat Thanks for the bug report. Which operating system (kernel version and distribution version) are you using? |
It's kernel 6.1.21-v8+ on debian 11 |
@jupyterkat Could you help with some additional info:
|
|
not sure about emulating raspi4, qemu should already support it, or there is a patch to that. |
I also get illegal instruction on Raspberry Pi 4 but only when using Code: use ring::signature::{EcdsaKeyPair, ECDSA_P256_SHA256_ASN1_SIGNING};
fn main() {
let rng = ring::rand::SystemRandom::new();
let pkcs8 = EcdsaKeyPair::generate_pkcs8(&ECDSA_P256_SHA256_ASN1_SIGNING, &rng).unwrap();
EcdsaKeyPair::from_pkcs8(&ECDSA_P256_SHA256_ASN1_SIGNING, pkcs8.as_ref(), &rng).unwrap();
} Run with Result from gdb:
pi@raspberrypi:~/dev/server $ rustc --version
rustc 1.77.0-nightly (fb5ed726f 2023-12-28)
pi@raspberrypi:~/dev/server $ rustc --target=aarch64-unknown-linux-gnu --print cfg
debug_assertions
overflow_checks
panic="unwind"
relocation_model="pic"
target_abi=""
target_arch="aarch64"
target_endian="little"
target_env="gnu"
target_family="unix"
target_feature="neon"
target_has_atomic
target_has_atomic="128"
target_has_atomic="16"
target_has_atomic="32"
target_has_atomic="64"
target_has_atomic="8"
target_has_atomic="ptr"
target_has_atomic_equal_alignment="128"
target_has_atomic_equal_alignment="16"
target_has_atomic_equal_alignment="32"
target_has_atomic_equal_alignment="64"
target_has_atomic_equal_alignment="8"
target_has_atomic_equal_alignment="ptr"
target_has_atomic_load_store
target_has_atomic_load_store="128"
target_has_atomic_load_store="16"
target_has_atomic_load_store="32"
target_has_atomic_load_store="64"
target_has_atomic_load_store="8"
target_has_atomic_load_store="ptr"
target_os="linux"
target_pointer_width="64"
target_thread_local
target_vendor="unknown"
unix
pi@raspberrypi:~/dev/server $ cat /proc/cpuinfo
processor : 0
BogoMIPS : 108.00
Features : fp asimd evtstrm crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3
...
Model : Raspberry Pi 4 Model B Rev 1.4 Operating System: Debian GNU/Linux 12 (bookworm) |
RUSTFLAGS
containing -C target_cpu=cortex-a72
Thank you for solving the problem.
Without
This is a bug in rustc/LLVM or user error. |
The LLVM bug is llvm/llvm-project#90365. |
Coincidentally, for aarch64-apple targets, we always force dynamic detection of SHA512, and coincidentally PR #2040 generalizes that mechanism to allow us to force dynamic detection of any set of features on a per-OS basis. One way we could work around this issue with the compiler would be to merge PR #2040, then change the src/cpu/arm/linux.rs to have |
PR #2050 implements the aforementioned workaround for this. PTAL. |
Related issues:
|
PR #2050 has been merged. It would be great if somebody could confirm that this fixes the issue for them. |
NOTE: this is compiled with
-target-cpu=native
and--release
, and target triplestable-aarch64-unknown-linux-gnu
. But it fails with defaulttarget-cpu
anywaysbacktrace:
lscpu:
The text was updated successfully, but these errors were encountered: