From 6c78704d542cebfb56d17474fe9f8395e9defb94 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Wed, 16 Aug 2023 04:59:26 -0700 Subject: [PATCH] config.sub: add javascript-*-ghcjs GHC has been using a custom triple "javascript-unknown-ghcjs" for their (non asm.js, non wasm) javascript-emitting kernel-less target. This triple is a bit of an oddball, so the support for it is highly restricted in order to discourage further proliferation of the javascript "cpu" or ghcjs "operating system", which are valid only in combination with each other. * config.sub (javascript-*-ghcjs): Allow. * doc/config.sub.1: Regenerate. * testsuite/config-sub.data (javascript-ghcjs, javascript-unknown-ghcjs): New entries. Link: https://gitlab.haskell.org/ghc/ghc/-/commit/6636b670233522f01d002c9b97827d00289dbf5c Signed-off-by: Dmitry V. Levin --- config.sub | 20 +++++++++++++++++++- doc/config.sub.1 | 2 +- testsuite/config-sub.data | 2 ++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/config.sub b/config.sub index 98af000..ea05c2e 100755 --- a/config.sub +++ b/config.sub @@ -4,7 +4,7 @@ # shellcheck disable=SC2006,SC2268 # see below for rationale -timestamp='2023-08-07' +timestamp='2023-08-16' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -1200,6 +1200,7 @@ case $cpu-$vendor in | d10v | d30v | dlx | dsp16xx \ | e2k | elxsi | epiphany \ | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ + | javascript \ | h8300 | h8500 \ | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ @@ -1728,6 +1729,9 @@ case $os in # VxWorks passes extra cpu info in the 4th filed. simlinux | simwindows | spe) ;; + # See `case $cpu-$os` validation below + ghcjs) + ;; # Now accept the basic system types. # The portable systems comes first. # Each alternative MUST end in a * to match a version number. @@ -1797,6 +1801,20 @@ case $obj in ;; esac +# Here we handle the constraint that a (synthetic) cpu and os are +# valid only in combination with each other and nowhere else. +case $cpu-$os in + # The "javascript-unknown-ghcjs" triple is used by GHC; we + # accept it here in order to tolerate that, but reject any + # variations. + javascript-ghcjs) + ;; + javascript-* | *-ghcjs) + echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2 + exit 1 + ;; +esac + # As a final step for OS-related things, validate the OS-kernel combination # (given a valid OS), if there is a kernel. case $kernel-$os-$obj in diff --git a/doc/config.sub.1 b/doc/config.sub.1 index 60b0a55..7c4777e 100644 --- a/doc/config.sub.1 +++ b/doc/config.sub.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.5. -.TH CONFIG.SUB "1" "August 2023" "GNU config.sub (2023-08-07)" "User Commands" +.TH CONFIG.SUB "1" "August 2023" "GNU config.sub (2023-08-16)" "User Commands" .SH NAME config.sub \- validate and canonicalize a configuration triplet .SH SYNOPSIS diff --git a/testsuite/config-sub.data b/testsuite/config-sub.data index af30cd9..af65330 100644 --- a/testsuite/config-sub.data +++ b/testsuite/config-sub.data @@ -343,6 +343,8 @@ isi68 m68k-isi-sysv j90 j90-cray-unicos j90-cray j90-cray-unicos j90-unicos j90-cray-unicos +javascript-ghcjs javascript-unknown-ghcjs +javascript-unknown-ghcjs javascript-unknown-ghcjs k1om k1om-unknown-none k1om-linux k1om-unknown-linux-gnu kvx-cos kvx-unknown-cos