From 3de51364733c8cc57bb3a6022db4ed5f71888371 Mon Sep 17 00:00:00 2001
From: pxin <peixing.xin@windriver.com>
Date: Fri, 8 Jan 2021 10:53:07 +0800
Subject: [PATCH] Recognize four-part configuration name for VxWorks.

For example:

  armv7m-wrs-vxworks-eabihf
  armv7-wrs-vxworks-eabihf
  i686-wrs-vxworks-simlinux
  i686-wrs-vxworks-simwindows
  powerpc-wrs-vxworks-spe
  x86_64-wrs-vxworks-simlinux
  x86_64-wrs-vxworks-simwindows

It's my check results (on Ubuntu 18.04):

  $ make check
  cd testsuite && bash config-guess.sh && rm uname
  PASS: config.guess checks (131 tests)
  cd testsuite && bash config-sub.sh
  PASS: config.sub checks (846 tests)
  PASS: config.sub idempotency checks (783 tests)
  PASS: config.sub canonicalise each config.guess testcase (131 tests)

* config.sub: Recognize four-part configuration name for VxWorks.
* testsuite/config-sub.data: Add test cases.

Co-authored-by: John Ericson <git@JohnEricson.me>
---
 config.sub                |  9 +++++++--
 testsuite/config-sub.data | 14 ++++++++++++++
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/config.sub b/config.sub
index b0f8492..e14839b 100755
--- a/config.sub
+++ b/config.sub
@@ -1683,12 +1683,15 @@ fi
 
 # Now, validate our (potentially fixed-up) OS.
 case $os in
-	# Sometimes we do "kernel-abi", so those need to count as OSes.
+	# Sometimes we do "kernel-libc", so those need to count as OSes.
 	musl* | newlib* | uclibc*)
 		;;
-	# Likewise for "kernel-libc"
+	# Likewise for "kernel-abi"
 	eabi* | gnueabi*)
 		;;
+	# VxWorks passes extra cpu info in the 4th filed.
+	simlinux | simwindows | spe)
+		;;
 	# Now accept the basic system types.
 	# The portable systems comes first.
 	# Each alternative MUST end in a * to match a version number.
@@ -1751,6 +1754,8 @@ case $kernel-$os in
 		;;
 	kfreebsd*-gnu* | kopensolaris*-gnu*)
 		;;
+	vxworks-simlinux | vxworks-simwindows | vxworks-spe)
+		;;
 	nto-qnx*)
 		;;
 	os2-emx)
diff --git a/testsuite/config-sub.data b/testsuite/config-sub.data
index 60cf4fd..1f72e4e 100644
--- a/testsuite/config-sub.data
+++ b/testsuite/config-sub.data
@@ -18,6 +18,7 @@ aarch64-genode					aarch64-unknown-genode
 aarch64-linux					aarch64-unknown-linux-gnu
 aarch64-unknown-elf				aarch64-unknown-elf
 aarch64-unknown-linux				aarch64-unknown-linux-gnu
+aarch64-wrs-vxworks				aarch64-wrs-vxworks
 aarch64_be					aarch64_be-unknown-none
 aarch64_be-bme					aarch64_be-unknown-bme
 aarch64_be-elf					aarch64_be-unknown-elf
@@ -97,6 +98,7 @@ armv7-apple-ios					armv7-apple-ios
 armv7-unknown-netbsdelf7.0			armv7-unknown-netbsdelf7.0
 armv7-unknown-netbsdelf7.0-eabi			armv7-unknown-netbsdelf7.0-eabi
 armv7-unknown-netbsdelf7.0-eabihf		armv7-unknown-netbsdelf7.0-eabihf
+armv7-wrs-vxworks-eabihf			armv7-wrs-vxworks-eabihf
 armv7a						armv7a-unknown-none
 armv7a-linux-gnueabi				armv7a-unknown-linux-gnueabi
 armv7eb-unknown-netbsdelf7.0			armv7eb-unknown-netbsdelf7.0
@@ -104,6 +106,7 @@ armv7eb-unknown-netbsdelf7.0-eabi		armv7eb-unknown-netbsdelf7.0-eabi
 armv7eb-unknown-netbsdelf7.0-eabihf		armv7eb-unknown-netbsdelf7.0-eabihf
 armv7m						armv7m-unknown-none
 armv7m-unknown-none-eabi				armv7m-unknown-none-eabi
+armv7m-wrs-vxworks-eabihf				armv7m-wrs-vxworks-eabihf
 armv7r						armv7r-unknown-none
 armv8a						armv8a-unknown-none
 armv8b-linux-gnueabi				armv8b-unknown-linux-gnueabi
@@ -290,6 +293,9 @@ i686-ericsson-dicos				i686-ericsson-dicos
 i686-haiku					i686-pc-haiku
 i686-kopensolaris5.11-gnu			i686-pc-kopensolaris5.11-gnu
 i686-os2-emx					i686-pc-os2-emx
+i686-wrs-vxworks				i686-wrs-vxworks
+i686-wrs-vxworks-simlinux			i686-wrs-vxworks-simlinux
+i686-wrs-vxworks-simwindows			i686-wrs-vxworks-simwindows
 i786-elf					i786-pc-elf
 i860						i860-unknown-sysv
 i960						i960-unknown-none
@@ -548,8 +554,11 @@ powerpc-elf-lynxos5				powerpc-elf-lynxos5
 powerpc-haiku					powerpc-unknown-haiku
 powerpc-pikeos					powerpc-unknown-elf
 powerpc-sysgo-pikeos				powerpc-sysgo-elf
+powerpc-wrs-vxworks				powerpc-wrs-vxworks
+powerpc-wrs-vxworks-spe			powerpc-wrs-vxworks-spe
 powerpc-xcoff-lynxos178				powerpc-xcoff-lynxos178
 powerpc64					powerpc64-unknown-none
+powerpc64-wrs-vxworks				powerpc64-wrs-vxworks
 powerpc64le					powerpc64le-unknown-none
 powerpcle					powerpcle-unknown-none
 powerpcspe					powerpcspe-unknown-none
@@ -590,11 +599,13 @@ riscv64-company-elf				riscv64-company-elf
 riscv64-elf					riscv64-unknown-elf
 riscv64-hcos					riscv64-unknown-hcos
 riscv64-linux					riscv64-unknown-linux-gnu
+riscv32-wrs-vxworks				riscv32-wrs-vxworks
 riscv32be					riscv32be-unknown-none
 riscv32be-company-elf				riscv32be-company-elf
 riscv32be-company-hcos				riscv32be-company-hcos
 riscv32be-elf					riscv32be-unknown-elf
 riscv32be-linux					riscv32be-unknown-linux-gnu
+riscv64-wrs-vxworks				riscv64-wrs-vxworks
 riscv64be					riscv64be-unknown-none
 riscv64be-company-elf				riscv64be-company-elf
 riscv64be-elf					riscv64be-unknown-elf
@@ -809,6 +820,9 @@ x86_64-sortix					x86_64-pc-sortix
 x86_64-twizzler				x86_64-pc-twizzler
 x86_64-unknown-ptx				x86_64-sequent-ptx
 x86_64-windows					x86_64-pc-windows
+x86_64-wrs-vxworks				x86_64-wrs-vxworks
+x86_64-wrs-vxworks-simlinux			x86_64-wrs-vxworks-simlinux
+x86_64-wrs-vxworks-simwindows			x86_64-wrs-vxworks-simwindows
 xbox						i686-pc-mingw32
 xc16x						xc16x-unknown-none
 xc16x-elf					xc16x-unknown-elf
-- 
2.17.1

