GHC has been using a custom triple "javascript-unknown-ghcjs" for
their (non asm.js, non wasm) javascript-emitting kernel-less target.

  
https://gitlab.haskell.org/ghc/ghc/-/commit/6636b670233522f01d002c9b97827d00289dbf5c

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                | 19 +++++++++++++++++++
 testsuite/config-sub.data |  2 ++
 2 files changed, 21 insertions(+)

diff --git a/config.sub b/config.sub
index 6ae2502..0eee4b6 100755
--- a/config.sub
+++ b/config.sub
@@ -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 \
@@ -1702,6 +1703,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.
@@ -1884,6 +1888,21 @@ case $vendor 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'" 1>&2
+               exit 1
+               ;;
+esac
+
+
 echo "$cpu-$vendor-${kernel:+$kernel-}$os"
 exit
 
diff --git a/testsuite/config-sub.data b/testsuite/config-sub.data
index ba934b6..6fd722c 100644
--- a/testsuite/config-sub.data
+++ b/testsuite/config-sub.data
@@ -341,6 +341,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
-- 
2.41.0


Reply via email to