diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2022-10-19 11:10:18 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2022-10-19 11:10:18 +0200 |
commit | 9c14033610bc00072d00389c879ac305efbb95df (patch) | |
tree | 29d4c7a97ee771d3b7d5ceb7a8a23494a0df4c94 | |
parent | 81ec829b96a01ef08b9fa6191c603c2a4d856c2c (diff) |
Canonicalize 'linux' to `linux-gnu' in target triplet
In particular, GCC in Fedora now reports its target as x86_64-redhat-linux.
Note that this canonicalization is consistent with config.sub.
-rw-r--r-- | libbutl/target-triplet.cxx | 5 | ||||
-rw-r--r-- | libbutl/target-triplet.hxx | 1 | ||||
-rw-r--r-- | tests/target-triplet/driver.cxx | 4 |
3 files changed, 10 insertions, 0 deletions
diff --git a/libbutl/target-triplet.cxx b/libbutl/target-triplet.cxx index 209f75e..4c02efc 100644 --- a/libbutl/target-triplet.cxx +++ b/libbutl/target-triplet.cxx @@ -88,6 +88,11 @@ namespace butl if (system.front () == '-' || system.back () == '-') bad ("invalid os/kernel/abi"); + // Canonicalize SYSTEM. + // + if (system == "linux") + system = "linux-gnu"; // Per config.sub. + // Extract VERSION for some recognized systems. // string::size_type v (0); diff --git a/libbutl/target-triplet.hxx b/libbutl/target-triplet.hxx index 45db457..da29907 100644 --- a/libbutl/target-triplet.hxx +++ b/libbutl/target-triplet.hxx @@ -77,6 +77,7 @@ namespace butl // i686-w64-mingw32 i686 w64 mingw32 // i686-lfs-linux-gnu i686 lfs linux-gnu // x86_64-unknown-linux-gnu x86_64 linux-gnu + // x86_64-redhat-linux x86_64 redhat linux-gnu // x86_64-linux-gnux32 x86_64 linux-gnux32 // x86_64-microsoft-win32-msvc14.0 x86_64 microsoft win32-msvc 14.0 // x86_64-pc-windows-msvc x86_64 windows-msvc diff --git a/tests/target-triplet/driver.cxx b/tests/target-triplet/driver.cxx index 6dcb77e..30153a1 100644 --- a/tests/target-triplet/driver.cxx +++ b/tests/target-triplet/driver.cxx @@ -82,6 +82,10 @@ main () "x86_64-linux-gnu", "x86_64", "", "linux-gnu", "", "linux")); + assert (test ("x86_64-redhat-linux", + "x86_64-redhat-linux-gnu", + "x86_64", "redhat", "linux-gnu", "", "linux")); + assert (test ("x86_64-linux-gnux32", "x86_64-linux-gnux32", "x86_64", "", "linux-gnux32", "", "linux")); |