gcc 3.4.2 cpu32 patch

Aaron J. Grier aaron at frye.com
Wed Nov 17 21:57:22 UTC 2004


attached is a patch to gcc 3.4.2 to fix added preprocessor #defines for
cpu32 targets.  I've included comments for clarity.

I've successfully built an rtems-m68k cross-compiler for my 68331 target
with this patch.  (I was using peter barada's gcc 3.4.2 CVS repository,
but this patch should apply to the trunk version as well.)

-- 
  Aaron J. Grier  |   Frye Electronics, Tigard, OR   |  aaron at frye.com
  "Note that many bands' backline amps produce levels exceeding OSHA
   standards for industrial facilities.  Yet this is considered normal
   working conditions for musicians.  That's showbiz." -- Scott Dorsey
-------------- next part --------------
Index: gcc-3.4.2/gcc/config/m68k/m68k.h
===================================================================
RCS file: /home/cvs/xgcc/gcc-3.4.2/gcc/config/m68k/m68k.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 m68k.h
--- gcc-3.4.2/gcc/config/m68k/m68k.h	17 Oct 2004 17:54:06 -0000	1.1.1.1
+++ gcc-3.4.2/gcc/config/m68k/m68k.h	11 Nov 2004 01:14:22 -0000
@@ -122,8 +122,10 @@
 /* Macros used in the machine description to test the flags.  */
 
 /* Compile for a 68020 (not a 68000 or 68010).  */
+/* XXX 2004-11-10 <aaron at frye.com>
+ * a true 68020 has bitfield operations, while cpu32 doesn't. */
 #define MASK_68020	(1<<0)
-#define TARGET_68020 (target_flags & MASK_68020)
+#define TARGET_68020 ((target_flags & MASK_68020) && (target_flags & MASK_BITFIELD))
 
 /* Compile for a 68030.  This does not really make a difference in GCC,
    it just enables the __mc68030__ predefine.  */
@@ -228,7 +230,14 @@
 
 /* Compile for a CPU32.  A 68020 without bitfields is a good
    heuristic for a CPU32.  */
-#define TARGET_CPU32	(TARGET_68020 && !TARGET_BITFIELD)
+/* XXX 2004-11-10 <aaron at frye.com>
+ * yes and no... cpu32 doesn't have a separate interrupt stack pointer,
+ * and has exclusive instructions like bgnd, lpstop, and tbl* . if
+ * support ever gets added in gcc for these instructions (unlikely)
+ * we'll need an exclusive bit to express cpu32-ness, but until then we
+ * can cheat with the following, provided that TARGET_68020 is also
+ * modified as described above. */
+#define TARGET_CPU32	((target_flags & MASK_68020) && !TARGET_BITFIELD)
 
 /* Is the target a ColdFire?  */
 #define MASK_COLDFIRE	(MASK_5200|MASK_528x|MASK_CFV3|MASK_CFV4)


More information about the users mailing list