diff --git a/rustup-init.sh b/rustup-init.sh index a7701c53364..3c8131b5fad 100755 --- a/rustup-init.sh +++ b/rustup-init.sh @@ -291,7 +291,7 @@ ensure_loongarch_uapi() { } get_architecture() { - local _ostype _cputype _bitness _arch _clibtype + local _ostype _cputype _bitness _arch _clibtype _arm6432 _ostype="$(uname -s)" _cputype="$(uname -m)" _clibtype="gnu" @@ -501,6 +501,7 @@ get_architecture() { ;; aarch64) _cputype=armv7 + _arm6432=1 if [ "$_ostype" = "linux-android" ]; then _ostype=linux-androideabi else @@ -516,7 +517,10 @@ get_architecture() { # Detect armv7 but without the CPU features Rust needs in that build, # and fall back to arm. # See https://github.com/rust-lang/rustup.rs/issues/587. - if [ "$_ostype" = "unknown-linux-gnueabihf" ] && [ "$_cputype" = armv7 ]; then + # If we're on an aarch64 CPU with a 32-bit userland, do not fall back to + # arm -- aarch64 always has neon, and so it's not actually included in + # /proc/cpuinfo + if [ "$_ostype" = "unknown-linux-gnueabihf" ] && [ "$_cputype" = armv7 ] && [ "$_arm6432" != 1 ]; then if ensure grep '^Features' /proc/cpuinfo | grep -q -v neon; then # At least one processor does not have NEON. _cputype=arm