Bug 1408317 - Take endianness into consideration when looking for rust target. r=froydnj

--HG--
extra : rebase_source : 8e65363f4544f82f0e96ae7643402b7a5f41bb60
This commit is contained in:
Mike Hommey 2017-10-13 18:33:30 +09:00
parent 51482ab58b
commit 0914d9c689
2 changed files with 13 additions and 5 deletions

View File

@ -111,10 +111,11 @@ def rust_supported_targets(rustc):
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:
@ -125,7 +126,7 @@ def rust_supported_targets(rustc):
# 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)
@ -169,11 +170,12 @@ def rust_triple_alias(host_or_target):
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(

View File

@ -1541,6 +1541,12 @@ class RustTest(BaseConfigureTest):
'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)