Skip to content

Commit ec0d1ce

Browse files
authored
Auto merge of #37625 - xen0n:rustbuild-mips, r=alexcrichton
rustbuild: support MIPS host builds There is a *little* code duplication, but primarily for sake of "match exhaustiveness". Let's blame Linux/MIPS for not exposing endianness explicitly in `uname -m` (that's user-space interface and as such is frozen). Currently the build won't work as we have to wait for a new stage0 for the MIPS host compilers, but this paves the way to self-hosted Rust on MIPS. The cross-compiled MIPS binaries are confirmed to work on the Loongson 3A2000 (MIPS64r2-compatible) so we have plenty of confidence that they'll work on other MIPS platforms too, as Linux/MIPS user-space ABI is consistent across machines of the same bitness. r? @alexcrichton
2 parents c9f16bb + 0d433a8 commit ec0d1ce

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/bootstrap/bootstrap.py

+16
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,22 @@ def build_triple(self):
344344
ostype += 'eabihf'
345345
elif cputype == 'aarch64':
346346
cputype = 'aarch64'
347+
elif cputype == 'mips':
348+
if sys.byteorder == 'big':
349+
cputype = 'mips'
350+
elif sys.byteorder == 'little':
351+
cputype = 'mipsel'
352+
else:
353+
raise ValueError('unknown byteorder: ' + sys.byteorder)
354+
elif cputype == 'mips64':
355+
if sys.byteorder == 'big':
356+
cputype = 'mips64'
357+
elif sys.byteorder == 'little':
358+
cputype = 'mips64el'
359+
else:
360+
raise ValueError('unknown byteorder: ' + sys.byteorder)
361+
# only the n64 ABI is supported, indicate it
362+
ostype += 'abi64'
347363
elif cputype in {'powerpc', 'ppc', 'ppc64'}:
348364
cputype = 'powerpc'
349365
elif cputype in {'amd64', 'x86_64', 'x86-64', 'x64'}:

0 commit comments

Comments
 (0)