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 were two complications to doing this however, but they were worked around: The first is that for some reason `basic_machine`s in the form `*-unknown` are always accepted, dating back to 3836f7b0c4f252e56aa1124a9b235ba62c2a45da. It is important that we don't allow the inferred `-unknown` to allow nonsense one-component basic machines to pass for the first time. The second is that for x86, the default is `-pc` instead of `-unknown`. That said, an explicitly passed `-unknown` is not normalized by that rule and left as-is. Two tests were nevertheless changed but: -vsta i386-unknown-vsta +vsta i386-pc-vsta Seems like fixing a blatant inconsistency, while: -x86_64-ptx x86_64-pc-ptx +x86_64-ptx x86_64-sequent-ptx Fixes a small regression I previously introduced. The solution in both cases is to distinguish explicit user given from inferred/defaulted `-unknown`s, and use that to implement the existing behavior. For this purpose, the `vendor_inferred` variable was added. For what it's worth, I personally feel we should consider ripping that distinction if it's OK. But I also feel that if we do chose to do that, the change belongs in a separate revision, so this patch is the right first step either way. John --- ChangeLog | 4 + config.sub | 320 +++++++++++++++++----------------------------- testsuite/config-sub.data | 4 +- 3 files changed, 123 insertions(+), 205 deletions(-) diff --git a/ChangeLog b/ChangeLog index 372559c..8586152 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2018-06-22 John Ericson <john.ericson@obsidian.systems> + + * config.sub: Deduplicate `basic_machine` by always allowing the vendor + 2018-05-24 Ben Elliston <b...@gnu.org> * testsuite/config-sub.data: Add tests for Sequent and DYNIX/ptx. diff --git a/config.sub b/config.sub index d1f5b54..8b6e358 100755 --- a/config.sub +++ b/config.sub @@ -2,7 +2,7 @@ # Configuration validation subroutine script. # Copyright 1992-2018 Free Software Foundation, Inc. -timestamp='2018-05-24' +timestamp='2018-06-22' # 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 @@ -124,6 +124,7 @@ case $1 in *-*-*-*) basic_machine=$field1-$field2 os=$field3-$field4 + vendor_inferred= ;; *-*-*) # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two @@ -135,16 +136,19 @@ case $1 in | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ | storm-chaos* | os2-emx* | rtmk-nova*) - basic_machine=$field1 + basic_machine=$field1-unknown os=$maybe_os + vendor_inferred=1 ;; android-linux) basic_machine=$field1-unknown os=linux-android + vendor_inferred= ;; *) basic_machine=$field1-$field2 os=$field3 + vendor_inferred= ;; esac ;; @@ -153,8 +157,9 @@ case $1 in case $field2 in # Prevent following clause from handling this valid os sun*os*) - basic_machine=$field1 + basic_machine=$field1-unknown os=$field2 + vendor_inferred=1 ;; # Manufacturers dec* | mips* | sequent* | encore* | pc532* | sgi* | sony* \ @@ -167,19 +172,22 @@ case $1 in | sim | cisco | oki | wec | wrs | winbond) basic_machine=$field1-$field2 os= + vendor_inferred= ;; *) - basic_machine=$field1 + basic_machine=$field1-unknown os=$field2 + vendor_inferred=1 ;; esac ;; *) + vendor_inferred=1 # Convert single-component short-hands not valid as part of # multi-component configurations. case $field1 in 386bsd) - basic_machine=i386-pc + basic_machine=i386-unknown os=bsd ;; a29khif) @@ -215,7 +223,7 @@ case $1 in os=bsd ;; aros) - basic_machine=i386-pc + basic_machine=i386-unknown os=aros ;; aux) @@ -247,11 +255,11 @@ case $1 in os=sysv3 ;; dicos) - basic_machine=i686-pc + basic_machine=i686-unknown os=dicos ;; djgpp) - basic_machine=i586-pc + basic_machine=i586-unknown os=msdosdjgpp ;; ebmon29k) @@ -267,7 +275,7 @@ case $1 in os=sysv ;; go32) - basic_machine=i386-pc + basic_machine=i386-unknown os=go32 ;; h8300hms) @@ -327,11 +335,11 @@ case $1 in os=sysv ;; mingw64) - basic_machine=x86_64-pc + basic_machine=x86_64-unknown os=mingw64 ;; mingw32) - basic_machine=i686-pc + basic_machine=i686-unknown os=mingw32 ;; mingw32ce) @@ -351,11 +359,11 @@ case $1 in os=moxiebox ;; msdos) - basic_machine=i386-pc + basic_machine=i386-unknown os=msdos ;; msys) - basic_machine=i686-pc + basic_machine=i686-unknown os=msys ;; mvs) @@ -435,11 +443,11 @@ case $1 in os=pw32 ;; rdos | rdos64) - basic_machine=x86_64-pc + basic_machine=x86_64-unknown os=rdos ;; rdos32) - basic_machine=i386-pc + basic_machine=i386-unknown os=rdos ;; rom68k) @@ -458,6 +466,10 @@ case $1 in basic_machine=m68k-bull os=sysv2 ;; + st2000) + basic_machine=m68k-tandem + os= + ;; stratus) basic_machine=i860-stratus os=sysv4 @@ -478,6 +490,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 +506,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 @@ -547,7 +567,7 @@ case $1 in os=vxworks ;; xbox) - basic_machine=i686-pc + basic_machine=i686-unknown os=mingw32 ;; ymp) @@ -555,7 +575,7 @@ case $1 in os=unicos ;; *) - basic_machine=$1 + basic_machine=$1-unknown os= ;; esac @@ -564,147 +584,25 @@ esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | aarch64 | aarch64_be \ - | 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 \ - | 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 \ - | 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 \ - | 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 | sh3ele \ - | 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 | 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 - ;; - m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) - basic_machine=$basic_machine-unknown - os=${os:-none} - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65) - ;; - m9s12z | m68hcs12z | hcs12z | s12z) - basic_machine=s12z-unknown - os=${os:-none} - ;; - ms1) - basic_machine=mt-unknown - ;; - strongarm | thumb | xscale) - basic_machine=arm-unknown - ;; - xgate) - basic_machine=$basic_machine-unknown - os=${os:-none} - ;; - 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. - 580-* \ + 1750a-* | 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | alphapca5[67]-* | alpha64pca5[67]-* \ + | am33_2.0-* \ + | arc-* | arceb-* \ + | arm-* | arm[lb]e-* | arme[lb]-* | armv*-* \ | avr-* | avr32-* \ | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | csky-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | e2k-* | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | d10v-* | d30v-* | dlx-* | dsp16xx-* \ + | e2k-* | elxsi-* | epiphany-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | ft32-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ @@ -714,8 +612,8 @@ case $basic_machine in | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | m5200 | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* | v70 | w65 \ + | m88110-* | m88k-* | maxq-* | mb-* | mcore-* | mep-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ @@ -738,7 +636,8 @@ case $basic_machine in | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ - | mmix-* \ + | mn10200-* | mn10300-* \ + | moxie-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ @@ -747,37 +646,34 @@ case $basic_machine in | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ + | or32-* \ | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | pdp10-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pru-* \ | pyramid-* \ | riscv32-* | riscv64-* \ - | rl78-* | romp-* | rs6000-* | rx-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | rl78-* | rs6000-* | rx-* \ + | score-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]ae[lb]-* | sh[23]e-* | she[lb]-* | sh[lb]e-* \ + | sh[1234]e[lb]-* | sh[1234][lb]e-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ + | spu-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ | wasm32-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* \ + | x86-* | x86_64-* | xc16x-* \ | xstormy16-* | xtensa*-* \ | 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) @@ -786,17 +682,17 @@ case $basic_machine in 3b*) basic_machine=we32k-att ;; - abacus) + abacus-*) basic_machine=abacus-unknown ;; - alliant | fx80) + alliant-* | fx80-*) basic_machine=fx80-alliant ;; - altos | altos3068) + altos-* | altos3068-*) basic_machine=m68k-altos ;; amd64) - basic_machine=x86_64-pc + basic_machine=x86_64-unknown ;; amd64-*) basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'` @@ -804,7 +700,7 @@ case $basic_machine in amiga | amiga-*) basic_machine=m68k-unknown ;; - asmjs) + asmjs-*) basic_machine=asmjs-unknown ;; blackfin-*) @@ -951,20 +847,22 @@ case $basic_machine in i370-ibm* | ibm*) basic_machine=i370-ibm ;; + i370-*) + ;; i*86v32) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` + basic_machine=`echo "$1" | sed -e 's/86.*/86-unknown/'` os=sysv32 ;; i*86v4*) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` + basic_machine=`echo "$1" | sed -e 's/86.*/86-unknown/'` os=sysv4 ;; i*86v) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` + basic_machine=`echo "$1" | sed -e 's/86.*/86-unknown/'` os=sysv ;; i*86sol2) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` + basic_machine=`echo "$1" | sed -e 's/86.*/86-unknown/'` os=solaris2 ;; j90 | j90-cray) @@ -984,10 +882,17 @@ case $basic_machine in leon-*|leon[3-9]-*) basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'` ;; + m6811-* | m68hc11-* | m6812-* | m68hc12-* | m68hcs12x-* | nvptx-* | picochip-*) + os=${os:-none} + ;; m68knommu-*) 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 ;; @@ -1073,16 +978,16 @@ case $basic_machine in basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc + basic_machine=i586-unknown ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc + basic_machine=i686-unknown ;; pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc + basic_machine=i686-unknown ;; pentium4) - basic_machine=i786-pc + basic_machine=i786-unknown ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'` @@ -1143,15 +1048,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-/'` ;; simso-wrs) basic_machine=sparclite-wrs @@ -1160,9 +1065,6 @@ case $basic_machine in spur) basic_machine=spur-unknown ;; - st2000) - basic_machine=m68k-tandem - ;; strongarm-* | thumb-*) basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; @@ -1172,15 +1074,8 @@ case $basic_machine in sun3 | sun3-*) basic_machine=m68k-sun ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - tile*) - basic_machine=$basic_machine-unknown - os=linux-gnu + tile*-*) + os=${os:-linux-gnu} ;; tx39) basic_machine=mipstx39-unknown @@ -1202,12 +1097,15 @@ case $basic_machine in basic_machine=hppa1.1-winbond os=proelf ;; - x64) - basic_machine=x86_64-pc + x64-*) + basic_machine=x86_64-unknown ;; - xps | xps100) + xps-* | xps100-*) basic_machine=xps100-honeywell ;; + xgate-*) + os=${os:-none} + ;; xscale-* | xscalee[bl]-*) basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'` ;; @@ -1227,11 +1125,15 @@ case $basic_machine in op60c) basic_machine=hppa1.1-oki ;; - romp) - basic_machine=romp-ibm + romp-*) + if [ x$vendor_inferred != x ]; then + basic_machine=`echo "$basic_machine" | sed "s/-unknown$/-romp/"` + fi ;; - mmix) - basic_machine=mmix-knuth + mmix-*) + if [ x$vendor_inferred != x ]; then + basic_machine=`echo "$basic_machine" | sed "s/-unknown$/-knuth/"` + fi ;; rs6000) basic_machine=rs6000-ibm @@ -1239,15 +1141,12 @@ case $basic_machine in vax) basic_machine=vax-dec ;; - pdp11) + pdp11-*) basic_machine=pdp11-dec ;; - we32k) + we32k-*) basic_machine=we32k-att ;; - sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; cydra) basic_machine=cydra-cydrome ;; @@ -1264,6 +1163,10 @@ case $basic_machine in basic_machine=powerpc-apple ;; *-unknown) + if [ x$vendor_inferred != x ]; then + echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 + exit 1 + fi # Make sure to match an already-canonicalized machine name. ;; *) @@ -1722,9 +1625,20 @@ fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. -vendor=unknown + case $basic_machine in *-unknown) + vendor=unknown + if [ x$vendor_inferred != x ]; then + case "$basic_machine" in + i*86-* | x86_64-*) + # We use `pc' rather than `unknown' because (1) that's what + # they normally are, and (2) the word "unknown" tends to + # confuse beginning users. + vendor=pc + ;; + esac + fi case $os in riscix*) vendor=acorn diff --git a/testsuite/config-sub.data b/testsuite/config-sub.data index 8013ead..7f6b608 100644 --- a/testsuite/config-sub.data +++ b/testsuite/config-sub.data @@ -556,7 +556,7 @@ v850e v850e-unknown-none v850 v850-unknown-none visium-elf visium-unknown-elf visium visium-unknown-none -vsta i386-unknown-vsta +vsta i386-pc-vsta wasm32 wasm32-unknown-none we32k we32k-att-sysv x64-linux x86_64-pc-linux-gnu @@ -566,7 +566,7 @@ x86_64-ericsson-dicos x86_64-ericsson-dicos x86_64-fuchsia x86_64-pc-fuchsia x86_64-glidix x86_64-pc-glidix x86_64-pc-ptx x86_64-pc-ptx -x86_64-ptx x86_64-pc-ptx +x86_64-ptx x86_64-sequent-ptx x86_64-redox x86_64-pc-redox x86_64-sortix x86_64-pc-sortix x86_64-unknown-ptx x86_64-sequent-ptx -- 2.16.3 _______________________________________________ config-patches mailing list config-patches@gnu.org https://lists.gnu.org/mailman/listinfo/config-patches