Skip to content

Commit 819ddda

Browse files
authored
Merge pull request #1695 from lzutao/mips
Clearer detecting 64-bit Linux with 32-bit userland on mips64el
2 parents 415846e + ca17dbc commit 819ddda

File tree

1 file changed

+17
-22
lines changed

1 file changed

+17
-22
lines changed

rustup-init.sh

+17-22
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ get_architecture() {
197197

198198
Linux)
199199
_ostype=unknown-linux-gnu
200+
_bitness=$(get_bitness)
200201
;;
201202

202203
FreeBSD)
@@ -265,22 +266,15 @@ get_architecture() {
265266
;;
266267

267268
mips)
268-
_cputype="$(get_endianness $_cputype "" 'el')"
269+
_cputype=$(get_endianness mips '' el)
269270
;;
270271

271272
mips64)
272-
_bitness="$(get_bitness)"
273-
if [ "$_bitness" -eq 32 ]; then
274-
if [ "$_ostype" = "unknown-linux-gnu" ]; then
275-
# 64-bit kernel with 32-bit userland
276-
# endianness suffix is appended later
277-
_cputype=mips
278-
fi
279-
else
273+
if [ "$_bitness" -eq 64 ]; then
280274
# only n64 ABI is supported for now
281275
_ostype="${_ostype}abi64"
276+
_cputype=$(get_endianness mips64 '' el)
282277
fi
283-
_cputype="$(get_endianness "$_cputype" "" 'el')"
284278
;;
285279

286280
ppc)
@@ -300,18 +294,19 @@ get_architecture() {
300294

301295
esac
302296

303-
# Detect 64-bit linux with 32-bit userland for x86
304-
if [ "$_ostype" = unknown-linux-gnu ] && [ "$_cputype" = x86_64 ]; then
305-
if [ "$(get_bitness)" = "32" ]; then
306-
_cputype=i686
307-
fi
308-
fi
309-
310-
# Detect 64-bit linux with 32-bit userland for powerpc
311-
if [ $_ostype = unknown-linux-gnu ] && [ $_cputype = powerpc64 ]; then
312-
if [ "$(get_bitness)" = "32" ]; then
313-
local _cputype=powerpc
314-
fi
297+
# Detect 64-bit linux with 32-bit userland
298+
if [ "${_ostype}" = unknown-linux-gnu ] && [ "${_bitness}" -eq 32 ]; then
299+
case $_cputype in
300+
x86_64)
301+
_cputype=i686
302+
;;
303+
mips64)
304+
_cputype=$(get_endianness mips '' el)
305+
;;
306+
powerpc64)
307+
_cputype=powerpc
308+
;;
309+
esac
315310
fi
316311

317312
# Detect armv7 but without the CPU features Rust needs in that build,

0 commit comments

Comments
 (0)