Bug 1595218 - Update rust target detection for rustc 1.39. r=glandium
☠☠ backed out by 62a4bef34ce7 ☠ ☠
authorChris Manchester <cmanchester@mozilla.com>
Wed, 04 Dec 2019 23:37:16 +0000
changeset 505570 499b0c27da4fb10f06b17b0b6ad433ed9563412b
parent 505569 f2f230a3028d0ac0d951412ea00639cd3508d159
child 505571 c1aa563394ec0c856df2cc7ef50e3c1b2d3e8085
push id102348
push usercmanchester@mozilla.com
push dateWed, 04 Dec 2019 23:40:05 +0000
treeherderautoland@499b0c27da4f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1595218
milestone73.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 1595218 - Update rust target detection for rustc 1.39. r=glandium Differential Revision: https://phabricator.services.mozilla.com/D53901
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
@@ -265,19 +265,20 @@ def rust_triple_alias(host_or_target, ho
                 else:
                     suffix = 'windows-msvc'
                 narrowed = [c for c in candidates if c.rust_target.endswith('-{}'.format(suffix))]
                 if len(narrowed) == 1:
                     return narrowed[0].rust_target
                 elif narrowed:
                     candidates = narrowed
 
-                vendor_aliases = {'pc': 'w64'}
+                vendor_aliases = {'pc': ('w64', 'windows')}
                 narrowed = [c for c in candidates
-                            if vendor_aliases.get(c.target.vendor) == host_or_target.vendor]
+                            if host_or_target.vendor in vendor_aliases.get(c.target.vendor, ())]
+
                 if len(narrowed) == 1:
                     return narrowed[0].rust_target
 
             # - For arm targets, correlate with arm_target
             #   we could be more thorough with the supported rust targets, but they
             #   don't support OSes that are supported to build Gecko anyways.
             #   Also, sadly, the only interface to check the rust target cpu features
             #   is --print target-spec-json, and it's unstable, so we have to rely on
--- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
+++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
@@ -1665,28 +1665,44 @@ def gen_invoke_rustc(version, rustup_wra
                     'i686-wrs-vxworks',
                     'powerpc-wrs-vxworks',
                     'powerpc-wrs-vxworks-spe',
                     'powerpc64-wrs-vxworks',
                     'riscv32i-unknown-none-elf',
                     'x86_64-uwp-windows-gnu',
                     'x86_64-wrs-vxworks',
                 ]
+            # Additional targets from 1.38
+            if Version(version) >= '1.39.0':
+                rust_targets += [
+                    'aarch64-uwp-windows-msvc',
+                    'armv7-wrs-vxworks-eabihf',
+                    'i686-unknown-uefi',
+                    'i686-uwp-windows-msvc',
+                    'mips64-unknown-linux-muslabi64',
+                    'mips64el-unknown-linux-muslabi64',
+                    'sparc64-unknown-openbsd',
+                    'x86_64-linux-kernel',
+                    'x86_64-uwp-windows-msvc',
+                ]
+                rust_targets.remove('armv7-wrs-vxworks')
+                rust_targets.remove('i586-wrs-vxworks')
+
             return 0, '\n'.join(sorted(rust_targets)), ''
         if (len(args) == 6 and args[:2] == ('--crate-type', 'staticlib') and
             args[2].startswith('--target=') and args[3] == '-o'):
             with open(args[4], 'w') as fh:
                 fh.write('foo')
             return 0, '', ''
         raise NotImplementedError('unsupported arguments')
     return invoke_rustc
 
 
 class RustTest(BaseConfigureTest):
-    def get_rust_target(self, target, compiler_type='gcc', version='1.38.0',
+    def get_rust_target(self, target, compiler_type='gcc', version='1.39.0',
                         arm_target=None):
         environ = {
             'PATH': os.pathsep.join(
                 mozpath.abspath(p) for p in ('/bin', '/usr/bin')),
         }
 
         paths = {
             mozpath.abspath('/usr/bin/cargo'): gen_invoke_cargo(version),
@@ -1760,16 +1776,17 @@ class RustTest(BaseConfigureTest):
             ('i686-pc-mingw32', 'cl', 'i686-pc-windows-msvc'),
             ('x86_64-pc-mingw32', 'cl', 'x86_64-pc-windows-msvc'),
             ('i686-pc-mingw32', 'gcc', 'i686-pc-windows-gnu'),
             ('x86_64-pc-mingw32', 'gcc', 'x86_64-pc-windows-gnu'),
             ('i686-pc-mingw32', 'clang', 'i686-pc-windows-gnu'),
             ('x86_64-pc-mingw32', 'clang', 'x86_64-pc-windows-gnu'),
             ('i686-w64-mingw32', 'clang', 'i686-pc-windows-gnu'),
             ('x86_64-w64-mingw32', 'clang', 'x86_64-pc-windows-gnu'),
+            ('aarch64-windows-mingw32', 'clang-cl', 'aarch64-pc-windows-msvc'),
         ):
             self.assertEqual(self.get_rust_target(autoconf, building_with_gcc), rust)
 
         # Arm special cases
         self.assertEqual(
             self.get_rust_target('arm-unknown-linux-androideabi',
                                  arm_target=ReadOnlyNamespace(
                                      arm_arch=7, fpu='neon', thumb2=True, float_abi='softfp')),