I'm writing this as a bug for the GMP community and CCing coreboot,
although, with the proper direction I can imagine this all ending in a
change to the configure flags in the coreboot xgcc build.
The coreboot project contains a build script for generating a cross
toolchain (xgcc). The versions were recently bumped to:
GMP_VERSION=5.0.5
MPFR_VERSION=3.1.0
MPC_VERSION=0.9
LIBELF_VERSION=0.8.13
GCC_VERSION=4.6.3
GCC_AUTOCONF_VERSION=2.64
BINUTILS_VERSION=2.22
For the purposes of this bug, the important change was the move from GMP
5.0.2 to GMP 5.0.5. The issue is that an xgcc toolchain built on one
host cannot consistently be moved to a similar operating system on a
different host with a different underlying architecture. This was seen
with both 32bit and 64bit OS installs under the following configurations:
64bit Build Host
Ubuntu 11.04 \n \l
Linux ubuntubuilder03 2.6.38-14-server #58-Ubuntu SMP Tue Mar 27
20:21:58 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
vendor_id : AuthenticAMD
model name : AMD Athlon(tm) II X4 605e Processor
64bit Execution Host
Ubuntu 10.04.3 LTS \n \l
Linux beast 2.6.32-24-generic #43-Ubuntu SMP Thu Sep 16 14:58:24 UTC
2010 x86_64 GNU/Linux
vendor_id : GenuineIntel
model name : Intel(R) Core(TM) i7 CPU Q 720 @ 1.60GHz
32bit Build Host
Ubuntu 11.04 \n \l
Linux ubuntubuilder04 2.6.38-14-generic-pae #58-Ubuntu SMP Tue Mar 27
19:06:30 UTC 2012 i686 athlon i386 GNU/Linux
vendor_id : AuthenticAMD
model name : Embedded AMD Opteron(tm) Processor 41KX HE
NOTE: The architecture is 64bit, but the operating system is 32bit
32bit Execution Host
Ubuntu 11.10 \n \l
Linux test2 3.0.0-17-generic #30-Ubuntu SMP Thu Mar 8 17:34:21 UTC 2012
i686 i686 i386 GNU/Linux
vendor_id : GenuineIntel
model name : Intel(R) Pentium(R) 4 CPU 2.80GHz
The following issue symptom does not seem to be limited to Linux
operating systems. Cygwin builds using Windows XP VMs and native
Windows installs also exhibit the problem. On Linux systems, in the
coreboot build on the execution host using a tar'd and copied binary
toolchain from the build host resulted in messages like:
libpci/libpci.c:221:1: internal compiler error: Illegal instruction
make[1]: Entering directory
`/home/tester/sage_edk/release_workspace/coreboot/payloads/libpayload'
CC libpci/libpci.libpci.o
Please submit a full bug report,
with preprocessed source if appropriate.
See<http://gcc.gnu.org/bugs.html> for instructions.
make[1]: Leaving directory
`/home/tester/sage_edk/release_workspace/coreboot/payloads/libpayload'
make[1]: *** [build/libpci/libpci.libpci.o] Error 1
make: *** [libpayload] Error 2
or
./src/cpu/amd/agesa/cache_as_ram.inc: Assembler messages:
./src/cpu/amd/agesa/cache_as_ram.inc:67: Error: unbalanced parenthesis in
operand 1.
or
romstage.c: Assembler messages:
romstage.c:476: Error: value of 4294967296 too large for field of 4 bytes at
4448
romstage.c:477: Error: value of 4294967296 too large for field of 4 bytes at
4460
<snip>
On Cygwin systems, the build resulted in messages like:
cc1: out of memory allocating 67174399 bytes after a total of 336396288
bytes
Makefile:238: recipe for target `build/console/vtxprintf.romstage.o' failed
I performed a bisect of the GMP mercurial repository and identified an
offending changeset:
http://gmplib.org:8000/gmp-5.0/rev/2b7b8ada8a20
By this, I mean, that the xgcc toolchain, when built with any change
prior to this GMP version, was able to compile coreboot when moved
between build and execution host. I constructed a patch for GMP 5.0.5
reversing this change (attached). Similarly, with this patch, the xgcc
toolchain using GMP 5.0.5 is portable.
Are the tuning changes made in this change optimal? What are the GMP
recommendations for constructing a toolchain that is portable between
similar hosts?
Thanks,
Ray
Raymond Danks
Sage Electronic Engineering, LLC
Patch for GMP 5.0.5 to reverse change that broke portability between two 64 bit machines with different chipset or two 32bit machines with different chipset.
The original changeset is in the GMP mercurial repository:
http://gmplib.org:8000/gmp-5.0/rev/2b7b8ada8a20
This issue is tracked internally by Sage Electronic Engineering under BugID: 1881
diff -urN gmp-5.0.2.sav/acinclude.m4 gmp-5.0.5.patched/acinclude.m4
--- gmp-5.0.2.sav/acinclude.m4 2012-05-24 14:10:11.012339419 -0600
+++ gmp-5.0.5.patched/acinclude.m4 2012-05-24 14:12:34.812339479 -0600
@@ -1,8 +1,8 @@
dnl GMP specific autoconf macros
-dnl Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2011 Free
-dnl Software Foundation, Inc.
+dnl Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 Free Software
+dnl Foundation, Inc.
dnl
dnl This file is part of the GNU MP Library.
dnl
@@ -53,7 +53,7 @@
[[i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | atom-*-*]])
define(X86_64_PATTERN,
-[[athlon64-*-* | k8-*-* | k10-*-* | bobcat-*-* | bulldozer-*-* | pentium4-*-* | atom-*-* | core2-*-* | corei*-*-* | x86_64-*-* | nano-*-*]])
+[[athlon64-*-* | pentium4-*-* | atom-*-* | core2-*-* | corei-*-* | x86_64-*-* | nano-*-*]])
dnl GMP_FAT_SUFFIX(DSTVAR, DIRECTORY)
dnl ---------------------------------
@@ -3099,17 +3099,14 @@
dnl Determine the floating point format.
dnl
dnl The object file is grepped, in order to work when cross compiling. A
-dnl start and end sequence is included to avoid false matches, and allowance
-dnl is made for the desired data crossing an "od -b" line boundary. The test
-dnl number is a small integer so it should appear exactly, no rounding or
-dnl truncation etc.
+dnl start and end sequence is included to avoid false matches, and
+dnl allowance is made for the desired data crossing an "od -b" line
+dnl boundary. The test number is a small integer so it should appear
+dnl exactly, no rounding or truncation etc.
dnl
dnl "od -b", incidentally, is supported even by Unix V7, and the awk script
dnl used doesn't have functions or anything, so even an "old" awk should
dnl suffice.
-dnl
-dnl The C code here declares the variable foo as extern; without that, some
-dnl C++ compilers will not put foo in the object file.
AC_DEFUN([GMP_C_DOUBLE_FORMAT],
[AC_REQUIRE([AC_PROG_CC])
@@ -3118,13 +3115,11 @@
gmp_cv_c_double_format,
[gmp_cv_c_double_format=unknown
cat >conftest.c <<\EOF
-[struct foo {
+[struct {
char before[8];
double x;
char after[8];
-};
-extern struct foo foo;
-struct foo foo = {
+} foo = {
{ '\001', '\043', '\105', '\147', '\211', '\253', '\315', '\357' },
-123456789.0,
{ '\376', '\334', '\272', '\230', '\166', '\124', '\062', '\020' },
@@ -3534,7 +3529,7 @@
AC_CACHE_CHECK([whether vsnprintf works],
gmp_cv_func_vsnprintf,
[gmp_cv_func_vsnprintf=yes
- for i in 'return check ("hello world");' 'int n; return check ("%nhello world", &n);'; do
+ for i in 'check ("hello world");' 'int n; check ("%nhello world", &n);'; do
AC_TRY_RUN([
#include <string.h> /* for strcmp */
#include <stdio.h> /* for vsnprintf */
@@ -3568,11 +3563,11 @@
ret = vsnprintf (buf, 4, fmt, ap);
if (strcmp (buf, "hel") != 0)
- return 1;
+ exit (1);
/* allowed return values */
if (ret != -1 && ret != 3 && ret != 11)
- return 2;
+ exit (2);
return 0;
}
@@ -3581,6 +3576,7 @@
main ()
{
$i
+ exit (0);
}
],
[:],
diff -urN gmp-5.0.2.sav/config.guess gmp-5.0.5.patched/config.guess
--- gmp-5.0.2.sav/config.guess 2012-05-24 14:10:11.012339419 -0600
+++ gmp-5.0.5.patched/config.guess 2012-05-24 14:20:37.442339677 -0600
@@ -3,7 +3,7 @@
# GMP config.guess wrapper.
-# Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2011 Free Software
+# Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008 Free Software
# Foundation, Inc.
#
# This file is part of the GNU MP Library.
@@ -454,9 +454,6 @@
#ifdef POWER_6
case POWER_6: puts ("power6"); break;
#endif
-#ifdef POWER_7
- case POWER_7: puts ("power7"); break;
-#endif
default:
if (_system_configuration.architecture == POWER_RS)
puts ("power");
@@ -542,11 +539,8 @@
elif grep 'cpu.*MB86904' /proc/cpuinfo >/dev/null; then
# actually MicroSPARC-II
exact_cpu=microsparc
- elif grep 'cpu.*UltraSparc T3' /proc/cpuinfo >/dev/null; then
- exact_cpu="ultrasparct3"
- elif grep 'cpu.*UltraSparc T2' /proc/cpuinfo >/dev/null; then
- exact_cpu="ultrasparct2"
elif grep 'cpu.*UltraSparc T1' /proc/cpuinfo >/dev/null; then
+ # this grep pattern has not been tested against any Linux
exact_cpu="ultrasparct1"
elif grep 'cpu.*UltraSparc III' /proc/cpuinfo >/dev/null; then
exact_cpu="ultrasparc3"
@@ -601,11 +595,7 @@
for prtconfopt in "" "-vp"; do
if test -z "$exact_cpu"; then
if $SHELL -c "/usr/sbin/prtconf $prtconfopt" 2>/dev/null >conftest.dat; then
- if grep 'SUNW,UltraSPARC-T3' conftest.dat >/dev/null; then
- exact_cpu=ultrasparct3
- elif grep 'SUNW,UltraSPARC-T2' conftest.dat >/dev/null; then
- exact_cpu=ultrasparct2
- elif grep 'SUNW,UltraSPARC-T1' conftest.dat >/dev/null; then
+ if grep 'SUNW,UltraSPARC-T1' conftest.dat >/dev/null; then
exact_cpu=ultrasparct1
elif grep 'SUNW,UltraSPARC-III' conftest.dat >/dev/null; then
exact_cpu=ultrasparc3
@@ -640,19 +630,16 @@
#
if test -z "$exact_cpu"; then
if $SHELL -c "/sbin/sysctl hw.model" 2>/dev/null >conftest.dat; then
- if grep -i 'UltraSparc-T3' conftest.dat >/dev/null; then
- exact_cpu=ultrasparct3
- elif grep -i 'UltraSparc-T2' conftest.dat >/dev/null; then
- exact_cpu=ultrasparct2
- elif grep -i 'UltraSparc-T1' conftest.dat >/dev/null; then
+ if grep 'UltraSparc-T1' conftest.dat >/dev/null; then
+ # this grep pattern has not been tested against any BSD
exact_cpu=ultrasparct1
- elif grep -i 'UltraSparc-III' conftest.dat >/dev/null; then
+ elif grep 'UltraSparc-III' conftest.dat >/dev/null; then
exact_cpu=ultrasparc3
- elif grep -i 'UltraSparc-IIi' conftest.dat >/dev/null; then
+ elif grep 'UltraSparc-IIi' conftest.dat >/dev/null; then
exact_cpu=ultrasparc2i
- elif grep -i 'UltraSparc-II' conftest.dat >/dev/null; then
+ elif grep 'UltraSparc-II' conftest.dat >/dev/null; then
exact_cpu=ultrasparc2
- elif grep -i 'UltraSparc' conftest.dat >/dev/null; then
+ elif grep 'UltraSparc' conftest.dat >/dev/null; then
exact_cpu=ultrasparc
elif grep 'TMS390Z5.' conftest.dat >/dev/null; then
# TMS390Z50 and TMS390Z55
@@ -679,12 +666,6 @@
fi
;;
-
-# Recognise x86 processors using a tricky cpuid with 4 arguments, repeating
-# arguments; for x86-64 we effectively pass the 1st in rdx and the 2nd in rcx.
-# This allows the same asm to work for both standard and Windoze calling
-# conventions.
-
i?86-*-* | amd64-*-* | x86_64-*-*)
cat <<EOF >${dummy}0.s
.globl cpuid
@@ -693,10 +674,10 @@
_cpuid:
pushl %esi
pushl %ebx
- movl 24(%esp),%eax
+ movl 16(%esp),%eax
.byte 0x0f
.byte 0xa2
- movl 20(%esp),%esi
+ movl 12(%esp),%esi
movl %ebx,(%esi)
movl %edx,4(%esi)
movl %ecx,8(%esi)
@@ -709,49 +690,35 @@
.globl _cpuid
cpuid:
_cpuid:
- push %rbx
- mov %rdx, %r8
- mov %ecx, %eax
- .byte 0x0f
- .byte 0xa2
- mov %ebx, (%r8)
- mov %edx, 4(%r8)
- mov %ecx, 8(%r8)
- pop %rbx
+ push %rbx
+ mov %esi,%eax
+ .byte 0x0f
+ .byte 0xa2
+ mov %ebx,(%rdi)
+ mov %edx,4(%rdi)
+ mov %ecx,8(%rdi)
+ pop %rbx
ret
EOF
cat <<EOF >${dummy}2.c
-#include <string.h>
-#include <stdio.h>
-#define CPUID(a,b) cpuid(b,a,a,b)
-#if __cplusplus
-extern "C"
-#endif
-unsigned int cpuid (int, char *, char *, int);
-int
main ()
{
char vendor_string[13];
char dummy_string[12];
long fms;
int family, model, stepping;
- const char *modelstr;
- int cpu_64bit = 0;
+ char *modelstr;
- CPUID (vendor_string, 0);
+ cpuid (vendor_string, 0);
vendor_string[12] = 0;
- fms = CPUID (dummy_string, 1);
+ fms = cpuid (dummy_string, 1);
family = ((fms >> 8) & 0xf) + ((fms >> 20) & 0xff);
model = ((fms >> 4) & 0xf) + ((fms >> 12) & 0xf0);
stepping = fms & 0xf;
modelstr = "$guess_cpu";
-
- /**************************************************/
- /*** WARNING: keep this list in sync with fat.c ***/
- /**************************************************/
if (strcmp (vendor_string, "GenuineIntel") == 0)
{
switch (family)
@@ -767,23 +734,19 @@
else if (model <= 9) modelstr = "pentiumm";
else if (model <= 0x0c) modelstr = "pentium3";
else if (model <= 0x0e) modelstr = "pentiumm";
- else if (model <= 0x19) cpu_64bit = 1, modelstr = "core2";
- else if (model == 0x1a) cpu_64bit = 1, modelstr = "coreinhm"; /* NHM Gainestown */
- else if (model == 0x1c) cpu_64bit = 1, modelstr = "atom"; /* Silverthorne */
- else if (model == 0x1d) cpu_64bit = 1, modelstr = "core2"; /* PNR Dunnington */
- else if (model == 0x1e) cpu_64bit = 1, modelstr = "coreinhm"; /* NHM Lynnfield/Jasper */
- else if (model == 0x25) cpu_64bit = 1, modelstr = "coreiwsm"; /* WSM Clarkdale/Arrandale */
- else if (model == 0x26) cpu_64bit = 1, modelstr = "atom"; /* Lincroft */
- else if (model == 0x27) cpu_64bit = 1, modelstr = "atom"; /* Saltwell */
- else if (model == 0x2a) cpu_64bit = 1, modelstr = "coreisbr"; /* SB */
- else if (model == 0x2c) cpu_64bit = 1, modelstr = "coreiwsm"; /* WSM Gulftown */
- else if (model == 0x2d) cpu_64bit = 1, modelstr = "coreisbr"; /* SBC-EP */
- else if (model == 0x2e) cpu_64bit = 1, modelstr = "coreinhm"; /* NHM Beckton */
- else if (model == 0x2f) cpu_64bit = 1, modelstr = "coreiwsm"; /* WSM Eagleton */
- else cpu_64bit = 1, modelstr = "corei"; /* default */
+ else if (model <= 0x19) modelstr = "core2";
+ else if (model == 0x1a) modelstr = "corei"; /* NHM Gainestown */
+ else if (model == 0x1c) modelstr = "atom"; /* Silverthorne */
+ else if (model == 0x1d) modelstr = "core2"; /* PNR Dunnington */
+ else if (model == 0x1e) modelstr = "corei"; /* NHM Lynnfield/Jasper */
+ else if (model == 0x25) modelstr = "corei"; /* WSM Clarkdale/Arrandale */
+ else if (model == 0x26) modelstr = "atom"; /* Lincroft */
+ else if (model == 0x27) modelstr = "atom"; /* Saltwell */
+ else if (model == 0x2c) modelstr = "corei"; /* WSM Gulftown */
+ else if (model == 0x2e) modelstr = "corei"; /* NHM Beckton */
break;
case 15:
- cpu_64bit = 1, modelstr = "pentium4";
+ modelstr = "pentium4";
break;
}
}
@@ -802,29 +765,9 @@
case 6:
modelstr = "athlon";
break;
- case 15: /* K8, K9 */
- cpu_64bit = 1, modelstr = "k8";
- break;
- case 16: /* K10 */
- cpu_64bit = 1, modelstr = "k10";
- break;
- case 17: /* Hybrid k8/k10, claim k8 */
- cpu_64bit = 1, modelstr = "k8";
- break;
- case 18: /* Llano, uses K10 core */
- cpu_64bit = 1, modelstr = "k10";
- break;
- case 19: /* AMD Internal, assume future K10 */
- cpu_64bit = 1, modelstr = "k10";
- break;
- case 20: /* Bobcat */
- cpu_64bit = 1, modelstr = "bobcat";
- break;
- case 21: /* Bulldozer */
- cpu_64bit = 1, modelstr = "bulldozer";
- break;
- case 22: /* AMD Internal, assume future bulldozer */
- cpu_64bit = 1, modelstr = "bulldozer";
+ case 15:
+ case 16:
+ modelstr = "athlon64";
break;
}
}
@@ -839,18 +782,12 @@
case 6:
if (model < 9) modelstr = "viac3";
else if (model < 15) modelstr = "viac32";
- else cpu_64bit = 1, modelstr = "nano";
+ else modelstr = "nano";
break;
}
}
- /* If our cpuid-based exact guess is more conservative than the previous
- guess, revert. This is of course wrong, but it can happen in an emulator,
- so this workaround allows for successful 64-bit builds. */
- if (strcmp ("$guess_cpu", "x86_64") == 0 && ! cpu_64bit)
- modelstr = "$guess_cpu";
-
- printf ("%s", modelstr);
+ printf ("%s\n", modelstr);
return 0;
}
EOF
@@ -890,21 +827,6 @@
rm -f ${dummy}0.s ${dummy}0.o ${dummy}1.s ${dummy}1.o ${dummy}2.c ${dummy}2.o $dummy
;;
-s390*-*-*)
- model=`grep "^processor 0: version =" /proc/cpuinfo | sed -e 's/.*machine = //'`
- case $model in
- 2064 | 2066) zcpu="z900" ;;
- 2084 | 2086) zcpu="z990" ;;
- 2094 | 2096) zcpu="z9" ;;
- 2097 | 2098) zcpu="z10" ;;
- 2817 | 2818 | *) zcpu="z196" ;;
- esac
- case "$guess_full" in
- s390x-*-*) exact_cpu=${zcpu} ;;
- s390-*-*) exact_cpu=${zcpu}esa ;;
- esac
- ;;
-
esac
diff -urN gmp-5.0.2.sav/config.sub gmp-5.0.5.patched/config.sub
--- gmp-5.0.2.sav/config.sub 2012-05-24 14:10:11.012339419 -0600
+++ gmp-5.0.5.patched/config.sub 2012-05-24 14:12:34.812339479 -0600
@@ -89,9 +89,9 @@
case "$given_cpu" in
itanium | itanium2)
test_cpu=ia64 ;;
-pentium | pentiummmx | pentiumpro | pentium[234m] | k[567] | k6[23] | geode | athlon | viac3*)
+pentium | pentiummmx | pentiumpro | pentium[234m] | k[56] | k6[23] | geode | athlon | viac3* | nano)
test_cpu=i386 ;;
-athlon64 | atom | core2 | corei | coreinhm | coreiwsm | coreisbr | opteron | k[89] | k10 | bobcat | bulldozer | nano)
+athlon64 | atom | core2 | corei | opteron)
test_cpu=x86_64 ;;
power[2-9] | power2sc)
test_cpu=power ;;
@@ -106,16 +106,11 @@
powerpc64)
test_cpu=powerpc ;;
sparcv8 | supersparc | microsparc | \
-ultrasparc | ultrasparc2 | ultrasparc2i | ultrasparc3 | ultrasparct[1234])
+ultrasparc | ultrasparc2 | ultrasparc2i | ultrasparc3 | ultrasparct1)
test_cpu=sparc ;;
sh2)
test_cpu=sh ;;
-z900 | z990 | z9 | z10 | z196)
- test_cpu=s390x;;
-z900esa | z990esa | z9esa | z10esa | z196esa)
- test_cpu=s390;;
-
*)
# Don't need or want to change the given name, just run configfsf.sub
$SHELL $configfsf_sub "$given_full"
diff -urN gmp-5.0.2.sav/configure.in gmp-5.0.5.patched/configure.in
--- gmp-5.0.2.sav/configure.in 2012-05-24 14:10:11.022339419 -0600
+++ gmp-5.0.5.patched/configure.in 2012-05-24 14:23:16.262339743 -0600
@@ -27,7 +27,7 @@
AC_REVISION($Revision$)
AC_PREREQ(2.59)
-AC_INIT(GNU MP, GMP_VERSION, [[email protected], see http://gmplib.org/manual/Reporting-Bugs.html], gmp)
+AC_INIT(GNU MP, GMP_VERSION, [email protected], gmp)
AC_CONFIG_SRCDIR(gmp-impl.h)
m4_pattern_forbid([^[ \t]*GMP_])
m4_pattern_allow(GMP_LDFLAGS)
@@ -430,7 +430,7 @@
AC_DEFINE(HAVE_HOST_CPU_FAMILY_alpha)
case $host_cpu in
alphaev5* | alphapca5*)
- path="alpha/ev5 alpha" ;;
+ path="alpha/ev5 alpha" ;;
alphaev67 | alphaev68 | alphaev7*)
path="alpha/ev67 alpha/ev6 alpha" ;;
alphaev6)
@@ -896,26 +896,18 @@
case $host_cpu in
powerpc401) gcc_cflags_cpu="-mcpu=401" ;;
- powerpc403) gcc_cflags_cpu="-mcpu=403"
- xlc_cflags_arch="-qarch=403 -qarch=ppc" ;;
+ powerpc403) gcc_cflags_cpu="-mcpu=403" ;;
powerpc405) gcc_cflags_cpu="-mcpu=405" ;;
powerpc505) gcc_cflags_cpu="-mcpu=505" ;;
- powerpc601) gcc_cflags_cpu="-mcpu=601"
- xlc_cflags_arch="-qarch=601 -qarch=ppc" ;;
- powerpc602) gcc_cflags_cpu="-mcpu=602"
- xlc_cflags_arch="-qarch=602 -qarch=ppc" ;;
- powerpc603) gcc_cflags_cpu="-mcpu=603"
- xlc_cflags_arch="-qarch=603 -qarch=ppc" ;;
- powerpc603e) gcc_cflags_cpu="-mcpu=603e -mcpu=603"
- xlc_cflags_arch="-qarch=603 -qarch=ppc" ;;
- powerpc604) gcc_cflags_cpu="-mcpu=604"
- xlc_cflags_arch="-qarch=604 -qarch=ppc" ;;
- powerpc604e) gcc_cflags_cpu="-mcpu=604e -mcpu=604"
- xlc_cflags_arch="-qarch=604 -qarch=ppc" ;;
+ powerpc601) gcc_cflags_cpu="-mcpu=601" ;;
+ powerpc602) gcc_cflags_cpu="-mcpu=602" ;;
+ powerpc603) gcc_cflags_cpu="-mcpu=603" ;;
+ powerpc603e) gcc_cflags_cpu="-mcpu=603e -mcpu=603" ;;
+ powerpc604) gcc_cflags_cpu="-mcpu=604" ;;
+ powerpc604e) gcc_cflags_cpu="-mcpu=604e -mcpu=604" ;;
powerpc620) gcc_cflags_cpu="-mcpu=620" ;;
powerpc630) gcc_cflags_cpu="-mcpu=630"
- xlc_cflags_arch="-qarch=pwr3"
- cpu_path="p3 p3-p7" ;;
+ cpu_path="p3" ;;
powerpc740) gcc_cflags_cpu="-mcpu=740" ;;
powerpc7400 | powerpc7410)
gcc_cflags_asm="-Wa,-maltivec"
@@ -929,21 +921,38 @@
powerpc823) gcc_cflags_cpu="-mcpu=823" ;;
powerpc860) gcc_cflags_cpu="-mcpu=860" ;;
powerpc970) gcc_cflags_cpu="-mtune=970"
- xlc_cflags_arch="-qarch=970 -qarch=pwr3"
vmx_path="powerpc64/vmx"
- cpu_path="p4 p3-p7" ;;
+ cpu_path="p4" ;;
power4) gcc_cflags_cpu="-mtune=power4"
- xlc_cflags_arch="-qarch=pwr4"
- cpu_path="p4 p3-p7" ;;
+ cpu_path="p4" ;;
power5) gcc_cflags_cpu="-mtune=power5 -mtune=power4"
- xlc_cflags_arch="-qarch=pwr5"
- cpu_path="p5 p4 p3-p7" ;;
+ cpu_path="p5 p4" ;;
power6) gcc_cflags_cpu="-mtune=power6"
- xlc_cflags_arch="-qarch=pwr6"
- cpu_path="p6 p3-p7" ;;
- power7) gcc_cflags_cpu="-mtune=power7 -mtune=power5"
- xlc_cflags_arch="-qarch=pwr7 -qarch=pwr5"
- cpu_path="p7 p5 p4 p3-p7" ;;
+ cpu_path="p6" ;;
+ esac
+
+ case $host in
+ *-*-aix*)
+ cclist="gcc xlc cc"
+ xlc_cflags="-O2 -qmaxmem=20000"
+ xlc_cflags_optlist="arch"
+
+ # xlc (what version?) knows -qarch=ppc, ppcgr, 601, 602, 603, 604,
+ # 403, rs64a
+ # -qarch=ppc is needed, so ensure everything falls back to that.
+ # FIXME: Perhaps newer versions know more flavours.
+ #
+ case $host_cpu in
+ powerpc403) xlc_cflags_arch="-qarch=403 -qarch=ppc" ;;
+ powerpc601) xlc_cflags_arch="-qarch=601 -qarch=ppc" ;;
+ powerpc602) xlc_cflags_arch="-qarch=602 -qarch=ppc" ;;
+ powerpc603) xlc_cflags_arch="-qarch=603 -qarch=ppc" ;;
+ powerpc603e) xlc_cflags_arch="-qarch=603 -qarch=ppc" ;;
+ powerpc604) xlc_cflags_arch="-qarch=604 -qarch=ppc" ;;
+ powerpc604e) xlc_cflags_arch="-qarch=604 -qarch=ppc" ;;
+ *) xlc_cflags_arch="-qarch=ppc" ;;
+ esac
+ ;;
esac
case $host in
@@ -953,6 +962,9 @@
xlc_cflags="-O2 -qmaxmem=20000"
xlc_cflags_optlist="arch"
xlc_32_cflags_maybe="-q32"
+ cc_cflags="-O2 -qmaxmem=20000"
+ cc_cflags_optlist="arch"
+ cc_32_cflags_maybe="-q32"
ar_32_flags="-X32"
nm_32_flags="-X32"
esac
@@ -1064,7 +1076,7 @@
;;
- # POWER 32-bit
+ # POWER
[power-*-* | power[12]-*-* | power2sc-*-*])
AC_DEFINE(HAVE_HOST_CPU_FAMILY_power)
HAVE_HOST_CPU_FAMILY_power=1
@@ -1171,7 +1183,7 @@
sh-*-*) path="sh" ;;
- [sh[2-4]-*-*]) path="sh/sh2 sh" ;;
+ sh2-*-*) path="sh/sh2 sh" ;;
*sparc*-*-*)
@@ -1310,10 +1322,8 @@
case $host_cpu in
ultrasparc | ultrasparc2 | ultrasparc2i)
path_64="sparc64/ultrasparc12 sparc64" ;;
- [ultrasparc[34]])
- path_64="sparc64/ultrasparc34 sparc64/ultrasparc1234 sparc64" ;;
- [ultrasparct[1234]])
- path_64="sparc64" ;;
+ ultrasparc3)
+ path_64="sparc64/ultrasparc34 sparc64/ultrasparc12 sparc64" ;;
*)
path_64="sparc64"
esac
@@ -1438,157 +1448,116 @@
gcc_cflags_optlist="cpu arch"
case $host_cpu in
i386*)
- gcc_cflags_cpu="-mtune=i386 -mcpu=i386 -m386"
- gcc_cflags_arch="-march=i386"
- path="x86"
- ;;
+ gcc_cflags_cpu="-mtune=i386 -mcpu=i386 -m386"
+ gcc_cflags_arch="-march=i386"
+ ;;
i486*)
- gcc_cflags_cpu="-mtune=i486 -mcpu=i486 -m486"
- gcc_cflags_arch="-march=i486"
- path="x86/i486 x86"
- ;;
+ gcc_cflags_cpu="-mtune=i486 -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=i486"
+ ;;
i586 | pentium)
- gcc_cflags_cpu="-mtune=pentium -mcpu=pentium -m486"
- gcc_cflags_arch="-march=pentium"
- path="x86/pentium x86"
- ;;
+ gcc_cflags_cpu="-mtune=pentium -mcpu=pentium -m486"
+ gcc_cflags_arch="-march=pentium"
+ ;;
pentiummmx)
- gcc_cflags_cpu="-mtune=pentium-mmx -mcpu=pentium-mmx -mcpu=pentium -m486"
- gcc_cflags_arch="-march=pentium-mmx -march=pentium"
- path="x86/pentium/mmx x86/pentium x86"
- ;;
+ gcc_cflags_cpu="-mtune=pentium-mmx -mcpu=pentium-mmx -mcpu=pentium -m486"
+ gcc_cflags_arch="-march=pentium-mmx -march=pentium"
+ ;;
i686 | pentiumpro)
- gcc_cflags_cpu="-mtune=pentiumpro -mcpu=pentiumpro -mcpu=i486 -m486"
- gcc_cflags_arch="-march=pentiumpro -march=pentium"
- path="x86/p6 x86"
- ;;
+ gcc_cflags_cpu="-mtune=pentiumpro -mcpu=pentiumpro -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=pentiumpro -march=pentium"
+ ;;
pentium2)
- gcc_cflags_cpu="-mtune=pentium2 -mcpu=pentium2 -mcpu=pentiumpro -mcpu=i486 -m486"
- gcc_cflags_arch="-march=pentium2 -march=pentiumpro -march=pentium"
- path="x86/p6/mmx x86/p6 x86"
- ;;
- pentium3)
- gcc_cflags_cpu="-mtune=pentium3 -mcpu=pentium3 -mcpu=pentiumpro -mcpu=i486 -m486"
- gcc_cflags_arch="-march=pentium3 -march=pentiumpro -march=pentium"
- path="x86/p6/p3mmx x86/p6/mmx x86/p6 x86"
- ;;
- pentiumm)
- gcc_cflags_cpu="-mtune=pentium3 -mcpu=pentium3 -mcpu=pentiumpro -mcpu=i486 -m486"
- gcc_cflags_arch="-march=pentium3 -march=pentiumpro -march=pentium"
- path="x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86"
- ;;
+ gcc_cflags_cpu="-mtune=pentium2 -mcpu=pentium2 -mcpu=pentiumpro -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=pentium2 -march=pentiumpro -march=pentium"
+ ;;
+ pentium3 | pentiumm)
+ gcc_cflags_cpu="-mtune=pentium3 -mcpu=pentium3 -mcpu=pentiumpro -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=pentium3 -march=pentiumpro -march=pentium"
+ ;;
k6)
- gcc_cflags_cpu="-mtune=k6 -mcpu=k6 -mcpu=i486 -m486"
- gcc_cflags_arch="-march=k6"
- path="x86/k6/mmx x86/k6 x86"
- ;;
+ gcc_cflags_cpu="-mtune=k6 -mcpu=k6 -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=k6"
+ ;;
k62)
- gcc_cflags_cpu="-mtune=k6-2 -mcpu=k6-2 -mcpu=k6 -mcpu=i486 -m486"
- gcc_cflags_arch="-march=k6-2 -march=k6"
- path="x86/k6/k62mmx x86/k6/mmx x86/k6 x86"
- ;;
+ gcc_cflags_cpu="-mtune=k6-2 -mcpu=k6-2 -mcpu=k6 -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=k6-2 -march=k6"
+ ;;
k63)
- gcc_cflags_cpu="-mtune=k6-3 -mcpu=k6-3 -mcpu=k6 -mcpu=i486 -m486"
- gcc_cflags_arch="-march=k6-3 -march=k6"
- path="x86/k6/k62mmx x86/k6/mmx x86/k6 x86"
- ;;
+ gcc_cflags_cpu="-mtune=k6-3 -mcpu=k6-3 -mcpu=k6 -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=k6-3 -march=k6"
+ ;;
geode)
- gcc_cflags_cpu="-mtune=k6-3 -mcpu=k6-3 -mcpu=k6 -mcpu=i486 -m486"
- gcc_cflags_arch="-march=k6-3 -march=k6"
- path="x86/geode x86/k6/k62mmx x86/k6/mmx x86/k6 x86"
- ;;
+ gcc_cflags_cpu="-mtune=k6-3 -mcpu=k6-3 -mcpu=k6 -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=k6-3 -march=k6"
+ ;;
athlon)
- # Athlon instruction costs are close to P6 (3 cycle load latency,
- # 4-6 cycle mul, 40 cycle div, pairable adc, etc) so if gcc doesn't
- # know athlon (eg. 2.95.2 doesn't) then fall back on pentiumpro.
- gcc_cflags_cpu="-mtune=athlon -mcpu=athlon -mcpu=pentiumpro -mcpu=i486 -m486"
- gcc_cflags_arch="-march=athlon -march=pentiumpro -march=pentium"
- path="x86/k7/mmx x86/k7 x86"
- ;;
+ # Athlon instruction costs are close to P6 (3 cycle load latency,
+ # 4-6 cycle mul, 40 cycle div, pairable adc, etc) so if gcc doesn't
+ # know athlon (eg. 2.95.2 doesn't) then fall back on pentiumpro.
+ gcc_cflags_cpu="-mtune=athlon -mcpu=athlon -mcpu=pentiumpro -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=athlon -march=pentiumpro -march=pentium"
+ ;;
i786 | pentium4)
- # pentiumpro is the primary fallback when gcc doesn't know pentium4.
- # This gets us cmov to eliminate branches. Maybe "athlon" would be
- # a possibility on gcc 3.0.
- #
- gcc_cflags_cpu="-mtune=pentium4 -mcpu=pentium4 -mcpu=pentiumpro -mcpu=i486 -m486"
- gcc_cflags_arch="-march=pentium4 -march=pentium4~-mno-sse2 -march=pentiumpro -march=pentium"
- gcc_64_cflags_cpu="-mtune=nocona"
- path="x86/pentium4/sse2 x86/pentium4/mmx x86/pentium4 x86"
- path_64="x86_64/pentium4 x86_64"
- ;;
+ # pentiumpro is the primary fallback when gcc doesn't know pentium4.
+ # This gets us cmov to eliminate branches. Maybe "athlon" would be
+ # a possibility on gcc 3.0.
+ #
+ gcc_cflags_cpu="-mtune=pentium4 -mcpu=pentium4 -mcpu=pentiumpro -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=pentium4 -march=pentium4~-mno-sse2 -march=pentiumpro -march=pentium"
+ gcc_64_cflags_cpu="-mtune=nocona"
+ ;;
viac32)
- # Not sure of the best fallbacks here for -mcpu.
- # c3-2 has sse and mmx, so pentium3 is good for -march.
- gcc_cflags_cpu="-mtune=c3-2 -mcpu=c3-2 -mcpu=i486 -m486"
- gcc_cflags_arch="-march=c3-2 -march=pentium3 -march=pentiumpro -march=pentium"
- path="x86/p6/p3mmx x86/p6/mmx x86/p6 x86"
- ;;
+ # Not sure of the best fallbacks here for -mcpu.
+ # c3-2 has sse and mmx, so pentium3 is good for -march.
+ gcc_cflags_cpu="-mtune=c3-2 -mcpu=c3-2 -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=c3-2 -march=pentium3 -march=pentiumpro -march=pentium"
+ ;;
viac3*)
- # Not sure of the best fallbacks here.
- gcc_cflags_cpu="-mtune=c3 -mcpu=c3 -mcpu=i486 -m486"
- gcc_cflags_arch="-march=c3 -march=pentium-mmx -march=pentium"
- path="x86/pentium/mmx x86/pentium x86"
- ;;
- athlon64 | k8 | x86_64)
- gcc_cflags_cpu="-mtune=k8 -mcpu=athlon -mcpu=pentiumpro -mcpu=i486 -m486"
- gcc_cflags_arch="-march=k8 -march=k8~-mno-sse2 -march=athlon -march=pentiumpro -march=pentium"
- path="x86/k8 x86/k7/mmx x86/k7 x86"
- path_64="x86_64/k8 x86_64"
- ;;
- k10)
- gcc_cflags_cpu="-mtune=amdfam10 -mtune=k8"
- gcc_cflags_arch="-march=amdfam10 -march=k8 -march=k8~-mno-sse2"
- path="x86/k10 x86/k8 x86/k7/mmx x86/k7 x86"
- path_64="x86_64/k10 x86_64/k8 x86_64"
- ;;
- bobcat)
- gcc_cflags_cpu="-mtune=btver1 -mtune=amdfam10 -mtune=k8"
- gcc_cflags_arch="-march=btver1 -march=amdfam10 -march=k8 -march=k8~-mno-sse2"
- path="x86/bobcat x86/k7/mmx x86/k7 x86"
- path_64="x86_64/bobcat x86_64/k10 x86_64/k8 x86_64"
- ;;
- bulldozer | bd1)
- gcc_cflags_cpu="-mtune=bdver1 -mtune=amdfam10 -mtune=k8"
- gcc_cflags_arch="-march=bdver1 -march=amdfam10 -march=k8 -march=k8~-mno-sse2"
- path="x86/bd1 x86/k7/mmx x86/k7 x86"
- path_64="x86_64/bd1 x86_64"
- ;;
- core2)
- gcc_cflags_cpu="-mtune=core2 -mtune=k8"
- gcc_cflags_arch="-march=core2 -march=core2~-mno-sse2 -march=k8 -march=k8~-mno-sse2"
- path="x86/core2 x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86"
- path_64="x86_64/core2 x86_64"
- ;;
- corei | coreinhm | coreiwsm)
- gcc_cflags_cpu="-mtune=corei7 -mtune=core2 -mtune=k8"
- gcc_cflags_arch="-march=corei7 -march=core2 -march=core2~-mno-sse2 -march=k8 -march=k8~-mno-sse2"
- path="x86/coreinhm x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86"
- path_64="x86_64/coreinhm x86_64/core2 x86_64"
- ;;
- coreisbr)
- gcc_cflags_cpu="-mtune=corei7 -mtune=core2 -mtune=k8"
- gcc_cflags_arch="-march=corei7 -march=core2 -march=core2~-mno-sse2 -march=k8 -march=k8~-mno-sse2"
- path="x86/coreisbr x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86"
- path_64="x86_64/coreisbr x86_64/coreinhm x86_64/core2 x86_64"
- ;;
+ # Not sure of the best fallbacks here.
+ gcc_cflags_cpu="-mtune=c3 -mcpu=c3 -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=c3 -march=pentium-mmx -march=pentium"
+ ;;
+ athlon64 | x86_64)
+ gcc_cflags_cpu="-mtune=k8 -mcpu=athlon -mcpu=pentiumpro -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=k8 -march=k8~-mno-sse2 -march=athlon -march=pentiumpro -march=pentium"
+ ;;
+ core2 | corei)
+ gcc_cflags_cpu="-mtune=core2 -mtune=k8"
+ gcc_cflags_arch="-march=core2 -march=core2~-mno-sse2 -march=k8 -march=k8~-mno-sse2"
+ ;;
atom)
- gcc_cflags_cpu="-mtune=atom -mtune=pentium3"
- gcc_cflags_arch="-march=atom -march=pentium3"
- path="x86/atom/sse2 x86/atom/mmx x86/atom x86"
- path_64="x86_64/atom x86_64"
- ;;
- nano)
- gcc_cflags_cpu="-mtune=nano"
- gcc_cflags_arch="-march=nano"
- path="x86/nano x86"
- path_64="x86_64/nano x86_64"
- ;;
+ gcc_cflags_cpu="-mtune=atom -mtune=pentium3"
+ gcc_cflags_arch="-march=atom -march=pentium3"
+ ;;
*)
- gcc_cflags_cpu="-mtune=i486 -mcpu=i486 -m486"
- gcc_cflags_arch="-march=i486"
- path="x86"
- path_64="x86_64"
- ;;
+ gcc_cflags_cpu="-mtune=i486 -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=i486"
+ ;;
+ esac
+
+ case $host_cpu in
+ i386*) path="x86" ;;
+ i486*) path="x86/i486 x86" ;;
+ i586 | pentium) path="x86/pentium x86" ;;
+ pentiummmx) path="x86/pentium/mmx x86/pentium x86" ;;
+ i686 | pentiumpro) path="x86/p6 x86" ;;
+ pentium2) path="x86/p6/mmx x86/p6 x86" ;;
+ pentium3) path="x86/p6/p3mmx x86/p6/mmx x86/p6 x86";;
+ pentiumm | core2 | corei)
+ path="x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86";;
+ [k6[23]]) path="x86/k6/k62mmx x86/k6/mmx x86/k6 x86" ;;
+ k6) path="x86/k6/mmx x86/k6 x86" ;;
+ geode) path="x86/k6/k62mmx x86/k6/mmx x86/k6 x86" ;;
+ # we don't have any specific 32-bit code for athlon64/opteron, the
+ # athlon code should be reasonable
+ athlon | athlon64) path="x86/k7/mmx x86/k7 x86" ;;
+ i786 | pentium4) path="x86/pentium4/sse2 x86/pentium4/mmx x86/pentium4 x86" ;;
+ # VIA/Centaur processors, sold as CyrixIII and C3.
+ viac32) path="x86/p6/p3mmx x86/p6/mmx x86/p6 x86";;
+ viac3*) path="x86/pentium/mmx x86/pentium x86";;
+ atom) path="x86/atom x86" ;;
+ *) path="x86" ;;
esac
case $host in
@@ -1600,6 +1569,30 @@
SPEED_CYCLECOUNTER_OBJ_64=x86_64.lo
cyclecounter_size_64=2
abilist="64 32"
+ path_64="x86_64"
+
+ case $host_cpu in
+ x86_64)
+ ;;
+ athlon64)
+ path_64="x86_64/k8 $path_64"
+ ;;
+ pentium4)
+ path_64="x86_64/pentium4 $path_64"
+ ;;
+ core2)
+ path_64="x86_64/core2 $path_64"
+ ;;
+ corei)
+ path_64="x86_64/corei x86_64/core2 $path_64"
+ ;;
+ atom)
+ path_64="x86_64/atom $path_64"
+ ;;
+ nano)
+ path_64="x86_64/nano $path_64"
+ ;;
+ esac
case $host in
*-*-solaris*)
@@ -1607,7 +1600,7 @@
cclist_64="$cclist_64 cc"
cc_64_cflags="-xO3 -m64"
;;
- *-*-mingw* | *-*-cygwin)
+ *-*-mingw*)
limb_64=longlong
path_64="" # Windows amd64 calling conventions are *different*
# Silence many pedantic warnings for w64. FIXME.
@@ -2737,7 +2730,7 @@
#endif
DECL_$tmp_fbase (__MPN(${tmp_fbase}_init));" >>fat.h
# encourage various macros to use fat functions
- AC_DEFINE_UNQUOTED(HAVE_NATIVE_mpn_$tmp_fbase)
+ AC_DEFINE_UNQUOTED(HAVE_NATIVE_$tmp_fbase)
done
echo "" >>fat.h
@@ -3149,11 +3142,11 @@
if test $found_asm = yes; then
GMP_PROG_M4
GMP_M4_M4WRAP_SPURIOUS
-# else
-# It's unclear why this m4-not-needed stuff was ever done.
-# if test -z "$M4" ; then
-# M4=m4-not-needed
-# fi
+else
+ # In case the user has set M4 in the environment, don't touch it.
+ if test -z "$M4" ; then
+ M4=m4-not-needed
+ fi
fi
# Only do the GMP_ASM checks if there's a .S or .asm wanting them.
diff -urN gmp-5.0.2.sav/mpn/x86/fat/fat.c gmp-5.0.5.patched/mpn/x86/fat/fat.c
--- gmp-5.0.2.sav/mpn/x86/fat/fat.c 2012-05-24 13:59:33.202339157 -0600
+++ gmp-5.0.5.patched/mpn/x86/fat/fat.c 2012-05-24 14:12:34.812339479 -0600
@@ -4,7 +4,7 @@
THEY'RE ALMOST CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR
COMPLETELY IN FUTURE GNU MP RELEASES.
-Copyright 2003, 2004, 2011 Free Software Foundation, Inc.
+Copyright 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -40,6 +40,7 @@
int __gmpn_cpuid_available __GMP_PROTO ((void));
+
#if WANT_FAKE_CPUID
/* The "name"s in the table are values for the GMP_CPU_TYPE environment
variable. Anything can be used, but for now it's the canonical cpu types
@@ -48,9 +49,8 @@
#define __gmpn_cpuid fake_cpuid
#define __gmpn_cpuid_available fake_cpuid_available
-#define MAKE_FMS(family, model) \
- ((((family) & 0xf) << 8) + (((family) & 0xff0) << 20) \
- + (((model) & 0xf) << 4) + (((model) & 0xf0) << 12))
+#define MAKE_FMS(family, model) \
+ (((family) << 8) + ((model << 4)))
static struct {
const char *name;
diff -urN gmp-5.0.2.sav/mpn/x86_64/fat/fat.c gmp-5.0.5.patched/mpn/x86_64/fat/fat.c
--- gmp-5.0.2.sav/mpn/x86_64/fat/fat.c 2012-05-24 13:59:33.202339157 -0600
+++ gmp-5.0.5.patched/mpn/x86_64/fat/fat.c 2012-05-24 14:12:34.812339479 -0600
@@ -7,7 +7,7 @@
THEY'RE ALMOST CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR
COMPLETELY IN FUTURE GNU MP RELEASES.
-Copyright 2003, 2004, 2009, 2011 Free Software Foundation, Inc.
+Copyright 2003, 2004, 2009 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -34,91 +34,11 @@
/* Change this to "#define TRACE(x) x" for some traces. */
#define TRACE(x)
-/* Change this to 1 to take the cpuid from GMP_CPU_TYPE env var. */
-#define WANT_FAKE_CPUID 0
-
/* fat_entry.asm */
long __gmpn_cpuid __GMP_PROTO ((char dst[12], int id));
-#if WANT_FAKE_CPUID
-/* The "name"s in the table are values for the GMP_CPU_TYPE environment
- variable. Anything can be used, but for now it's the canonical cpu types
- as per config.guess/config.sub. */
-
-#define __gmpn_cpuid fake_cpuid
-#define __gmpn_cpuid_available fake_cpuid_available
-
-#define MAKE_FMS(family, model) \
- ((((family) & 0xf) << 8) + (((family) & 0xff0) << 20) \
- + (((model) & 0xf) << 4) + (((model) & 0xf0) << 12))
-
-static struct {
- const char *name;
- const char vendor[13];
- unsigned fms;
-} fake_cpuid_table[] = {
- { "core2", "GenuineIntel", MAKE_FMS (6, 0xf) },
- { "coreinhm", "GenuineIntel", MAKE_FMS (6, 0x1a) },
- { "coreiwsm", "GenuineIntel", MAKE_FMS (6, 0x25) },
- { "coreisbr", "GenuineIntel", MAKE_FMS (6, 0x2a) },
- { "atom", "GenuineIntel", MAKE_FMS (6, 0x1c) },
- { "pentium4", "GenuineIntel", MAKE_FMS (15, 3) },
-
- { "k8", "AuthenticAMD", MAKE_FMS (15, 0) },
- { "k10", "AuthenticAMD", MAKE_FMS (16, 0) },
- { "bobcat", "AuthenticAMD", MAKE_FMS (20, 1) },
-
- { "nano", "CentaurHauls", MAKE_FMS (6, 15) },
-};
-
-static int
-fake_cpuid_lookup (void)
-{
- char *s;
- int i;
-
- s = getenv ("GMP_CPU_TYPE");
- if (s == NULL)
- {
- printf ("Need GMP_CPU_TYPE environment variable for fake cpuid\n");
- abort ();
- }
-
- for (i = 0; i < numberof (fake_cpuid_table); i++)
- if (strcmp (s, fake_cpuid_table[i].name) == 0)
- return i;
-
- printf ("GMP_CPU_TYPE=%s unknown\n", s);
- abort ();
-}
-
-static int
-fake_cpuid_available (void)
-{
- return fake_cpuid_table[fake_cpuid_lookup()].vendor[0] != '\0';
-}
-
-static long
-fake_cpuid (char dst[12], int id)
-{
- int i = fake_cpuid_lookup();
-
- switch (id) {
- case 0:
- memcpy (dst, fake_cpuid_table[i].vendor, 12);
- return 0;
- case 1:
- return fake_cpuid_table[i].fms;
- default:
- printf ("fake_cpuid(): oops, unknown id %d\n", id);
- abort ();
- }
-}
-#endif
-
-
typedef DECL_preinv_divrem_1 ((*preinv_divrem_1_t));
typedef DECL_preinv_mod_1 ((*preinv_mod_1_t));
@@ -168,10 +88,6 @@
__gmpn_cpuvec_init (void)
{
struct cpuvec_t decided_cpuvec;
- char vendor_string[13];
- char dummy_string[12];
- long fms;
- int family, model;
TRACE (printf ("__gmpn_cpuvec_init:\n"));
@@ -180,126 +96,54 @@
CPUVEC_SETUP_x86_64;
CPUVEC_SETUP_fat;
- __gmpn_cpuid (vendor_string, 0);
- vendor_string[12] = 0;
-
- fms = __gmpn_cpuid (dummy_string, 1);
- family = ((fms >> 8) & 0xf) + ((fms >> 20) & 0xff);
- model = ((fms >> 4) & 0xf) + ((fms >> 12) & 0xf0);
-
- /*********************************************************/
- /*** WARNING: keep this list in sync with config.guess ***/
- /*********************************************************/
- if (strcmp (vendor_string, "GenuineIntel") == 0)
- {
- switch (family)
- {
- case 4:
- case 5:
- abort (); /* 32-bit processors */
-
- case 6:
- switch (model)
- {
- case 0x00:
- case 0x01:
- case 0x02:
- case 0x03:
- case 0x04:
- case 0x05:
- case 0x06:
- case 0x07:
- case 0x08:
- case 0x09: /* Banias */
- case 0x0a:
- case 0x0b:
- case 0x0c:
- case 0x0d: /* Dothan */
- case 0x0e: /* Yonah */
- abort (); /* 32-bit processors */
-
- case 0x0f: /* Conroe Merom Kentsfield Allendale */
- case 0x10:
- case 0x11:
- case 0x12:
- case 0x13:
- case 0x14:
- case 0x15:
- case 0x16:
- case 0x17: /* PNR Wolfdale Yorkfield */
- case 0x18:
- case 0x19:
- case 0x1d: /* PNR Dunnington */
- CPUVEC_SETUP_core2;
- break;
-
- case 0x1c: /* Silverthorne */
- case 0x26: /* Lincroft */
- case 0x27: /* Saltwell */
- CPUVEC_SETUP_atom;
- break;
-
- case 0x1a: /* NHM Gainestown */
- case 0x1b:
- case 0x1e: /* NHM Lynnfield/Jasper */
- case 0x1f:
- case 0x20:
- case 0x21:
- case 0x22:
- case 0x23:
- case 0x24:
- case 0x25: /* WSM Clarkdale/Arrandale */
- case 0x28:
- case 0x29:
- case 0x2b:
- case 0x2c: /* WSM Gulftown */
- case 0x2e: /* NHM Beckton */
- case 0x2f: /* WSM Eagleton */
- CPUVEC_SETUP_core2;
- CPUVEC_SETUP_coreinhm;
- break;
-
- case 0x2a: /* SB */
- case 0x2d: /* SBC-EP */
- CPUVEC_SETUP_core2;
- CPUVEC_SETUP_coreisbr;
- break;
- }
- break;
-
- case 15:
- CPUVEC_SETUP_pentium4;
- break;
- }
- }
- else if (strcmp (vendor_string, "AuthenticAMD") == 0)
- {
- switch (family)
- {
- case 5:
- case 6:
- abort ();
-
- case 15: /* k8 */
- case 16: /* k10 */
- /* CPUVEC_SETUP_athlon */
- break;
- }
- }
- else if (strcmp (vendor_string, "CentaurHauls") == 0)
+ if (1)
{
- switch (family)
- {
- case 5:
- abort (); /* 32-bit processors */
-
- case 6:
- if (model < 15)
- abort (); /* 32-bit processors */
-
- CPUVEC_SETUP_nano;
- break;
- }
+ char vendor_string[13];
+ char dummy_string[12];
+ long fms;
+ int family, model;
+
+ __gmpn_cpuid (vendor_string, 0);
+ vendor_string[12] = 0;
+
+ fms = __gmpn_cpuid (dummy_string, 1);
+ family = ((fms >> 8) & 0xf) + ((fms >> 20) & 0xff);
+ model = ((fms >> 4) & 0xf) + ((fms >> 12) & 0xf0);
+
+ if (strcmp (vendor_string, "GenuineIntel") == 0)
+ {
+ switch (family)
+ {
+ case 4:
+ case 5:
+ abort ();
+ break;
+
+ case 6:
+ if (model == 28)
+ CPUVEC_SETUP_atom;
+ else
+ CPUVEC_SETUP_core2;
+ break;
+
+ case 15:
+ CPUVEC_SETUP_pentium4;
+ break;
+ }
+ }
+ else if (strcmp (vendor_string, "AuthenticAMD") == 0)
+ {
+ switch (family)
+ {
+ case 5:
+ case 6:
+ abort ();
+ break;
+ case 15:
+ /* CPUVEC_SETUP_athlon */
+ break;
+ }
+ }
}
/* There's no x86 generic mpn_preinv_divrem_1 or mpn_preinv_mod_1.
--
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot