[m-rev.] diff: fix Pentium 4 recognition bug

Tyson Dowd trd at cs.mu.OZ.AU
Tue Apr 10 19:15:19 AEST 2001


Hi,

Here's a fix for the pentium 4 CPU recognition bug.
It should go into 0.10.2, as P4s are becoming more common.

===================================================================


Estimated hours taken: 0.75
Branches: main release

Fix CPU recognition problems with the Pentium 4.

The P4 reports its CPUID as "15" which is pretty unexpected
as previously Intel chips used numbers such as "4", "5" and "6".

Many scripts assumed the pattern i?86 or i[345678]86 would match
x86 chips.

The result of mis-identifying the chip is generally failure to compile,
and even if you do hack around the compilation problems it will almost
certainly fail to build the garbage collector correctly.

config.guess:
config.sub:
configure.in:
scripts/mgnuc.in:
scripts/ml.in:
tools/test_mercury:
	Replace i?86 with i*86, and i[345678]86 with i[0-9]*86.



Index: config.guess
===================================================================
RCS file: /home/mercury1/repository/mercury/config.guess,v
retrieving revision 1.3
diff -u -r1.3 config.guess
--- config.guess	2000/09/18 14:02:27	1.3
+++ config.guess	2001/04/10 09:07:38
@@ -304,7 +304,7 @@
     ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
 	echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
 	exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
-    i?86:AIX:*:*)
+    i*86:AIX:*:*)
 	echo i386-ibm-aix
 	exit 0 ;;
     *:AIX:2:3)
@@ -448,7 +448,7 @@
     hp8??:OSF1:*:*)
 	echo hppa1.0-hp-osf
 	exit 0 ;;
-    i?86:OSF1:*:*)
+    i*86:OSF1:*:*)
 	if [ -x /usr/sbin/sysversion ] ; then
 	    echo ${UNAME_MACHINE}-unknown-osf1mk
 	else
@@ -510,7 +510,7 @@
     sparc*:BSD/OS:*:*)
 	echo sparc-unknown-bsdi${UNAME_RELEASE}
 	exit 0 ;;
-    i?86:BSD/386:*:* | *:BSD/OS:*:*)
+    i*86:BSD/386:*:* | *:BSD/OS:*:*)
 	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
 	exit 0 ;;
     *:FreeBSD:*:*)
@@ -554,8 +554,8 @@
 				    s/ .*//
 				    p'`
         case "$ld_supported_emulations" in
-	  i?86linux)  echo "${UNAME_MACHINE}-pc-linux-gnuaout"      ; exit 0 ;;
-	  i?86coff)   echo "${UNAME_MACHINE}-pc-linux-gnucoff"      ; exit 0 ;;
+	  i*86linux)  echo "${UNAME_MACHINE}-pc-linux-gnuaout"      ; exit 0 ;;
+	  i*86coff)   echo "${UNAME_MACHINE}-pc-linux-gnucoff"      ; exit 0 ;;
 	  sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
 	  armlinux)   echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
 	  m68klinux)  echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
@@ -637,7 +637,7 @@
 
 	  case "${UNAME_MACHINE}" in
-	  i?86)
+	  i*86)
 	    VENDOR=pc;
 	    ;;
 	  *)
@@ -672,10 +672,10 @@
 	fi ;;
 # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.  earlier versions
 # are messed up and put the nodename in both sysname and nodename.
-    i?86:DYNIX/ptx:4*:*)
+    i*86:DYNIX/ptx:4*:*)
 	echo i386-sequent-sysv4
 	exit 0 ;;
-    i?86:UNIX_SV:4.2MP:2.*)
+    i*86:UNIX_SV:4.2MP:2.*)
         # Unixware is an offshoot of SVR4, but it has its own version
         # number series starting with 2...
         # I am not positive that other SVR4 systems won't match this,
@@ -683,14 +683,14 @@
         # Use sysv4.2uw... so that sysv4* matches it.
 	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
 	exit 0 ;;
-    i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
 	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
 		echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
 	else
 		echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
 	fi
 	exit 0 ;;
-    i?86:*:3.2:*)
+    i*86:*:3.2:*)
 	if test -f /usr/options/cb.name; then
 		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
 		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
@@ -704,7 +704,7 @@
 		echo ${UNAME_MACHINE}-pc-sysv32
 	fi
 	exit 0 ;;
-    i?86:UnixWare:*:*)
+    i*86:UnixWare:*:*)
 	if /bin/uname -X 2>/dev/null >/dev/null ; then
 	  (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
 	    && UNAME_MACHINE=i586
@@ -752,7 +752,7 @@
     mc68030:UNIX_System_V:4.*:*)
 	echo m68k-atari-sysv4
 	exit 0 ;;
-    i?86:LynxOS:2.*:*)
+    i*86:LynxOS:2.*:*)
 	echo i386-unknown-lynxos${UNAME_RELEASE}
 	exit 0 ;;
     TSUNAMI:LynxOS:2.*:*)
Index: config.sub
===================================================================
RCS file: /home/mercury1/repository/mercury/config.sub,v
retrieving revision 1.4
diff -u -r1.4 config.sub
--- config.sub	2000/09/18 14:02:28	1.4
+++ config.sub	2001/04/10 09:07:38
@@ -162,7 +162,7 @@
 	# 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[34567]86)
