Bug 1408317 - Take endianness into consideration when looking for rust target. r=froydnj
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 13 Oct 2017 18:33:30 +0900
changeset 386213 c844b986015b481d36b717bbf4d959898c74ec10
parent 386212 247bb54b615fd5a73353f7f8b186672fcbaf8fee
child 386214 f9020d7696a911e38dded79f5f29ba4f2d1aafc9
push id32678
push userarchaeopteryx@coole-files.de
push dateSat, 14 Oct 2017 09:40:07 +0000
treeherdermozilla-central@0dd64d5842e8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1408317
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1408317 - Take endianness into consideration when looking for rust target. r=froydnj
build/moz.configure/rust.configure
python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
--- a/build/moz.configure/rust.configure
+++ b/build/moz.configure/rust.configure
@@ -106,31 +106,32 @@ def rust_supported_targets(rustc):
     out = check_cmd_output(rustc, '--print', 'target-list').splitlines()
     # The os in the triplets used by rust may match the same OSes, in which
     # case we need to check the raw_os instead.
     per_os = {}
     ambiguous = set()
     per_raw_os = {}
     for t in out:
         t = split_triplet(t, allow_unknown=True)
-        key = (t.cpu, t.os)
+        key = (t.cpu, t.endianness, t.os)
         if key in per_os:
             previous = per_os[key]
-            per_raw_os[(previous.cpu, previous.raw_os)] = previous
+            per_raw_os[(previous.cpu, previous.endianness,
+                        previous.raw_os)] = previous
             del per_os[key]
             ambiguous.add(key)
         if key in ambiguous:
             raw_os = t.raw_os
             # split_triplet will return a raw_os of 'androideabi' for
             # rust targets in the form cpu-linux-androideabi, but what
             # we get from the build system is linux-androideabi, so
             # normalize.
             if raw_os == 'androideabi':
                 raw_os = 'linux-androideabi'
-            per_raw_os[(t.cpu, raw_os)] = t
+            per_raw_os[(t.cpu, t.endianness, raw_os)] = t
         else:
             per_os[key] = t
     return namespace(per_os=per_os, per_raw_os=per_raw_os)
 
 
 @template
 def rust_triple_alias(host_or_target):
     """Template defining the alias used for rustc's --target flag.
@@ -164,21 +165,22 @@ def rust_triple_alias(host_or_target):
             else:
                 host_or_target_os = 'windows-msvc'
             host_or_target_raw_os = host_or_target_os
         else:
             host_or_target_os = host_or_target.os
             host_or_target_raw_os = host_or_target.raw_os
 
         rustc_target = rust_supported_targets.per_os.get(
-            (host_or_target.cpu, host_or_target_os))
+            (host_or_target.cpu, host_or_target.endianness, host_or_target_os))
 
         if rustc_target is None:
             rustc_target = rust_supported_targets.per_raw_os.get(
-                (host_or_target.cpu, host_or_target_raw_os))
+                (host_or_target.cpu, host_or_target.endianness,
+                 host_or_target_raw_os))
 
         if rustc_target is None:
             die("Don't know how to translate {} for rustc".format(
                 host_or_target.alias))
 
         # Check to see whether our rustc has a reasonably functional stdlib
         # for our chosen target.
         target_arg = '--target=' + rustc_target.alias
--- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
+++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
@@ -1536,16 +1536,22 @@ class RustTest(BaseConfigureTest):
             'sparc64-unknown-linux-gnu',
             'i686-unknown-linux-gnu',
             'i686-apple-darwin',
             'x86_64-apple-darwin',
             'aarch64-apple-ios',
             'armv7s-apple-ios',
             'i386-apple-ios',
             'x86_64-apple-ios',
+            'mips-unknown-linux-gnu',
+            'mipsel-unknown-linux-gnu',
+            'mips64-unknown-linux-gnuabi64',
+            'mips64el-unknown-linux-gnuabi64',
+            'powerpc64-unknown-linux-gnu',
+            'powerpc64le-unknown-linux-gnu',
         ):
             self.assertEqual(self.get_rust_target(straightforward), straightforward)
 
         # Cases where the output of config.sub is different
         for autoconf, rust in (
             ('aarch64-unknown-linux-android', 'aarch64-linux-android'),
             ('arm-unknown-linux-androideabi', 'armv7-linux-androideabi'),
             ('armv7-unknown-linux-androideabi', 'armv7-linux-androideabi'),