OK, now that the idempotency checks are in, here is a new version of the deduplication. I broke it up more, and added often-extensive notes on each step in the ChangeLog. All of them past the testsuite, but the last one (alone) make some basic_machine patterns not in the form `vendor-machine` as dead code. We should triage those cases before that patch is applied.

Cheers,
John
From 630d61c8e93b2ecbf88534c3dfce68668426d410 Mon Sep 17 00:00:00 2001
Message-Id: 
<630d61c8e93b2ecbf88534c3dfce68668426d410.1533797562.git.John.Ericson@Obsidian.Systems>
From: John Ericson <John.Ericson@Obsidian.Systems>
Date: Mon, 30 Jul 2018 10:36:00 -0400
Subject: [PATCH 1/6]     * config.sub: Move manufacture-defaultint patterns to
 the top
To: config-patches@gnu.org

---
 ChangeLog  |  10 ++++++
 config.sub | 103 +++++++++++++++++++++++++++--------------------------
 2 files changed, 62 insertions(+), 51 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f79ad5f..e6bad15 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2018-08-08  John Ericson  <john.ericson@obsidian.systems>
+
+       * config.sub: Move manufacture-defaultint patterns to the top
+
+       Eventually the glob patterns should always go last. That way
+       previous patterns can refine them by being more specific. These
+       manufacture-defaulting patterns right now are in the form `foo`,
+       but would eventually be in the form `foo-unknown` so as to default
+       the vendor without overriding it more completely.
+
 2018-08-08  John Ericson  <john.ericson@obsidian.systems>
 
        * config.sub: Eliminate some dead code for SH targets.
diff --git a/config.sub b/config.sub
index 97d38aa..3a7b60c 100755
--- a/config.sub
+++ b/config.sub
@@ -564,6 +564,57 @@ esac
 
 # Decode aliases for certain CPU-COMPANY combinations.
 case $basic_machine in
+       # Here we handle the default manufacturer of certain CPU types.  It is 
in
+       # some cases the only manufacturer, in others, it is the most popular.
+       w89k)
+               basic_machine=hppa1.1-winbond
+               ;;
+       op50n)
+               basic_machine=hppa1.1-oki
+               ;;
+       op60c)
+               basic_machine=hppa1.1-oki
+               ;;
+       romp)
+               basic_machine=romp-ibm
+               ;;
+       mmix)
+               basic_machine=mmix-knuth
+               ;;
+       rs6000)
+               basic_machine=rs6000-ibm
+               ;;
+       vax)
+               basic_machine=vax-dec
+               ;;
+       pdp11)
+               basic_machine=pdp11-dec
+               ;;
+       we32k)
+               basic_machine=we32k-att
+               ;;
+       cydra)
+               basic_machine=cydra-cydrome
+               ;;
+       i370-ibm* | ibm*)
+               basic_machine=i370-ibm
+               ;;
+       orion)
+               basic_machine=orion-highlevel
+               ;;
+       orion105)
+               basic_machine=clipper-highlevel
+               ;;
+       mac | mpw | mac-mpw)
+               basic_machine=m68k-apple
+               ;;
+       pmac | pmac-mpw)
+               basic_machine=powerpc-apple
+               ;;
+       xps | xps100)
+               basic_machine=xps100-honeywell
+               ;;
+
        # Recognize the basic CPU types without company name.
        # Some are omitted here because they have special meanings below.
        1750a | 580 \
@@ -718,7 +769,7 @@ case $basic_machine in
        | h8300-* | h8500-* \
        | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
        | hexagon-* \
-       | i*86-* | i860-* | i960-* | ia16-* | ia64-* \
+       | i370-* | i*86-* | i860-* | i960-* | ia16-* | ia64-* \
        | ip2k-* | iq2000-* \
        | k1om-* \
        | le32-* | le64-* \
@@ -956,9 +1007,6 @@ case $basic_machine in
        hp9k8[0-9][0-9] | hp8[0-9][0-9])
                basic_machine=hppa1.0-hp
                ;;
-       i370-ibm* | ibm*)
-               basic_machine=i370-ibm
-               ;;
        i*86v32)
                basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
                os=sysv32
@@ -1218,9 +1266,6 @@ case $basic_machine in
        x64)
                basic_machine=x86_64-pc
                ;;
-       xps | xps100)
-               basic_machine=xps100-honeywell
-               ;;
        xscale-* | xscalee[bl]-*)
                basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'`
                ;;
@@ -1228,50 +1273,6 @@ case $basic_machine in
                basic_machine=none-none
                ;;
 
