about summary refs log tree commit diff
diff options
context:
space:
mode:
authorHavard Eidnes <he@NetBSD.org>2025-08-23 19:15:46 +0000
committerHavard Eidnes <he@NetBSD.org>2025-08-23 19:15:46 +0000
commit45bcbd99a5479658e0f97ecc3e3ed83ecbe47712 (patch)
tree3e78ce77fb5b0c1613d10e622b3c84b8ca853483
parent6d6a08cf590ec26296447b8d2cf2329bb64c303a (diff)
downloadrust-45bcbd99a5479658e0f97ecc3e3ed83ecbe47712.tar.gz
rust-45bcbd99a5479658e0f97ecc3e3ed83ecbe47712.zip
bootstrap.py: Improve CPU detection on NetBSD,
...and add adaptation of detection for some arm variants.
-rw-r--r--src/bootstrap/bootstrap.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index 40e08361a0f..e14433dd230 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -312,6 +312,11 @@ def default_build_triple(verbose):
 
     kernel, cputype, processor = uname.decode(default_encoding).split(maxsplit=2)
 
+    # ON NetBSD, use `uname -p` to set the CPU type
+    if kernel == 'NetBSD':
+        cputype = subprocess.check_output(
+            ['uname', '-p']).strip().decode(default_encoding)
+
     # The goal here is to come up with the same triple as LLVM would,
     # at least for the subset of platforms we're willing to target.
     kerneltype_mapper = {
@@ -433,10 +438,16 @@ def default_build_triple(verbose):
             kernel = "linux-androideabi"
         else:
             kernel += "eabihf"
-    elif cputype in {"armv7l", "armv8l"}:
+    elif cputype in {"armv6hf", "earmv6hf"}:
+        cputype = "armv6"
+        if kernel == "unknown-netbsd":
+            kernel += "-eabihf"
+    elif cputype in {"armv7l", "earmv7hf", "armv8l"}:
         cputype = "armv7"
         if kernel == "linux-android":
             kernel = "linux-androideabi"
+        elif kernel == "unknown-netbsd":
+            kernel += "-eabihf"
         else:
             kernel += "eabihf"
     elif cputype == "mips":