diff --git a/my_config.h b/my_config.h index ad2e3da..435a126 100644 --- a/my_config.h +++ b/my_config.h @@ -4,13 +4,14 @@ * identical. Hence, this file is architecture-independent and calls * in an arch-dependent file that will appear in just one RPM. * + * To avoid breaking arches not explicitly supported by Red Hat, we + * use this indirection file *only* on known multilib arches. + * * Note: this may well fail if user tries to use gcc's -I- option. * But that option is deprecated anyway. */ #if defined(__x86_64__) #include "my_config_x86_64.h" -#elif defined(__ia64__) -#include "my_config_ia64.h" #elif defined(__i386__) #include "my_config_i386.h" #elif defined(__ppc64__) || defined(__powerpc64__) @@ -21,4 +22,8 @@ #include "my_config_s390x.h" #elif defined(__s390__) #include "my_config_s390.h" +#elif defined(__sparc__) && defined(__arch64__) +#include "my_config_sparc64.h" +#elif defined(__sparc__) +#include "my_config_sparc.h" #endif diff --git a/mysql-sparc-gcc-bug.patch b/mysql-sparc-gcc-bug.patch new file mode 100644 index 0000000..4771bdc --- /dev/null +++ b/mysql-sparc-gcc-bug.patch @@ -0,0 +1,22 @@ +This is a temporary workaround for what is surely a gcc bug on Sparc. +Submitted as bz #529299 + + +diff -Naur mysql-5.1.39.orig/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp mysql-5.1.39/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp +--- mysql-5.1.39.orig/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp 2009-09-04 12:21:16.000000000 -0400 ++++ mysql-5.1.39/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp 2009-10-15 22:19:07.000000000 -0400 +@@ -8538,11 +8538,7 @@ + default: + tmp = 0; + } +- memcpy(signal->theData, &tmp, 8); /* must be memcpy, gives strange results on +- * ithanium gcc (GCC) 3.4.1 smp linux 2.4 +- * otherwise +- */ +- // Uint32 * src = (Uint32*)&tmp; +- // signal->theData[0] = src[0]; +- // signal->theData[1] = src[1]; ++ Uint32 * src = (Uint32*)&tmp; ++ signal->theData[0] = src[0]; ++ signal->theData[1] = src[1]; + } diff --git a/mysql.spec b/mysql.spec index 1c0c19a..6b6c0bb 100644 --- a/mysql.spec +++ b/mysql.spec @@ -1,6 +1,6 @@ Name: mysql Version: 5.1.39 -Release: 2%{?dist} +Release: 3%{?dist} Summary: MySQL client programs and shared libraries Group: Applications/Databases URL: http://www.mysql.com @@ -33,6 +33,7 @@ Patch7: mysql-plugin-bug.patch Patch8: mysql-setschedparam.patch Patch9: mysql-ndb-stacksize.patch Patch10: mysql-strmov.patch +Patch11: mysql-sparc-gcc-bug.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: gperf, perl, readline-devel, openssl-devel @@ -176,6 +177,7 @@ the MySQL sources. %patch8 -p1 %patch9 -p1 %patch10 -p1 +%patch11 -p1 libtoolize --force aclocal @@ -190,6 +192,11 @@ CFLAGS="%{optflags} -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" CFLAGS="$CFLAGS -fno-strict-aliasing -fwrapv" # force PIC mode so that we can build libmysqld.so CFLAGS="$CFLAGS -fPIC" +# gcc seems to have some bugs on sparc as of 4.4.1, back off optimization +# submitted as bz #529298 +%ifarch sparc sparcv9 sparc64 +CFLAGS=`echo $CFLAGS| sed -e "s|-O2|-O1|g" ` +%endif # extra C++ flags as per recommendations in mysql's INSTALL-SOURCE doc CXXFLAGS="$CFLAGS -felide-constructors -fno-rtti -fno-exceptions" export CFLAGS CXXFLAGS @@ -263,7 +270,7 @@ rm -rf $RPM_BUILD_ROOT # multilib header hacks # we only apply this to known Red Hat multilib arches, per bug #181335 case `uname -i` in - i386 | x86_64 | ppc | ppc64 | s390 | s390x | sparc | sparcv9 | sparc64 ) + i386 | x86_64 | ppc | ppc64 | s390 | s390x | sparc | sparc64 ) mv $RPM_BUILD_ROOT/usr/include/mysql/my_config.h $RPM_BUILD_ROOT/usr/include/mysql/my_config_`uname -i`.h install -m 644 %{SOURCE5} $RPM_BUILD_ROOT/usr/include/mysql/ mv $RPM_BUILD_ROOT/usr/include/mysql/storage/ndb/ndb_types.h $RPM_BUILD_ROOT/usr/include/mysql/storage/ndb/ndb_types_`uname -i`.h @@ -642,6 +649,13 @@ fi %{_mandir}/man1/mysql_client_test.1* %changelog +* Thu Oct 15 2009 Tom Lane 5.1.39-3 +- Work around two different compiler bugs on sparc, one by backing off + optimization from -O2 to -O1, and the other with a klugy patch +Related: #529298, #529299 +- Clean up bogosity in multilib stub header support: ia64 should not be + listed (it's not multilib), sparc and sparc64 should be + * Wed Sep 23 2009 Tom Lane 5.1.39-2 - Work around upstream bug 46895 by disabling outfile_loaddata test diff --git a/ndb_types.h b/ndb_types.h index f6c1230..14bc905 100644 --- a/ndb_types.h +++ b/ndb_types.h @@ -22,4 +22,8 @@ #include "ndb_types_s390x.h" #elif defined(__s390__) #include "ndb_types_s390.h" +#elif defined(__sparc__) && defined(__arch64__) +#include "ndb_types_sparc64.h" +#elif defined(__sparc__) +#include "ndb_types_sparc.h" #endif