-# Here we handle the default manufacturer of certain CPU types.  It is in
-# some cases the only manufacturer, in others, it is the most popular.
-       w89k)
-               basic_machine=hppa1.1-winbond
-               ;;
-       op50n)
-               basic_machine=hppa1.1-oki
-               ;;
-       op60c)
-               basic_machine=hppa1.1-oki
-               ;;
-       romp)
-               basic_machine=romp-ibm
-               ;;
-       mmix)
-               basic_machine=mmix-knuth
-               ;;
-       rs6000)
-               basic_machine=rs6000-ibm
-               ;;
-       vax)
-               basic_machine=vax-dec
-               ;;
-       pdp11)
-               basic_machine=pdp11-dec
-               ;;
-       we32k)
-               basic_machine=we32k-att
-               ;;
-       cydra)
-               basic_machine=cydra-cydrome
-               ;;
-       orion)
-               basic_machine=orion-highlevel
-               ;;
-       orion105)
-               basic_machine=clipper-highlevel
-               ;;
-       mac | mpw | mac-mpw)
-               basic_machine=m68k-apple
-               ;;
-       pmac | pmac-mpw)
-               basic_machine=powerpc-apple
-               ;;
        *)
                echo Invalid configuration \`"$1"\': machine 
\`"$basic_machine"\' not recognized 1>&2
                exit 1
-- 
2.17.1

From 24d01a7231253ae32256829f330a796f15195557 Mon Sep 17 00:00:00 2001
Message-Id: 
<24d01a7231253ae32256829f330a796f15195557.1533797562.git.John.Ericson@Obsidian.Systems>
In-Reply-To: 
<630d61c8e93b2ecbf88534c3dfce68668426d410.1533797562.git.John.Ericson@Obsidian.Systems>
References: 
<630d61c8e93b2ecbf88534c3dfce68668426d410.1533797562.git.John.Ericson@Obsidian.Systems>
From: John Ericson <John.Ericson@Obsidian.Systems>
Date: Fri, 22 Jun 2018 17:40:14 -0400
Subject: [PATCH 2/6]     * config.sub: Make a few `basic_machine's short-hands
 only.
To: config-patches@gnu.org

---
 ChangeLog  |   9 +++++
 config.sub | 100 +++++++++++++++++++++++++++++------------------------
 2 files changed, 64 insertions(+), 45 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e6bad15..ee1c4c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2018-08-08  John Ericson  <john.ericson@obsidian.systems>
