diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2020-11-30 13:10:26 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2020-11-30 13:10:26 +0200 |
commit | 819741778f6ad75b5b104d2107a8fd9e30d4d4e5 (patch) | |
tree | b739eae356940f3a2de4826bc6ff080a29c686c6 | |
parent | b8b1c49215be6d042bb27e934597251e21d26951 (diff) |
Canonicalize arm64 to aarch64 in target triplet, similar to config.sub
-rw-r--r-- | libbutl/target-triplet.cxx | 7 | ||||
-rw-r--r-- | libbutl/target-triplet.mxx | 2 | ||||
-rw-r--r-- | tests/target-triplet/driver.cxx | 5 |
3 files changed, 13 insertions, 1 deletions
diff --git a/libbutl/target-triplet.cxx b/libbutl/target-triplet.cxx index 17337b3..db71e3c 100644 --- a/libbutl/target-triplet.cxx +++ b/libbutl/target-triplet.cxx @@ -48,7 +48,12 @@ namespace butl if (f == 0 || f == string::npos) bad ("missing cpu"); - cpu.assign (s, 0, f); + // Canonicalize CPU. + // + if (s.compare (0, f, "arm64") == 0) + cpu = "aarch64"; + else + cpu.assign (s, 0, f); // If we have something in between, then the first component after CPU is // VENDOR. Unless it is a first component of two-component system, as in diff --git a/libbutl/target-triplet.mxx b/libbutl/target-triplet.mxx index 414da6a..1ecc7e5 100644 --- a/libbutl/target-triplet.mxx +++ b/libbutl/target-triplet.mxx @@ -38,6 +38,7 @@ LIBBUTL_MODEXPORT namespace butl // This one is reasonably straightforward. Note that we always expect at // least two components with the first being the CPU. In other words, we // don't try to guess what just 'mingw32' might mean like config.sub does. + // Note that we canonicalize arm64 to aarch64 similar to config.sub. // // VENDOR // @@ -97,6 +98,7 @@ LIBBUTL_MODEXPORT namespace butl // x86_64-pc-windows-msvc x86_64 windows-msvc // x86_64-pc-windows-msvc19.11.25547 x86_64 windows-msvc 19.11.25547 // wasm32-unknown-emscripten wasm32 emscripten + // arm64-apple-darwin20.1.0 aarch64 apple darwin 20.1.0 // // Similar to version splitting, for certain commonly-used targets we also // derive the "target class" which can be used as a shorthand, more diff --git a/tests/target-triplet/driver.cxx b/tests/target-triplet/driver.cxx index ec232e6..a6eff05 100644 --- a/tests/target-triplet/driver.cxx +++ b/tests/target-triplet/driver.cxx @@ -113,6 +113,11 @@ main () "wasm32-emscripten", "wasm32", "", "emscripten", "", "other")); + assert (test ("arm64-apple-darwin20.1.0", + "aarch64-apple-darwin20.1.0", + "aarch64", "apple", "darwin", "20.1.0", "macos")); + + // Version extraction. // assert (test ("x86_64-apple-darwin14.5.0", |