Subject: Patches for gcc-2.0 (was: Re: GCC 2.0)

From: [email-masked] (Thorsten Ohl)
Date: 26 Feb 92 14:54:39 GMT

Here are the patches to compile gcc-2.0 on 680x0 based Apollo systems,
running Domain/OS in the BSD environment.  They fix the problems
I mentioned in my earlier postings.

After applying these patches, gcc-2.0 successfully compiles itself
(i.e.: there are _no_ differences, apart from COFF timestamps, between
the stage2 and the stage3 compilers).

***** Note that this only tests the ANSI C part of the compiler.  I
***** have not yet tested the C++ part (as I don't have a working
***** libg++.a) 

You will also need gas-1.38.1 with John Vasta's patches applied (for
COFF support).  The patches are ftp'able from labrea.stanford.edu.

After applying the patches and installing gas, configure gcc-2.0 with

% ./configure m68k-apollo-bsd

and follow the normal installation procedure.  Note however that
debugging support it not yet available, so you might want to leave out
the `-g' option to gcc.

It would be good if somebody with a better understanding of the Apollo
could check if #define'ing STRUCT_VALUE_INCOMING 0 really makes sense,
because the comments in the distributed version suggest otherwise (I
also do no longer understand why gcc-1.40 worked with the old
definition ...).

The change in ./config/m68k.md is probably important for _any_ 680x0
machine that wants to use a REGISTER_PREFIX.

Enjoy,
/Thorsten

*** ./config/apollo68.h-dist-2.0	Sun Dec  1 05:57:16 1991
--- ./config/apollo68.h	Wed Feb 26 01:44:12 1992
***************
*** 96,102 ****
     (See [email-masked].)  */
  
  #define ASM_SPEC \
!  "-C %{m68000:-mc68010}%{mc68000:-mc68010}%{!mc68000:%{!m68000:-mc68020}}"
  
  /* STARTFILE_SPEC
     Note that includes knowledge of the default specs for gcc, ie. no
--- 96,102 ----
     (See [email-masked].)  */
  
  #define ASM_SPEC \
!  "%{m68000:-mc68010}%{mc68000:-mc68010}%{!mc68000:%{!m68000:-mc68020}}"
  
  /* STARTFILE_SPEC
     Note that includes knowledge of the default specs for gcc, ie. no
***************
*** 127,144 ****
  #define STRUCTURE_SIZE_BOUNDARY 16
  
  /* Functions which return large structures get the address
!    to place the wanted value at offset 8 from the frame.  */
  
  #undef  PCC_STATIC_STRUCT_RETURN
  #undef  STRUCT_VALUE_REGNUM
- 
- /* Caller treats address of return area like a parm.  */
  #define STRUCT_VALUE 0
! 
! #define STRUCT_VALUE_INCOMING \
!   gen_rtx (MEM, Pmode,					\
! 	   gen_rtx (PLUS, SImode, frame_pointer_rtx,	\
! 		    gen_rtx (CONST_INT, VOIDmode, 8)))
  
  /* Boundary (in *bits*) on which stack pointer should be aligned.  */
  #undef STACK_BOUNDARY
--- 127,138 ----
  #define STRUCTURE_SIZE_BOUNDARY 16
  
  /* Functions which return large structures get the address
!    to place the wanted value from a hidden parameter.  */
  
  #undef  PCC_STATIC_STRUCT_RETURN
  #undef  STRUCT_VALUE_REGNUM
  #define STRUCT_VALUE 0
! #define STRUCT_VALUE_INCOMING 0
  
  /* Boundary (in *bits*) on which stack pointer should be aligned.  */
  #undef STACK_BOUNDARY
***************
*** 178,180 ****
--- 172,203 ----
    fprintf (FILE, "%s", NAME)

+ /* Make the local label and register prefixes compatible with
+    Vasta's modified gas.  */  
+ 
+ #undef LOCAL_LABEL_PREFIX
+ #define LOCAL_LABEL_PREFIX "."
+ 
+ #undef REGISTER_PREFIX
+ #define REGISTER_PREFIX "%"
+ 
+ /* In the machine description we need pass through printf(2).  */
+ #undef REGISTER_PREFIX_MD
+ #define REGISTER_PREFIX_MD "%%"
+ 
+ #undef REGISTER_NAMES
+ #ifndef SUPPORT_SUN_FPA
+ #define REGISTER_NAMES \
+ {"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7",	\
+  "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%sp",	\
+  "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7" }
+ #else /* SUPPORTED_SUN_FPA */
+ #define REGISTER_NAMES \
+ {"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7",	\
+  "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%sp",	\
+  "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7", \
+  "%fpa0", "%fpa1", "%fpa2", "%fpa3", "%fpa4", "%fpa5", "%fpa6", "%fpa7", \
+  "%fpa8", "%fpa9", "%fpa10", "%fpa11", "%fpa12", "%fpa13", "%fpa14", "%fpa15", \
+  "%fpa16", "%fpa17", "%fpa18", "%fpa19", "%fpa20", "%fpa21", "%fpa22", "%fpa23", \
+  "%fpa24", "%fpa25", "%fpa26", "%fpa27", "%fpa28", "%fpa29", "%fpa30", "%fpa31" }
+ #endif /* defined SUPPORT_SUN_FPA */
*** ./config/m68k.md-dist-2.0	Mon Jan 20 06:26:48 1992
--- ./config/m68k.md	Sun Feb 23 21:31:35 1992
***************
*** 4012,4018 ****
--- 4012,4022 ----
  #ifdef MOTOROLA
    return \"jmp (2,pc,%0.w)\";
  #else
+ #ifdef REGISTER_PREFIX_MD
+   return \"jmp \" REGISTER_PREFIX_MD \"pc@(2,%0:w)\";
+ #else /* not REGISTER_PREFIX_MD */
    return \"jmp pc@(2,%0:w)\";
+ #endif /* not REGISTER_PREFIX_MD */
  #endif
  #endif
  #endif
--

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Thorsten Ohl, DESY (-T-), Notkestr. 85, W-2000 Hamburg 52, FRG
phone: +49-40-8998-3699,  fax: +49-40-8998-3282              
e-mail: <[email-masked]>, <[email-masked]>,
        <[email-masked]>