+
+       * config.sub: Make a few `basic_machine's short-hands only.
+
+       These are all compant names or somilar. That makes them unsuitable
+       to be `basic_machine`a in their own right as the arch part is
+       blatantly missing. We keep them as single-component aliases only
+       for historical compatability.
+
 2018-08-08  John Ericson  <john.ericson@obsidian.systems>
 
        * config.sub: Move manufacture-defaultint patterns to the top
diff --git a/config.sub b/config.sub
index 3a7b60c..4166796 100755
--- a/config.sub
+++ b/config.sub
@@ -2,7 +2,7 @@
 # Configuration validation subroutine script.
 #   Copyright 1992-2018 Free Software Foundation, Inc.
 
-timestamp='2018-07-25'
+timestamp='2018-07-30'
 
 # 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
@@ -190,6 +190,14 @@ case $1 in
                                basic_machine=m68010-adobe
                                os=scout
                                ;;
+                       alliant)
+                               basic_machine=fx80-alliant
+                               os=
+                               ;;
+                       altos | altos3068)
+                               basic_machine=m68k-altos
+                               os=
+                               ;;
                        am29k)
                                basic_machine=a29k-none
                                os=bsd
@@ -234,6 +242,26 @@ case $1 in
                                basic_machine=arm-unknown
                                os=cegcc
                                ;;
+                       convex-c1)
+                               basic_machine=c1-convex
+                               os=bsd
+                               ;;
+                       convex-c2)
+                               basic_machine=c2-convex
+                               os=bsd
+                               ;;
+                       convex-c32)
+                               basic_machine=c32-convex
+                               os=bsd
+                               ;;
+                       convex-c34)
+                               basic_machine=c34-convex
+                               os=bsd
+                               ;;
+                       convex-c38)
+                               basic_machine=c38-convex
+                               os=bsd
+                               ;;
                        cray)
                                basic_machine=j90-cray
                                os=unicos
@@ -242,6 +270,9 @@ case $1 in
                                basic_machine=craynv-cray
                                os=unicosmp
                                ;;
+                       crds | unos)
+                               basic_machine=m68k-crds
+                               ;;
                        delta88)
                                basic_machine=m88k-motorola
                                os=sysv3
@@ -458,10 +489,18 @@ case $1 in
                                basic_machine=m68k-bull
                                os=sysv2
                                ;;
+                       st2000)
+                               basic_machine=m68k-tandem
+                               os=
+                               ;;
                        stratus)
                                basic_machine=i860-stratus
                                os=sysv4
                                ;;
+                       sun2)
+                               basic_machine=m68000-sun
+                               os=
+                               ;;
                        sun2os3)
                                basic_machine=m68000-sun
                                os=sunos3
@@ -470,6 +509,10 @@ case $1 in
                                basic_machine=m68000-sun
                                os=sunos4
                                ;;
+                       sun3)
+                               basic_machine=m68k-sun
+                               os=
+                               ;;
                        sun3os3)
                                basic_machine=m68k-sun
                                os=sunos3
@@ -478,6 +521,10 @@ case $1 in
                                basic_machine=m68k-sun
                                os=sunos4
                                ;;
+                       sun4)
+                               basic_machine=sparc-sun
+                               os=
+                               ;;
                        sun4os3)
                                basic_machine=sparc-sun
                                os=sunos3
@@ -490,6 +537,10 @@ case $1 in
                                basic_machine=sparc-sun
                                os=solaris2
                                ;;
+                       sun386 | sun386i | roadrunner)
+                               basic_machine=i386-sun
+                               os=
+                               ;;
                        sv1)
                                basic_machine=sv1-cray
                                os=unicos
@@ -566,6 +617,9 @@ esac
 case $basic_machine in
        # Here we handle the default manufacturer of certain CPU types.  It is 
in
        # some cases the only manufacturer, in others, it is the most popular.
+       fx80)
+               basic_machine=fx80-alliant
+               ;;
        w89k)
                basic_machine=hppa1.1-winbond
                ;;
@@ -851,12 +905,6 @@ case $basic_machine in
        3b*)
                basic_machine=we32k-att
                ;;
-       alliant | fx80)
-               basic_machine=fx80-alliant
-               ;;
-       altos | altos3068)
-               basic_machine=m68k-altos
-               ;;
        amd64)
                basic_machine=x86_64-pc
                ;;
@@ -887,33 +935,10 @@ case $basic_machine in
                basic_machine=c90-cray
                os=${os:-unicos}
                ;;
-       convex-c1)
-               basic_machine=c1-convex
-               os=bsd
-               ;;
-       convex-c2)
-               basic_machine=c2-convex
-               os=bsd
-               ;;
-       convex-c32)
-               basic_machine=c32-convex
-               os=bsd
-               ;;
-       convex-c34)
-               basic_machine=c34-convex
-               os=bsd
-               ;;
-       convex-c38)
-               basic_machine=c38-convex
-               os=bsd
-               ;;
        cr16 | cr16-*)
                basic_machine=cr16-unknown
                os=${os:-elf}
                ;;
-       crds | unos)
-               basic_machine=m68k-crds
-               ;;
        crisv32 | crisv32-* | etraxfs*)
                basic_machine=crisv32-axis
                ;;
@@ -1219,24 +1244,9 @@ case $basic_machine in
        spur)
                basic_machine=spur-unknown
                ;;
-       st2000)
-               basic_machine=m68k-tandem
-               ;;
        strongarm-* | thumb-*)
                basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'`
                ;;
-       sun2)
-               basic_machine=m68000-sun
-               ;;
-       sun3 | sun3-*)
-               basic_machine=m68k-sun
-               ;;
-       sun4)
-               basic_machine=sparc-sun
-               ;;
-       sun386 | sun386i | roadrunner)
-               basic_machine=i386-sun
-               ;;
        tile*-*)
                ;;
        tile*)
-- 
2.17.1

From aa2deddd4c7131fa28cca483f94dc5d2995d182b Mon Sep 17 00:00:00 2001
Message-Id: 
<aa2deddd4c7131fa28cca483f94dc5d2995d182b.1533797562.git.John.Ericson@Obsidian.Systems>
In-Reply-To: 
<24d01a7231253ae32256829f330a796f15195557.1533797562.git.John.Ericson@Obsidian.Systems>
References: 
<630d61c8e93b2ecbf88534c3dfce68668426d410.1533797562.git.John.Ericson@Obsidian.Systems>
        
<24d01a7231253ae32256829f330a796f15195557.1533797562.git.John.Ericson@Obsidian.Systems>
From: John Ericson <John.Ericson@Obsidian.Systems>
Date: Mon, 30 Jul 2018 13:00:25 -0400
Subject: [PATCH 3/6]     * config.sub: Move back craynv as a `basic_machine`
 pattern     * testsuite/config-sub.data: Add test for craynv
To: config-patches@gnu.org

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

