Re: * config.sub: Properly parse the KERNEL-OS case.

2020-06-27 Thread Ben Elliston
On Sat, Jun 27, 2020 at 01:04:05PM -0400, John Ericson wrote:

> Here is a new version with a ChangeLog entry that's hopefully
> actually understandable.

Thanks. I think this change is fine. I have no problems with making
config.sub longer in the quest for making it clearer.

Cheers,
Ben



Re: * config.sub: Properly parse the KERNEL-OS case.

2020-06-27 Thread John Ericson
Sorry! It is indeed incomprehensible---I must have been more tired than 
I thought.


Here is a new version with a ChangeLog entry that's hopefully actually 
understandable.


Thanks,

John

On 6/26/20 8:39 AM, Ben Elliston wrote:

John,


I guess I am getting back to the refactoring I was doing before for one last
round, so now finally no two components are ever conflated:

     * config.sub: Properly parse the KERNEL-OS case.

     I previous parsed basic_machine into separate `cpu` and `kernel`
     variables, I parse `basic_os` (a rename of `os` when used early on) into
     `kernel` and `os`.

     Like before, this does make thins a bit longer, but I think it makes the
     code understand and more robust, and so is worth the cost.

Can you please re-write the above? It makes no sense to me.

Thanks,
Ben
>From 8074863028ad652db6add94d4c26e86acb19092c Mon Sep 17 00:00:00 2001
From: John Ericson 
Date: Tue, 23 Jun 2020 18:01:06 -0400
Subject: [PATCH] 	* config.sub: Properly parse the KERNEL-OS case.

	I previously refactored the code to parse `basic_machine` into
	separate `cpu` and `vendor` variables. This is a kindred refactor
	where `basic_os` (a rename of `os` when used early on) is now
	parsed into into `kernel` and `os`.

	Like the previous refactor, this does make things a bit longer.
	But I think the change makes the code easier to understand and
	more robust, so it is worth the cost of the increased size.
---
 ChangeLog  |  13 ++
 config.sub | 517 +
 2 files changed, 293 insertions(+), 237 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c8f6d72..fd28f11 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2020-06-27  John Ericson  
+
+	* config.sub: Properly parse the KERNEL-OS case.
+
+	I previously refactored the code to parse `basic_machine` into
+	separate `cpu` and `vendor` variables. This is a kindred refactor
+	where `basic_os` (a rename of `os` when used early on) is now
+	parsed into into `kernel` and `os`.
+
+	Like the previous refactor, this does make things a bit longer.
+	But I think the change makes the code easier to understand and
+	more robust, so it is worth the cost of the increased size.
+
 2020-06-26  John Ericson  
 
 	* config.sub: Move OS whitelist to the bottom of the case as
diff --git a/config.sub b/config.sub
index 186616a..62f65e0 100755
--- a/config.sub
+++ b/config.sub
@@ -124,28 +124,27 @@ case $1 in
 		;;
 	*-*-*-*)
 		basic_machine=$field1-$field2
-		os=$field3-$field4
+		basic_os=$field3-$field4
 		;;
 	*-*-*)
 		# Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two
 		# parts
 		maybe_os=$field2-$field3
 		case $maybe_os in
-			nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc \
-			| linux-newlib* | linux-musl* | linux-uclibc* | uclinux-uclibc* \
+			nto-qnx* | linux-* | uclinux-uclibc* \
 			| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
 			| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
 			| storm-chaos* | os2-emx* | rtmk-nova*)
 basic_machine=$field1
-os=$maybe_os
+basic_os=$maybe_os
 ;;
 			android-linux)
 basic_machine=$field1-unknown
-os=linux-android
+basic_os=linux-android
 ;;
 			*)
 basic_machine=$field1-$field2
-os=$field3
+basic_os=$field3
 ;;
 		esac
 		;;
@@ -154,7 +153,7 @@ case $1 in
 		case $field1-$field2 in
 			decstation-3100)
 basic_machine=mips-dec
-os=
+basic_os=
 ;;
 			*-*)
 # Second component is usually, but not always the OS
