dbTalk Databases Forums  

bk commit into 4.1 tree (hartmut:1.2310) BUG#11065

mailing.database.mysql-internals mailing.database.mysql-internals


Discuss bk commit into 4.1 tree (hartmut:1.2310) BUG#11065 in the mailing.database.mysql-internals forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
'Hartmut Holzgraefe'
 
Posts: n/a

Default bk commit into 4.1 tree (hartmut:1.2310) BUG#11065 - 06-03-2005 , 04:19 AM






Below is the list of changes that have just been committed into a local
4.1 repository of hartmut. When hartmut does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/in...urce-tree.html

ChangeSet
1.2310 05/06/03 11:21:43 hartmut (AT) mysql (DOT) com +1 -0
check-cpu fixes/improvements (Bug #11065)

- support additional platforms (OpenBSD, Darwin)
- make use of /proc/cpuinfo CPU flag information
(needed to distinguish EMT64 Xeons from normal ones)
- chose the right CPU related options depending on
GCC version and target architecture
- check if the chosen CPU type is actually supported
by the GCC version , fallback to CPUs predecessor
until test compile succeeds

BUILD/check-cpu
1.10 05/06/03 11:21:36 hartmut (AT) mysql (DOT) com +126 -42
check-cpu fixes/improvements (Bug #11065)

- support additional platforms (OpenBSD, Darwin)
- make use of /proc/cpuinfo CPU flag information
(needed to distinguish EMT64 Xeons from normal ones)
- chose the right CPU related options depending on
GCC version and target architecture
- check if the chosen CPU type is actually supported
by the GCC version , fallback to CPUs predecessor
until test compile succeeds

# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: hartmut
# Host: dellschlepp.local
# Root: /home/hartmut/projects/mysql/dev/4.1

--- 1.9/BUILD/check-cpu 2005-05-25 04:18:13 +02:00
+++ 1.10/BUILD/check-cpu 2005-06-03 11:21:36 +02:00
@@ -6,113 +6,197 @@
#

if test -r /proc/cpuinfo ; then
+ # on Linux (and others?) we can get detailed CPU information out of /proc
cpuinfo="cat /proc/cpuinfo"
+
+ # detect CPU family
cpu_family=`$cpuinfo | grep 'family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
if test -z "$cpu_family" ; then
cpu_family=`$cpuinfo | grep 'cpu' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
fi
+
+ # detect CPU vendor and model
cpu_vendor=`$cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
model_name=`$cpuinfo | grep 'model name' | cut -d ':' -f 2 | head -1`
if test -z "$model_name" ; then
model_name=`$cpuinfo | grep 'cpu model' | cut -d ':' -f 2 | head -1`
fi
+
+ # fallback: get CPU model from uname output
if test -z "$model_name" ; then
model_name=`uname -m`
fi
+
+ # parse CPU flags
+ for flag in `$cpuinfo | grep 'flags' | sed -e 's/^flags.*: //'`; do
+ eval cpu_flag_$flag=yes
+ done
else
# Fallback when there is no /proc/cpuinfo
case "`uname -s`" in
- FreeBSD)
+ FreeBSD|OpenBSD)
cpu_family=`uname -m`;
- model_name=`sysctl -b hw.model`
+ model_name=`sysctl -n hw.model`
+ ;;
+ Darwin)
+ cpu_family=`uname -p`
+ model_name=`machine`
;;
*)
cpu_family=`uname -m`;
- model_name="unknown";
+ model_name=`uname -p`;
;;
esac
fi

-cpu_flag=""
-cpu_flag_old=""
+# detect CPU shortname as used by gcc options
+# this list is not complete, feel free to add further entries
+cpu_arg=""

case "$cpu_family--$model_name" in
+ # DEC Alpha
Alpha*EV6*)
- cpu_flag="ev6";
+ cpu_arg="ev6";
;;
+
+ # Intel ia32
*Xeon*)
- cpu_flag="nocona";
+ # a Xeon is just another pentium4 ...
+ # ... unless it has the "lm" (long-mode) flag set,
+ # in that case it's a Xeon with EM64T support
+ if [ -z "$cpu_flag_lm" ]; then
+ cpu_arg="pentium4";
+ else
+ cpu_arg="nocona";
+ fi
;;
- *Pentium*4*Mobile*CPU*)
- cpu_flag="pentium4m";
+ *Pentium*4*Mobile*)
+ cpu_arg="pentium4m";
;;
- *Pentium*4*CPU*)
- cpu_flag="pentium4";
+ *Pentium*4*)
+ cpu_arg="pentium4";
;;
- *Pentium*III*Mobile*CPU*)
- cpu_flag="pentium3m";
+ *Pentium*III*Mobile*)
+ cpu_arg="pentium3m";
;;
- *Pentium*III*CPU*)
- cpu_flag="pentium3";
+ *Pentium*III*)
+ cpu_arg="pentium3";
;;
*Pentium*M*pro*)
- cpu_flag="pentium-m";
- cpu_flag_old="pentium";
+ cpu_arg="pentium-m";
;;
*Athlon*64*)
- cpu_flag="athlon64";
- cpu_flag_old="athlon";
+ cpu_arg="athlon64";
;;
*Athlon*)
- cpu_flag="athlon";
+ cpu_arg="athlon";
;;
+
+ # Intel ia64
*Itanium*)
# Don't need to set any flags for itanium(at the moment)
- cpu_flag="";
+ cpu_arg="";
;;
- *ppc)
- cpu_flag="powerpc";
- no_march=1;
+
+ #
+ *powerpc*)
+ cpu_arg=`echo $model_name | sed -e"s/ppc//g"`
;;
+
+ # unknown
*)
- cpu_flag="";
+ cpu_arg="";
;;
esac

-if test -z "$cpu_flag"; then
+
+if test -z "$cpu_arg"; then
echo "BUILD/check-cpu: Oops, could not findout what kind of cpu this machine is using."
- check_cpu_flags=""
+ check_cpu_cflags=""
return
fi

-echo "cpu_flag: $cpu_flag"
-
+# different compiler versions have different option names
+# for CPU specific command line options
if test -z "$CC" ; then
cc="gcc";
else
cc=$CC
-
fi

cc_ver=`$cc --version | sed 1q`
cc_verno=`echo $cc_ver | sed -e 's/[^0-9. ]//g; s/^ *//g; s/ .*//g'`

case "$cc_ver--$cc_verno" in
- *GCC*--3.4*|*GCC*--3.5*|*GCC*--4.*)
- check_cpu_cflags="-mtune=$cpu_flag -march=$cpu_flag"
- ;;
*GCC*)
- # Fix for older compiler versions
- if test -n "$cpu_flag_old"; then
- cpu_flag="$cpu_flag_old"
- fi
- check_cpu_cflags="-mcpu=$cpu_flag -march=$cpu_flag"
- if test -n "$no_march"; then
- check_cpu_cflags="-mcpu=$cpu_flag"
- fi
+ # different gcc backends (and versions) have different CPU flags
+ case `gcc -dumpmachine` in
+ i?86-*)
+ case "$cc_verno" in
+ 3.4*|3.5*|4.*)
+ check_cpu_args='-mtune=$cpu_arg -march=$cpu_arg'
+ ;;
+ *)
+ check_cpu_args='-mcpu=$cpu_arg -march=$cpu_arg'
+ ;;
+ esac
+ ;;
+ ppc-*)
+ check_cpu_args='-mcpu=$cpu_arg -mtune=$cpu_arg'
+ ;;
+ *)
+ check_cpu_cflags=""
+ return
+ ;;
+ esac
+ ;;
+ 2.95.*)
+ # GCC 2.95 doesn't expose its name in --version output
+ check_cpu_args='-m$cpu_arg'
;;
*)
check_cpu_cflags=""
+ return
;;
esac
-echo $check_cpu_cflags
+
+# now we check whether the compiler really understands the cpu type
+touch __test.c
+
+while [ "$cpu_arg" ] ; do
+ echo -n testing $cpu_arg "... "
+
+ # compile check
+ check_cpu_cflags=`eval echo $check_cpu_args`
+ if $cc -c $check_cpu_cflags __test.c 2>/dev/null; then
+ echo ok
+ break;
+ fi
+
+ echo failed
+ check_cpu_cflags=""
+
+ # if compile failed: check whether it supports a predecessor of this CPU
+ # this list is not complete, feel free to add further entries
+ case "$cpu_arg" in
+ # Intel ia32
+ nocona) cpu_arg=pentium4 ;;
+ prescott) cpu_arg=pentium4 ;;
+ pentium4m) cpu_arg=pentium4 ;;
+ pentium4) cpu_arg=pentium3 ;;
+ pentium3m) cpu_arg=pentium3 ;;
+ pentium3) cpu_arg=pentium2 ;;
+ pentium2) cpu_arg=pentiumpro ;;
+ pentiumpro) cpu_arg=pentium ;;
+ pentium) cpu_arg=i486 ;;
+ i486) cpu_arg=i386 ;;
+
+ # power / powerPC
+ 7450) cpu_arg=7400 ;;
+
+ *) cpu_arg="" ;;
+ esac
+done
+
+rm __test.*
+

--
MySQL Internals Mailing List
For list archives: http://lists.mysql.com/internals
To unsubscribe: http://lists.mysql.com/internals?uns...ie.nctu.edu.tw


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.