diff --git a/ChangeLog b/ChangeLog
index ee1c4c1..99f9824 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2018-08-08  John Ericson  <john.ericson@obsidian.systems>
+
+       * config.sub: Move back craynv as a `basic_machine` pattern
+       * testsuite/config-sub.data: Add test for craynv
+
+       This is in fact a valid archecture, even though it also contains
+       "cray" the company name, and thus may look like some shorthand.
+       Adding a test to make sure we accept it (tested via the
+       ideompotency check).
+
 2018-08-08  John Ericson  <john.ericson@obsidian.systems>
 
        * config.sub: Make a few `basic_machine's short-hands only.
diff --git a/config.sub b/config.sub
index 4166796..3d3f3f7 100755
--- a/config.sub
+++ b/config.sub
@@ -266,10 +266,6 @@ case $1 in
                                basic_machine=j90-cray
                                os=unicos
                                ;;
-                       craynv)
-                               basic_machine=craynv-cray
-                               os=unicosmp
-                               ;;
                        crds | unos)
                                basic_machine=m68k-crds
                                ;;
@@ -617,6 +613,10 @@ esac
 case $basic_machine in
        # Here we handle the default manufacturer of certain CPU types.  It is 
in
        # some cases the only manufacturer, in others, it is the most popular.
+       craynv)
+               basic_machine=craynv-cray
+               os=${os:-unicosmp}
+               ;;
        fx80)
                basic_machine=fx80-alliant
                ;;
diff --git a/testsuite/config-sub.data b/testsuite/config-sub.data
index 1491c40..8f613a7 100644
--- a/testsuite/config-sub.data
+++ b/testsuite/config-sub.data
@@ -129,6 +129,7 @@ cr16-elf                                    cr16-unknown-elf
 cr16-random-elf                                        cr16-unknown-elf
 cris-linux                                     cris-axis-linux-gnu
 crisv32-linux                                  crisv32-axis-linux-gnu
+craynv                                         craynv-cray-unicosmp
 csky-linux                                     csky-unknown-linux-gnu
 d10v                                           d10v-unknown-none
 d30v                                           d30v-unknown-none
-- 
2.17.1

From cf0f58b6e63ef520e7ea5e240df43b46f51a1458 Mon Sep 17 00:00:00 2001
Message-Id: 
<cf0f58b6e63ef520e7ea5e240df43b46f51a1458.1533797562.git.John.Ericson@Obsidian.Systems>
In-Reply-To: 
<aa2deddd4c7131fa28cca483f94dc5d2995d182b.1533797562.git.John.Ericson@Obsidian.Systems>
References: 
<630d61c8e93b2ecbf88534c3dfce68668426d410.1533797562.git.John.Ericson@Obsidian.Systems>
        
<24d01a7231253ae32256829f330a796f15195557.1533797562.git.John.Ericson@Obsidian.Systems>
        
<aa2deddd4c7131fa28cca483f94dc5d2995d182b.1533797562.git.John.Ericson@Obsidian.Systems>
From: John Ericson <John.Ericson@Obsidian.Systems>
Date: Mon, 30 Jul 2018 13:08:12 -0400
Subject: [PATCH 4/6]     * config.sub: Move some erroneous `foo-*` to be
 1-comp aliases
To: config-patches@gnu.org

---
 ChangeLog  | 30 ++++++++++++++++++++++++++++++
 config.sub | 25 +++++++++++++------------
 2 files changed, 43 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 99f9824..6873193 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
+2018-08-08  John Ericson  <john.ericson@obsidian.systems>
+
+       * config.sub: Move some erroneous `foo-*` to be 1-comp aliases
+
+       The `foo-*` versions were introduced in
+       5347fada50a3a3e689c2654515145457af92965e
+       1bf0fb0812846ace88f93937e90162e2835c6b11
+       ab3a1065d559246c2c0422513e04369f49639c62, and then right after
+       augmented with the `foo` versions in
+       1d62957bb23205508ea3eb7c790e431646fad6ae right after.
+
+       I think that commit didn't go far enough, in in that the original
+       `foo-*` verions should have also been removed:
+
+        - "foo" is closer to a company name than arch name, so they are
+          in no way a proper 2-component basic name. That would mean
+          there's one companny name in the original `basic_machine`
+          that's ignored, and the other that is defaulted with some arch.
+          That seems arbitrary.
+
+        - "foo-*" being radically normalized, but "foo" not being, is
+          just inconsistent.
+
+       In addition, I also move the rest to be single component aliases
+       as they are company names or product lines.
+
+       This is a breaking change, but not one I'd expect to matter since
+       all these machines are ancient and the tests still pass without
+       modification.
+
 2018-08-08  John Ericson  <john.ericson@obsidian.systems>
 
        * config.sub: Move back craynv as a `basic_machine` pattern
diff --git a/config.sub b/config.sub
index 3d3f3f7..e858b5f 100755
--- a/config.sub
+++ b/config.sub
@@ -206,6 +206,10 @@ case $1 in
                                basic_machine=580-amdahl
                                os=sysv
                                ;;
+                       amiga)
+                               basic_machine=m68k-unknown
+                               os=
+                               ;;
                        amigaos | amigados)
                                basic_machine=m68k-unknown
                                os=amigaos
@@ -269,6 +273,12 @@ case $1 in
                        crds | unos)
                                basic_machine=m68k-crds
                                ;;
+                       da3)
+                               basic_machine=m68k-da30
+                               ;;
+                       decstation | decstation-3100 | pmax | pmin | dec3100 | 
decstatn)
+                               basic_machine=mips-dec
+                               ;;
                        delta88)
                                basic_machine=m88k-motorola
                                os=sysv3
@@ -313,6 +323,9 @@ case $1 in
                                basic_machine=m88k-harris
                                os=sysv3
                                ;;
+                       hp300)
+                               basic_machine=m68k-hp
+                               ;;
                        hp300bsd)
                                basic_machine=m68k-hp
                                os=bsd
@@ -911,9 +924,6 @@ case $basic_machine in
        amd64-*)
                basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
                ;;
-       amiga | amiga-*)
-               basic_machine=m68k-unknown
-               ;;
        blackfin-*)
                basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'`
                os=linux
