Commits:
-
89150102
by Jesse Schwartzentruber at 2026-08-23T10:45:16+02:00
Bug 2053518 - Handle the *-oe-linux-* rust targets added in rustc 1.98 in rust target detection. r=firefox-build-system-reviewers,glandium
Differential Revision: https://phabricator.services.mozilla.com/D311145
2 changed files:
Changes:
build/moz.configure/rust.configure
| ... |
... |
@@ -300,6 +300,10 @@ def detect_rustc_target( |
|
300
|
300
|
elif not candidates:
|
|
301
|
301
|
return None
|
|
302
|
302
|
|
|
|
303
|
+ # config.guess uses the "pc" vendor for x86/x86_64 where rust uses its
|
|
|
304
|
+ # generic "unknown" vendor; normalize so we correlate on the right one.
|
|
|
305
|
+ vendor = "unknown" if host_or_target.vendor == "pc" else host_or_target.vendor
|
|
|
306
|
+
|
|
303
|
307
|
# We have multiple candidates. There are two cases where we can try to
|
|
304
|
308
|
# narrow further down using extra information from the build system.
|
|
305
|
309
|
# - For windows targets, correlate with the C compiler type
|
| ... |
... |
@@ -367,11 +371,19 @@ def detect_rustc_target( |
|
367
|
371
|
else:
|
|
368
|
372
|
suffix = ""
|
|
369
|
373
|
for p in prefixes:
|
|
370
|
|
- for c in candidates:
|
|
371
|
|
- if c.rust_target.startswith(
|
|
372
|
|
- "{}-".format(p)
|
|
373
|
|
- ) and c.rust_target.endswith(suffix):
|
|
|
374
|
+ matches = [
|
|
|
375
|
+ c
|
|
|
376
|
+ for c in candidates
|
|
|
377
|
+ if c.rust_target.startswith("{}-".format(p))
|
|
|
378
|
+ and c.rust_target.endswith(suffix)
|
|
|
379
|
+ ]
|
|
|
380
|
+ if not matches:
|
|
|
381
|
+ continue
|
|
|
382
|
+ # As below, correlate on the (normalized) vendor.
|
|
|
383
|
+ for c in matches:
|
|
|
384
|
+ if c.target.vendor == vendor:
|
|
374
|
385
|
return c.rust_target
|
|
|
386
|
+ return matches[0].rust_target
|
|
375
|
387
|
|
|
376
|
388
|
# See if we can narrow down on the exact alias.
|
|
377
|
389
|
# We use the sub_configure_alias to keep support mingw32 triplets as input.
|
| ... |
... |
@@ -400,6 +412,15 @@ def detect_rustc_target( |
|
400
|
412
|
elif narrowed:
|
|
401
|
413
|
candidates = narrowed
|
|
402
|
414
|
|
|
|
415
|
+ # Correlate on the (normalized) vendor, so vendor-specific targets (e.g.
|
|
|
416
|
+ # the *-oe-linux-gnu targets added in rust 1.98) don't shadow the
|
|
|
417
|
+ # generic ones for aliases whose vendor doesn't match a rust target.
|
|
|
418
|
+ narrowed = [c for c in candidates if c.target.vendor == vendor]
|
|
|
419
|
+ if len(narrowed) == 1:
|
|
|
420
|
+ return narrowed[0].rust_target
|
|
|
421
|
+ elif narrowed:
|
|
|
422
|
+ candidates = narrowed
|
|
|
423
|
+
|
|
403
|
424
|
# See if we can narrow down with the raw OS and raw CPU
|
|
404
|
425
|
narrowed = [
|
|
405
|
426
|
c
|
python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
| ... |
... |
@@ -1779,6 +1779,15 @@ def gen_invoke_rustc(version, rustup_wrapper=False): |
|
1779
|
1779
|
"xtensa-esp32s3-espidf",
|
|
1780
|
1780
|
"xtensa-esp32s3-none-elf",
|
|
1781
|
1781
|
]
|
|
|
1782
|
+ # Additional targets from 1.98
|
|
|
1783
|
+ if Version(version) >= "1.98.0":
|
|
|
1784
|
+ rust_targets += [
|
|
|
1785
|
+ "aarch64-oe-linux-gnu",
|
|
|
1786
|
+ "armv7-oe-linux-gnueabihf",
|
|
|
1787
|
+ "i686-oe-linux-gnu",
|
|
|
1788
|
+ "riscv64-oe-linux-gnu",
|
|
|
1789
|
+ "x86_64-oe-linux-gnu",
|
|
|
1790
|
+ ]
|
|
1782
|
1791
|
return 0, "\n".join(sorted(rust_targets)), ""
|
|
1783
|
1792
|
if (
|
|
1784
|
1793
|
len(args) == 6
|
| ... |
... |
@@ -1869,6 +1878,7 @@ class RustTest(BaseConfigureTest): |
|
1869
|
1878
|
("x86_64-unknown-linux-android", "x86_64-linux-android"),
|
|
1870
|
1879
|
("x86_64-unknown-linux-android21", "x86_64-linux-android"),
|
|
1871
|
1880
|
("x86_64-pc-linux-gnu", "x86_64-unknown-linux-gnu"),
|
|
|
1881
|
+ ("riscv64-unknown-linux-gnu", "riscv64gc-unknown-linux-gnu"),
|
|
1872
|
1882
|
("sparcv9-sun-solaris2", "sparcv9-sun-solaris"),
|
|
1873
|
1883
|
("x86_64-sun-solaris2", "x86_64-pc-solaris"),
|
|
1874
|
1884
|
("x86_64-apple-darwin23.3.0", "x86_64-apple-darwin"),
|
| ... |
... |
@@ -1970,5 +1980,10 @@ class RustTest(BaseConfigureTest): |
|
1970
|
1980
|
self.assertEqual(self.get_rust_target("wasm32-unknown-wasi"), "wasm32-wasip1")
|
|
1971
|
1981
|
|
|
1972
|
1982
|
|
|
|
1983
|
+# Exercises the vendor-specific *-oe-linux-* targets added in rust 1.98.
|
|
|
1984
|
+class Rust198Test(RustTest):
|
|
|
1985
|
+ VERSION = "1.98.0"
|
|
|
1986
|
+
|
|
|
1987
|
+
|
|
1973
|
1988
|
if __name__ == "__main__":
|
|
1974
|
1989
|
main() |
|