@@ -162,7 +161,7 @@ case $1 in
 	# Prevent following clause from handling this valid os
 	sun*os*)
 		basic_machine=$field1
-		os=$field2
+		basic_os=$field2
 		;;
 	# Manufacturers
 	dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
@@ -175,11 +174,11 @@ case $1 in
 	| microblaze* | sim | cisco \
 	| oki | wec | wrs | winbond)
 		basic_machine=$field1-$field2
-		os=
+		basic_os=
 		;;
 	*)
 		basic_machine=$field1
-		os=$field2
+		basic_os=$field2
 		;;
 esac
 			;;
@@ -191,451 +190,451 @@ case $1 in
 		case $field1 in
 			386bsd)
 basic_machine=i386-pc
-os=bsd
+basic_os=bsd
 ;;
 			a29khif)
 basic_machine=a29k-amd
-os=udi
+basic_os=udi
 ;;
 			adobe68k)
 basic_machine=m68010-adobe
-os=scout
+basic_os=scout
 ;;
 			alliant)
 basic_machine=fx80-alliant
-os=
+basic_os=
 ;;
 			altos | altos3068)
 basic_machine=m68k-altos
-os=
+basic_os=
 ;;
 			am29k)
 basic_machine=a29k-none
-os=bsd
+basic_os=bsd
 ;;
 			amdahl)
 basic_machine=580-amdahl
-os=sysv
+basic_os=sysv
 ;;
 			amiga)
 basic_machine=m68k-unknown
-os=
+basic_os=
 ;;
 			amigaos | amigados)
 basic_machine=m68k-unknown
-os=amigaos
+basic_os=amigaos
 ;;
 			amigaunix | amix)
 basic_machine=m68k-unknown
-os=sysv4
+basic_os=sysv4
 

Re: [PATCH] * config.sub (s390|s390x): Fix vendor output for s390/s390x.

2020-06-27 Thread John Ericson
Ah, sorry I didn't notice that. Here then is patch making the change 
which I requested, for your consideration.


Thanks,

John

On 6/26/20 8:19 AM, Ben Elliston wrote:

On Wed, Jun 24, 2020 at 10:56:08AM -0400, John Ericson wrote:


(disclaimer: I am not the official maintainer, just someone who put
a in a bunch of time reorganizing `config.sub`.)

I applied Alexander's patch last Sunday.

Ben
>From a0a90e796221c6dadc10de1af304a8e0b182bdf6 Mon Sep 17 00:00:00 2001
From: John Ericson 
Date: Sat, 27 Jun 2020 11:16:11 -0400
Subject: [PATCH 1/2] 	* config.sub: Allow CPU to influence vendor defaulting
 too.

---
 ChangeLog  |  4 
 config.sub | 46 +++---
 2 files changed, 27 insertions(+), 23 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c8f6d72..0e33f9d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2020-06-27  John Ericson  
+
+	* config.sub: Allow CPU to influence vendor defaulting too.
+
 2020-06-26  John Ericson  
 
 	* config.sub: Move OS whitelist to the bottom of the case as
diff --git a/config.sub b/config.sub
index 186616a..304e71d 100755
--- a/config.sub
+++ b/config.sub
@@ -1720,71 +1720,71 @@ fi
 # manufacturer.  We pick the logical manufacturer.
 case $vendor in
 	unknown)
-		case $os in
-			riscix*)
+		case $cpu-$os in
+			*-riscix*)
 vendor=acorn
 ;;
-			sunos*)
+			*-sunos*)
 vendor=sun
 ;;
-			cnk*|-aix*)
+			*-cnk* | *-aix*)
 vendor=ibm
 ;;
-			beos*)
+			*-beos*)
 vendor=be
 ;;
-			hpux*)
+			*-hpux*)
 vendor=hp
 ;;
-			mpeix*)
+			*-mpeix*)
 vendor=hp
 ;;
-			hiux*)
+			*-hiux*)
 vendor=hitachi
 ;;