@@ -949,12 +959,6 @@ case $basic_machine in
                basic_machine=crx-unknown
                os=${os:-elf}
                ;;
-       da30 | da30-*)
-               basic_machine=m68k-da30
-               ;;
-       decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | 
decstatn)
-               basic_machine=mips-dec
-               ;;
        decsystem10* | dec10*)
                basic_machine=pdp10-dec
                os=tops10
@@ -1000,9 +1004,6 @@ case $basic_machine in
                basic_machine=hppa1.1-hitachi
                os=hiuxwe2
                ;;
-       hp300-*)
-               basic_machine=m68k-hp
-               ;;
        hp3k9[0-9][0-9] | hp9[0-9][0-9])
                basic_machine=hppa1.0-hp
                ;;
-- 
2.17.1

From 4dc42aa7ff75552dedf7f65add63bca3af537417 Mon Sep 17 00:00:00 2001
Message-Id: 
<4dc42aa7ff75552dedf7f65add63bca3af537417.1533797562.git.John.Ericson@Obsidian.Systems>
In-Reply-To: 
<cf0f58b6e63ef520e7ea5e240df43b46f51a1458.1533797562.git.John.Ericson@Obsidian.Systems>
References: 
<630d61c8e93b2ecbf88534c3dfce68668426d410.1533797562.git.John.Ericson@Obsidian.Systems>
        
<24d01a7231253ae32256829f330a796f15195557.1533797562.git.John.Ericson@Obsidian.Systems>
        
<aa2deddd4c7131fa28cca483f94dc5d2995d182b.1533797562.git.John.Ericson@Obsidian.Systems>
        
<cf0f58b6e63ef520e7ea5e240df43b46f51a1458.1533797562.git.John.Ericson@Obsidian.Systems>
From: John Ericson <John.Ericson@Obsidian.Systems>
Date: Thu, 9 Aug 2018 02:31:04 -0400
Subject: [PATCH 5/6]     * config.sub: Combine match arms
To: config-patches@gnu.org

---
 ChangeLog  |  6 ++++++
 config.sub | 16 ++++------------
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6873193..20cff86 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2018-08-08  John Ericson  <john.ericson@obsidian.systems>
+
+       * config.sub: Combine match arms
+
+       These need no special handling.
+
 2018-08-08  John Ericson  <john.ericson@obsidian.systems>
 
        * config.sub: Move some erroneous `foo-*` to be 1-comp aliases
diff --git a/config.sub b/config.sub
index e858b5f..bab5bf7 100755
--- a/config.sub
+++ b/config.sub
@@ -710,6 +710,7 @@ case $basic_machine in
        | le32 | le64 \
        | lm32 \
        | m32c | m32r | m32rle | m68000 | m68k | m88k \
+       | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip \
        | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
        | mips | mipsbe | mipseb | mipsel | mipsle \
        | mips16 \
@@ -758,7 +759,7 @@ case $basic_machine in
        | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
        | visium \
        | wasm32 \
-       | x86 | xc16x | xstormy16 | xtensa \
+       | x86 | xc16x | xstormy16 | xgate | xtensa \
        | z8k | z80)
                basic_machine=$basic_machine-unknown
                ;;
@@ -774,11 +775,6 @@ case $basic_machine in
        leon|leon[3-9])
                basic_machine=sparc-$basic_machine
                ;;
-       m6811-* | m68hc11-* | m6812-* | m68hc12-* | m68hcs12x-* | nvptx-* | 
picochip-*)
-               ;;
-       m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
-               basic_machine=$basic_machine-unknown
-               ;;
        m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65)
                ;;
        m9s12z | m68hcs12z | hcs12z | s12z)
@@ -793,11 +789,6 @@ case $basic_machine in
        strongarm | thumb | xscale)
                basic_machine=arm-unknown
                ;;