+	i[0-9]*86)
 	  basic_machine=$basic_machine-pc
 	  ;;
 	# Object if more than one company name word.
@@ -171,7 +171,7 @@
 		exit 1
 		;;
 	# Recognize the basic CPU types with company name.
-	vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \
+	vax-* | tahoe-* | i[0-9]*86-* | i860-* | m32r-* | m68k-* | m68000-* \
 	      | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
 	      | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
 	      | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
@@ -350,19 +350,19 @@
 		os=-mvs
 		;;
 # I'm not sure what "Sysv32" means.  Should this be sysv3.2?
-	i[34567]86v32)
+	i[0-9]*86v32)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-sysv32
 		;;
-	i[34567]86v4*)
+	i[0-9]*86v4*)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-sysv4
 		;;
-	i[34567]86v)
+	i[0-9]*86v)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-sysv
 		;;
-	i[34567]86sol2)
+	i[0-9]*86sol2)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-solaris2
 		;;
Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.252
diff -u -r1.252 configure.in
--- configure.in	2001/03/15 08:08:06	1.252
+++ configure.in	2001/04/10 09:07:40
@@ -1494,7 +1494,7 @@
 	mips-*)
 		CFLAGS_FOR_GOTOS="$CFLAGS_FOR_GOTOS -fomit-frame-pointer"
 		;;
-	i?86-*)
+	i*86-*)
 		CFLAGS_FOR_REGS="-fno-builtin -fno-omit-frame-pointer"
 		;;
 	# We need a special-case hack here, because the auto-config 
@@ -2093,7 +2093,7 @@
 # Find out whether branch instructions have a delay slot.
 
 case "$host" in
-	i?86-*)
+	i*86-*)
 		# NUM_REAL_REGS=3
 		# but succip and sp are real regs, so subtract 2
 		NUM_REAL_R_REGS=1
@@ -2249,7 +2249,7 @@
 ERROR_UNDEFINED=""
 
 case "$host" in
-	i?86-*-linux|i?86-*-linux-gnu)
+	i*86-*-linux|i*86-*-linux-gnu)
 		case $ac_cv_prog_gcc in
 		yes)
 			AC_MSG_RESULT(yes)
@@ -2291,7 +2291,7 @@
 		AC_MSG_RESULT(yes)
 		EXT_FOR_SHARED_LIB=so
 		;;
-	i?86-*-freebsd*)
+	i*86-*-freebsd*)
 		# From Cornelis van der Laan <nils at ims.uni-stuttgart.de>
 		AC_MSG_RESULT(yes)
 		LINK_SHARED_OBJ="ld -Bshareable"
Index: scripts/mgnuc.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/mgnuc.in,v
retrieving revision 1.79
diff -u -r1.79 mgnuc.in
--- scripts/mgnuc.in	2001/03/20 02:01:34	1.79
+++ scripts/mgnuc.in	2001/04/10 09:07:41
@@ -375,7 +375,7 @@
 			;;
 		esac
 		;;
-	i?86-*)
+	i*86-*)
 		# the use of stack_pointer in the ASM_JUMP macro
 		# defined in runtime/goto.h causes lots of warnings
 		# about using possibly uninitialized variables;
@@ -431,7 +431,7 @@
 					ARCH_OPTS="$ARCH_OPTS -O1" ;;
 				esac
 			esac ;;
-		i?86*)
+		i*86*)
 			case "$*" in
 			*" call_gen.c "*|*" modules.dir/call_gen"*".c "*)
 				ARCH_OPTS="$ARCH_OPTS -O0" ;;
Index: scripts/ml.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/ml.in,v
retrieving revision 1.90
diff -u -r1.90 ml.in
--- scripts/ml.in	2001/02/11 04:42:45	1.90
+++ scripts/ml.in	2001/04/10 09:07:41
@@ -361,7 +361,7 @@
 # it will also have set mercury_libs.
 case $mercury_libs in default)
 	mercury_libs=shared
-	case $FULLARCH in i?86-*-linux*|i?86-*-freebsd*|i?86-*-cygwin*)
+	case $FULLARCH in i*86-*-linux*|i*86-*-freebsd*|i*86-*-cygwin*)
 		# shared libraries are not the default on Linux
 		# -- see README.Linux
 		# Likewise for FreeBSD
@@ -378,7 +378,7 @@
 # (shared on most systems).
 case $all_libs in default)
 	all_libs=shared
-	case $FULLARCH in i?86-*-linux*|i?86-*-freebsd*|i?86-*-cygwin*)
+	case $FULLARCH in i*86-*-linux*|i*86-*-freebsd*|i*86-*-cygwin*)
 		# shared libraries are not the default on Linux
 		# -- see README.Linux
 		# Likewise for FreeBSD
Index: tools/test_mercury
===================================================================
RCS file: /home/mercury1/repository/mercury/tools/test_mercury,v
retrieving revision 1.148
diff -u -r1.148 test_mercury
--- tools/test_mercury	2001/03/13 03:12:32	1.148
+++ tools/test_mercury	2001/04/10 09:07:41
@@ -151,7 +151,7 @@
 TEST_MLFLAGS=""
 
 case $FULLARCH in
-	i?86-*-linux*)
+	i*86-*-linux*)
 		# On x86 Linux, we need to set the following flags to enable
 		# shared libraries (and we need to use shared libraries to
 		# avoid running out of disk space...)


-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list