-			unos*)
+			*-unos*)
 vendor=crds
 ;;
-			dgux*)
+			*-dgux*)
 vendor=dg
 ;;
-			luna*)
+			*-luna*)
 vendor=omron
 ;;
-			genix*)
+			*-genix*)
 vendor=ns
 ;;
-			clix*)
+			*-clix*)
 vendor=intergraph
 ;;
-			mvs* | opened*)
+			*-mvs* | *-opened*)
 vendor=ibm
 ;;
-			os400*)
+			*-os400*)
 vendor=ibm
 ;;
-			ptx*)
+			*-ptx*)
 vendor=sequent
 ;;
-			tpf*)
+			*-tpf*)
 vendor=ibm
 ;;
-			vxsim* | vxworks* | windiss*)
+			*-vxsim* | *-vxworks* | *-windiss*)
 vendor=wrs
 ;;
-			aux*)
+			*-aux*)
 vendor=apple
 ;;
-			hms*)
+			*-hms*)
 vendor=hitachi
 ;;
-			mpw* | macos*)
+			*-mpw* | *-macos*)
 vendor=apple
 ;;
-			*mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
+			*-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*)
 vendor=atari
 ;;
-			vos*)
+			*-vos*)
 vendor=stratus
 ;;
 		esac
-- 
2.25.4

>From 7865fcc9131ba149f0518b88e3b03f6323851a32 Mon Sep 17 00:00:00 2001
From: John Ericson 
Date: Sat, 27 Jun 2020 12:14:10 -0400
Subject: [PATCH 2/2] 	* config.sub: Restore s390{,x} IBM defaulting

---
 ChangeLog | 15 +++
 config.sub|  3 +++
 testsuite/config-sub.data | 10 ++
 3 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0e33f9d..ca18be2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2020-06-27  John Ericson  
+
+	* config.sub: Restore s390{,x} IBM defaulting.
+
+	Previously, "ibm" was *forced*, which caused problems when someone wanted
+	to use "busybox" as a vendor and cross compile with a slightly different
+	toolchain. But the fix changed behavior such that without any vendor, it
+	would use to plain "unknown" rather than "IBM" was before.
+
+	This patch tries to compromise between the old and new behavior by making
+	"ibm" a *default* for those CPUs when no vendor is specified, but if the
+	user explicitly gives a vendor that is used instead. This sort of vendor
+	defaulting has plenty of precedent in config.sub, already, so it seemed
+	like a good appraoch.
+
 2020-06-27  John Ericson  
 
 	* config.sub: Allow CPU to influence vendor defaulting too.
diff --git a/config.sub b/config.sub
index 304e71d..6093b0b 100755
--- a/config.sub
+++ b/config.sub
@@ -1763,6 +1763,9 @@ case $vendor in
 			*-os400*)
 vendor=ibm
 ;;
+			s390-* | s390x-*)
+vendor=ibm
+;;
 			*-ptx*)
 vendor=sequent
 ;;
diff --git a/testsuite/config-sub.data b/testsuite/config-sub.data
index c4fe79d..d9639bc 100644
--- a/testsuite/config-sub.data
+++ b/testsuite/config-sub.data
@@ -581,10 +581,12 @@ rs6000		rs6000-ibm-aix
 rx-linux	rx-unknown-linux-gnu
 rx		rx-unknown-none
 s12z		s12z-unknown-none
-s390		s390-unknown-none
-s390x		s390x-unknown-none
-s390-linux	s390-unknown-linux-gnu
-s390x-linux	s390x-unknown-linux-gnu
+s390		s390-ibm-none
+s390x		s390x-ibm-none
+s390-linux	s390-ibm-linux-gnu
+s390x-linux	s390x-ibm-linux-gnu
+s390-busybox-linuxs390-busybox-linux-gnu
+s390x-busybox-linuxs390x-busybox-linux-gnu
 s390-ibm-zvmoe	s390-ibm-zvmoe
 s390x-ibm-zvmoe	s390x-ibm-zvmoe
 sa29200		a29k-amd-udi
-- 
2.25.4