-       xgate)
-               basic_machine=$basic_machine-unknown
-               ;;
-       xgate-*)
-               ;;
        xscaleeb)
                basic_machine=armeb-unknown
                ;;
@@ -843,6 +834,7 @@ case $basic_machine in
        | lm32-* \
        | m32c-* | m32r-* | m32rle-* \
        | m5200-* | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* | 
v70-* | w65-* \
+       | m6811-* | m68hc11-* | m6812-* | m68hc12-* | m68hcs12x-* | nvptx-* | 
picochip-* \
        | m88110-* | m88k-* | maxq-* | mb-* | mcore-* | mep-* | metag-* \
        | microblaze-* | microblazeel-* \
        | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
@@ -901,7 +893,7 @@ case $basic_machine in
        | visium-* \
        | wasm32-* \
        | we32k-* \
-       | x86-* | x86_64-* | xc16x-* | xps100-* \
+       | x86-* | x86_64-* | xc16x-* | xgate-* | xps100-* \
        | xstormy16-* | xtensa*-* \
        | ymp-* \
        | z8k-* | z80-*)
-- 
2.17.1

From e959fd87fe8dda4e596adaf28c0c52e431a2bdf1 Mon Sep 17 00:00:00 2001
Message-Id: 
<e959fd87fe8dda4e596adaf28c0c52e431a2bdf1.1533797562.git.John.Ericson@Obsidian.Systems>
In-Reply-To: 
<4dc42aa7ff75552dedf7f65add63bca3af537417.1533797562.git.John.Ericson@Obsidian.Systems>
References: 
<630d61c8e93b2ecbf88534c3dfce68668426d410.1533797562.git.John.Ericson@Obsidian.Systems>
        
<24d01a7231253ae32256829f330a796f15195557.1533797562.git.John.Ericson@Obsidian.Systems>
        
<aa2deddd4c7131fa28cca483f94dc5d2995d182b.1533797562.git.John.Ericson@Obsidian.Systems>
        
<cf0f58b6e63ef520e7ea5e240df43b46f51a1458.1533797562.git.John.Ericson@Obsidian.Systems>
        
<4dc42aa7ff75552dedf7f65add63bca3af537417.1533797562.git.John.Ericson@Obsidian.Systems>
From: John Ericson <John.Ericson@Obsidian.Systems>
Date: Fri, 22 Jun 2018 17:40:14 -0400
Subject: [PATCH 6/6]     * config.sub: Deduplicate `basic_machine` by filling
 in a stub vendor.
To: config-patches@gnu.org

---
 ChangeLog  |  24 +++++++
 config.sub | 203 +++++++++++++----------------------------------------
 2 files changed, 74 insertions(+), 153 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 20cff86..0a65d0d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2018-07-23  John Ericson  <john.ericson@obsidian.systems>
+
+       * config.sub: Deduplicate `basic_machine` by filling in a stub vendor.
+
+       Instead of having both `foo` and `foo-*` as redundant patterns, we
+       always make sure basic_machine is initialized in the form `*-*` by
+       adding a trailing `-unknown` where needed.
+
+       There was one complication to doing this that should be noted. For
+       x86, the default is `-pc` instead of `-unknown`. That means we
+       can't just always append 1-component `basic_machine`s with
+       `-unknown` and assume 2-component everywhere.  Furthermore, an
+       explicitly passed `*-unknown` for x86 is not normalized by that
+       rule but instead left as-is. That means we cannot just append and
+       also conditionally replace `-unknown` with `-pc` as a final step,
+       either.
+
+       The solution is to continue duplicating the rules which would
+       output a `(i386|x86_64)-pc` so we can ensure the special case is
+       maintained, while defaulting to `-unknown` otherwise so the `*-*`
+       rules are sufficient. This isn't ideal, but at least most of the
+       `basic_machine` rules aren't implicated and can still be
+       deduplicated.
+
 2018-08-08  John Ericson  <john.ericson@obsidian.systems>
 
        * config.sub: Combine match arms
diff --git a/config.sub b/config.sub
index bab5bf7..2e4a661 100755
--- a/config.sub
+++ b/config.sub
@@ -622,15 +622,36 @@ case $1 in
                ;;
 esac
 
+case $basic_machine in
+       *-*)
+               ;;
+       # We use `pc' rather than `unknown'
+       # because (1) that's what they normally are, and
+       # (2) the word "unknown" tends to confuse beginning users.
+       i*86 | x86_64)
+               basic_machine=$basic_machine-pc
+               ;;
+       # These rules are duplicated from below for sake of the special case 
above;
+       # i.e. things that normalized to x86 arches should also default to "pc"
+       pc98)
+               basic_machine=i386-pc
+               ;;
+       x64 | amd64)
+               basic_machine=x86_64-pc
+               ;;
+       *)
+               basic_machine=$basic_machine-unknown
+esac
+
 # Decode aliases for certain CPU-COMPANY combinations.
 case $basic_machine in
        # Here we handle the default manufacturer of certain CPU types.  It is 
