--- gcc-3.0.2/gcc/config/rs6000/rs6000.h.orig Thu Jul 18 15:27:37 2002 +++ gcc-3.0.2/gcc/config/rs6000/rs6000.h Thu Jul 18 15:34:39 2002 @@ -62,7 +62,7 @@ %{mcpu=rsc: -D_ARCH_PWR} \ %{mcpu=rsc1: -D_ARCH_PWR} \ %{mcpu=401: -D_ARCH_PPC} \ -%{mcpu=403: -D_ARCH_PPC} \ +%{mcpu=403: -D_ARCH_PPC -D__PPC405__} \ %{mcpu=505: -D_ARCH_PPC} \ %{mcpu=601: -D_ARCH_PPC -D_ARCH_PWR} \ %{mcpu=602: -D_ARCH_PPC} \ --- gcc-3.0.2.orig/gcc/doc/install.texi Wed Oct 17 02:06:43 2001 +++ gcc-3.0.2/gcc/doc/install.texi Sat Jul 20 16:13:14 2002 @@ -525,9 +525,17 @@ @item powerpc*-*-*, rs6000*-*-* aix64, pthread, softfloat, powercpu, powerpccpu, powerpcos, biendian, -sysv, aix. +sysv, aix, ppc405cpu. @end table + +@item --enable-ppc405cpu +Powerpc only. Normally, building gcc for powerpc produces normal +libraries in lib, and @option{-msoft-float} libraries in lib/nof. +Giving the @option{--enable-ppc405cpu} option causes another set of +libraries to be produced in lib/ppc405. These libraries are the same as +the libraries in nof, except that they also contain a workaround +for the erratum in the ppc405 stwcx instruction. @item --enable-threads Specify that the target --- gcc-3.0.2.orig/config-ml.in Tue Jun 12 19:13:23 2001 +++ gcc-3.0.2/config-ml.in Sat Jul 20 11:50:10 2002 @@ -447,6 +447,17 @@ esac done fi + if [ x$enable_ppc405cpu != xyes ] + then + old_multidirs="${multidirs}" + multidirs="" + for x in ${old_multidirs}; do + case "$x" in + *ppc405* ) : ;; + *) multidirs="${multidirs} ${x}" ;; + esac + done + fi if [ x$enable_powerpcos = xno ] then old_multidirs="${multidirs}" --- gcc-3.0.2.orig/gcc/config/rs6000/t-ppcos Tue Apr 4 18:22:36 2000 +++ gcc-3.0.2/gcc/config/rs6000/t-ppcos Sat Jul 20 11:46:19 2002 @@ -1,7 +1,7 @@ # Multilibs for a powerpc hosted ELF target (linux, SVR4, solaris) -MULTILIB_OPTIONS = msoft-float -MULTILIB_DIRNAMES = nof +MULTILIB_OPTIONS = msoft-float/mcpu=403 +MULTILIB_DIRNAMES = nof ppc405 MULTILIB_EXTRA_OPTS = fPIC mstrict-align MULTILIB_EXCEPTIONS = --- gcc-3.0.2/libstdc++-v3/config/cpu/powerpc/bits/atomicity.h.orig Tue Feb 27 16:04:08 2001 +++ gcc-3.0.2/libstdc++-v3/config/cpu/powerpc/bits/atomicity.h Thu Jul 18 13:36:39 2002 @@ -32,6 +32,18 @@ typedef int _Atomic_word; +#ifdef __PPC405__ +/* fix PPC405 specific bug: errata #77 - JRO 07/18/02 & dank + See erratum 77 in + http://www-3.ibm.com/chips/techlib/techlib.nsf/techdocs/89DED00DEBFF54BF87256A8000491BA2/$file/405CR_C_errata_1_2.pdf + See also version 1.21 of arch/ppc/kernel/ppc_asm.h, Fri Sep 21 00:00:34 2001 + in ChangeSet 1.489 at http://ppc.bkbits.net:8080/linuxppc_2_4_devel +*/ +#define __LIBSTDCPP_PPC405_ERR77_SYNC "sync \n\t" +#else +#define __LIBSTDCPP_PPC405_ERR77_SYNC +#endif + static inline _Atomic_word __attribute__ ((__unused__)) __exchange_and_add (volatile _Atomic_word* __mem, int __val) @@ -42,6 +54,7 @@ "0:\t" "lwarx %0,0,%2 \n\t" "add%I3 %1,%0,%3 \n\t" + __LIBSTDCPP_PPC405_ERR77_SYNC "stwcx. %1,0,%2 \n\t" "bne- 0b \n\t" "/* End exchange & add */" @@ -61,6 +74,7 @@ "0:\t" "lwarx %0,0,%1 \n\t" "add%I2 %0,%0,%2 \n\t" + __LIBSTDCPP_PPC405_ERR77_SYNC "stwcx. %0,0,%1 \n\t" "bne- 0b \n\t" "/* End atomic add */" @@ -81,6 +95,7 @@ "sub%I2c. %0,%0,%2 \n\t" "cntlzw %0,%0 \n\t" "bne- 1f \n\t" + __LIBSTDCPP_PPC405_ERR77_SYNC "stwcx. %3,0,%1 \n\t" "bne- 0b \n" "1:\n\t" @@ -100,6 +115,7 @@ "/* Inline always swap */\n" "0:\t" "lwarx %0,0,%1 \n\t" + __LIBSTDCPP_PPC405_ERR77_SYNC "stwcx. %2,0,%1 \n\t" "bne- 0b \n\t" "/* End always swap */" @@ -120,6 +136,7 @@ "lwarx %0,0,%1 \n\t" "cmpwi %0,0 \n\t" "bne- 1f \n\t" + __LIBSTDCPP_PPC405_ERR77_SYNC "stwcx. %2,0,%1 \n\t" "bne- 0b \n" "1:\n\t"