Skip to content

Commit

Permalink
Do not fallback to "arm" in rustup-init.sh on aarch64 with 32-bit use…
Browse files Browse the repository at this point in the history
…rland

aarch64 always has neon enabled, and thus it's not included in /proc/cpuinfo. Previously, we'd fall back to arm when running with a 32-bit userland, even though armv7 is perfectly appropriate in this case.

This would then run into the issue described in rust-lang/rust#58414 with "CP15 barrier emulation".

This PR fixes that.
  • Loading branch information
alex authored Sep 22, 2023
1 parent d4c6844 commit e38250e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions rustup-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -501,6 +501,7 @@ get_architecture() {
;;
aarch64)
_cputype=armv7
_arm6432=1
if [ "$_ostype" = "linux-android" ]; then
_ostype=linux-androideabi
else
Expand All @@ -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
Expand Down

0 comments on commit e38250e

Please sign in to comment.