in
        # some cases the only manufacturer, in others, it is the most popular.
-       craynv)
+       craynv-unknown)
                basic_machine=craynv-cray
                os=${os:-unicosmp}
                ;;
-       fx80)
+       fx80-unknown)
                basic_machine=fx80-alliant
                ;;
        w89k)
@@ -642,31 +663,31 @@ case $basic_machine in
        op60c)
                basic_machine=hppa1.1-oki
                ;;
-       romp)
+       romp-unknown)
                basic_machine=romp-ibm
                ;;
-       mmix)
+       mmix-unknown)
                basic_machine=mmix-knuth
                ;;
-       rs6000)
+       rs6000-unknown)
                basic_machine=rs6000-ibm
                ;;
-       vax)
+       vax-unknown)
                basic_machine=vax-dec
                ;;
-       pdp11)
+       pdp11-unknown)
                basic_machine=pdp11-dec
                ;;
-       we32k)
+       we32k-unknown)
                basic_machine=we32k-att
                ;;
-       cydra)
+       cydra-unknown)
                basic_machine=cydra-cydrome
                ;;
        i370-ibm* | ibm*)
                basic_machine=i370-ibm
                ;;
-       orion)
+       orion-unknown)
                basic_machine=orion-highlevel
                ;;
        orion105)
@@ -678,131 +699,10 @@ case $basic_machine in
        pmac | pmac-mpw)
                basic_machine=powerpc-apple
                ;;
-       xps | xps100)
+       xps-unknown | xps100-unknown)
                basic_machine=xps100-honeywell
                ;;
 
-       # Recognize the basic CPU types without company name.
-       # Some are omitted here because they have special meanings below.
-       1750a | 580 \
-       | a29k \
-       | aarch64 | aarch64_be \
-       | abacus \
-       | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
-       | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | 
alpha64pca5[67] \
-       | am33_2.0 \
-       | arc | arceb \
-       | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv6m | 
armv[78][arm] \
-       | avr | avr32 \
-       | asmjs \
-       | ba \
-       | be32 | be64 \
-       | bfin \
-       | c4x | c8051 | clipper | csky \
-       | d10v | d30v | dlx | dsp16xx \
-       | e2k | epiphany \
-       | fido | fr30 | frv | ft32 \
-       | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
-       | hexagon \
-       | i370 | i860 | i960 | ia16 | ia64 \
-       | ip2k | iq2000 \
-       | k1om \
-       | le32 | le64 \
-       | lm32 \
-       | m32c | m32r | m32rle | m68000 | m68k | m88k \
-       | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip \
-       | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
-       | mips | mipsbe | mipseb | mipsel | mipsle \
-       | mips16 \
-       | mips64 | mips64el \
-       | mips64octeon | mips64octeonel \
-       | mips64orion | mips64orionel \
-       | mips64r5900 | mips64r5900el \
-       | mips64vr | mips64vrel \
-       | mips64vr4100 | mips64vr4100el \
-       | mips64vr4300 | mips64vr4300el \
-       | mips64vr5000 | mips64vr5000el \
-       | mips64vr5900 | mips64vr5900el \
-       | mipsisa32 | mipsisa32el \
-       | mipsisa32r2 | mipsisa32r2el \
-       | mipsisa32r6 | mipsisa32r6el \
-       | mipsisa64 | mipsisa64el \
-       | mipsisa64r2 | mipsisa64r2el \
-       | mipsisa64r6 | mipsisa64r6el \
-       | mipsisa64sb1 | mipsisa64sb1el \
-       | mipsisa64sr71k | mipsisa64sr71kel \
-       | mipsr5900 | mipsr5900el \
-       | mipstx39 | mipstx39el \
-       | mn10200 | mn10300 \
-       | moxie \
-       | mt \
-       | msp430 \
-       | nds32 | nds32le | nds32be \
-       | nfp \
-       | nios | nios2 | nios2eb | nios2el \
-       | ns16k | ns32k \
-       | open8 | or1k | or1knd | or32 \
-       | pdp10 | pj | pjl \
-       | powerpc | powerpc64 | powerpc64le | powerpcle \
-       | pru \
-       | pyramid \
-       | riscv | riscv32 | riscv64 \
-       | rl78 | rx \
-       | score \
-       | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | 
shbe | shle | sh[1234]le | sh[23]ele \
-       | sh64 | sh64le \
-       | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | 
sparclite \
-       | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
-       | spu \
-       | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
-       | ubicom32 \
-       | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
-       | visium \
-       | wasm32 \
-       | x86 | xc16x | xstormy16 | xgate | xtensa \
-       | z8k | z80)
-               basic_machine=$basic_machine-unknown
-               ;;
-       c54x)
-               basic_machine=tic54x-unknown
-               ;;
-       c55x)
-               basic_machine=tic55x-unknown
-               ;;
-       c6x)
-               basic_machine=tic6x-unknown
-               ;;
-       leon|leon[3-9])
-               basic_machine=sparc-$basic_machine
-               ;;
-       m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65)
-               ;;
-       m9s12z | m68hcs12z | hcs12z | s12z)
-               basic_machine=s12z-unknown
-               ;;
-       m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
-               basic_machine=s12z-`echo "$basic_machine" | sed 's/^[^-]*-//'`
-               ;;
-       ms1)
-               basic_machine=mt-unknown
-               ;;
-       strongarm | thumb | xscale)
-               basic_machine=arm-unknown
-               ;;
-       xscaleeb)
-               basic_machine=armeb-unknown
-               ;;
-
-       xscaleel)
-               basic_machine=armel-unknown
-               ;;
-
-       # We use `pc' rather than `unknown'
-       # because (1) that's what they normally are, and
-       # (2) the word "unknown" tends to confuse beginning users.
-       i*86 | x86_64)
-         basic_machine=$basic_machine-pc
-         ;;
        # Recognize the basic CPU types with company name.
        1750a-* | 580-* \
        | a29k-* \
@@ -898,10 +798,6 @@ case $basic_machine in
        | ymp-* \
        | z8k-* | z80-*)
                ;;
-       # Recognize the basic CPU types without company name, with glob match.
-       xtensa*)
-               basic_machine=$basic_machine-unknown
-               ;;
        # Recognize the various machine names and aliases which stand
        # for a CPU type and a company and sometimes even an OS.
        3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
@@ -937,14 +833,17 @@ case $basic_machine in
                basic_machine=c90-cray
                os=${os:-unicos}
                ;;
-       cr16 | cr16-*)
+       cr16-*)
                basic_machine=cr16-unknown
                os=${os:-elf}
                ;;
-       crisv32 | crisv32-* | etraxfs*)
+       crds | unos)
+               basic_machine=m68k-crds
+               ;;
+       crisv32-* | etraxfs*)
                basic_machine=crisv32-axis
                ;;
-       cris | cris-* | etrax*)
+       cris-* | etrax*)
                basic_machine=cris-axis
                ;;
        crx)
@@ -963,7 +862,7 @@ case $basic_machine in
              | 3300-motorola | delta-motorola)
                basic_machine=m68k-motorola
                ;;
-       dpx20 | dpx20-*)
+       dpx20-*)
                basic_machine=rs6000-bull
                os=${os:-bosx}
                ;;
@@ -1062,6 +961,10 @@ case $basic_machine in
                basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'`
                os=linux
                ;;
+       m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
+               basic_machine=s12z-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+               os=${os:-none}
+               ;;
        microblaze*)
                basic_machine=microblaze-xilinx
                ;;
@@ -1137,12 +1040,9 @@ case $basic_machine in
        pbb)
                basic_machine=m68k-tti
                ;;
-       pc532 | pc532-*)
+       pc532-*)
                basic_machine=ns32k-pc532
                ;;
-       pc98)
-               basic_machine=i386-pc
-               ;;
        pc98-*)
                basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'`
                ;;
@@ -1217,15 +1117,15 @@ case $basic_machine in
        sb1el)
                basic_machine=mipsisa64sb1el-unknown
                ;;
-       sde)
+       sde-unknown)
                basic_machine=mipsisa32-sde
                os=${os:-elf}
                ;;
-       sequent)
+       sequent-unknown)
                basic_machine=i386-sequent
                ;;
-       sh5el)
-               basic_machine=sh5le-unknown
+       sh5e[lb]-*)
+               basic_machine=`echo "$basic_machine" | sed 
's/^\(sh.\)e\(.\)-/\1\2e-/'`
                ;;
        sh5el-*)
                basic_machine=sh5le-`echo "$basic_machine" | sed 's/^[^-]*-//'`
@@ -1241,9 +1141,6 @@ case $basic_machine in
                basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'`
                ;;
        tile*-*)
-               ;;
-       tile*)
-               basic_machine=$basic_machine-unknown
                os=${os:-linux-gnu}
                ;;
        tx39)
@@ -1266,8 +1163,8 @@ case $basic_machine in
                basic_machine=hppa1.1-winbond
                os=proelf
                ;;
-       x64)
-               basic_machine=x86_64-pc
+       x64-*)
+               basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
                ;;
        xscale-* | xscalee[bl]-*)
                basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'`
-- 
2.17.1

_______________________________________________
config-patches mailing list
config-patches@gnu.org
https://lists.gnu.org/mailman/listinfo/config-patches

Reply via email to