This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: patch for arm-coff cross compiler



> 
> I needed the following patch to make the arm-coff cross compiler generate
> usable code for an ARM7500 processor.
> 
> The code generated by the standard version is formally correct, but is
> suited for APCS-26 compliant arm processors (while the ARM7500 is APCS-32
> compliant).
> 
> Basically the default for the arm-coff compiler is APCS-32, but this
> default is correctly set up for the c preprocessor (the -D__APCS_32__
> option is added to the default options), but is left unset for cc1, that
> defaults to APCS-26 compliant code.
> 
> The problem I had was the generated code assumes the processor flags are
> left untouched across calls and this is the correct behaviour for APCS-26
> compliant processors, but it's not for APCS-32 compliant ones. 
> (note that everything works fine if you specify the -mapcs-32 option when
> calling arm-coff-gcc)
> 
> So the patch consists in forcing the same kind of options to cpp and cc1
> (basically I added a new specification for cc1 to use a default set of
> options if no -m option has been specified on the command line. And the
> options for cpp and cc1 are kept close, so that it should be easy to
> remember to change both of them if necessary).
> 
> The 2 modified files (arm.h and semi.h) follows this note.
> I found and fixed the problem using egcs-971023 and then made sure it
> works fine on egcs-971114.
> 

This shouldn't be needed.  The encoding of -mapcs-26/32 is set during the build via the TARGET_DEFAULT define in semi.h.  This is set to ARM_FLAG_APCS_32 in semi.h, but is then redefined (incorrectly) in coff.h (I hadn't noticed this before).

So the patch should be to add ARM_FLAG_APCS_32 to the definition of TARGET_DEFAULT in coff.h

Selecting the default cpu should be possible during configure, but isn't done yet.  This is partly because the code in configure.in is broken when you try to set the cpu during a cross compilation (try configuring for --target=powerpc-ibm-aix3.2.5 --host=sparc-sun-sunos4 --with-cpu=602).  Your patch would make selecting the cpu during the configure impossible.

Mon Nov 24 09:52:09 1997  Richard Earnshaw <rearnsha@arm.com>

	* arm/coff.h (TARGET_DEFAULT): Add ARM_FLAG_APCS_32 to defaults.


*** coff.h.old  Mon Nov 24 09:49:59 1997
--- coff.h      Mon Nov 24 09:50:43 1997
*************** Boston, MA 02111-1307, USA.  */
*** 30,36 ****
     point the default.  NOT --nfp!  --with{enable?} is supposed to replace it
     (right?), so let's stop using it.  */
  #undef TARGET_DEFAULT
! #define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT /*+ TARGET_CPU_DEFAULT*/)
  
  /* ??? Is a big-endian default intended to be supported?  */
  #if 0 /*TARGET_CPU_DEFAULT & ARM_FLAG_BIG_END*/
--- 30,36 ----
     point the default.  NOT --nfp!  --with{enable?} is supposed to replace it
     (right?), so let's stop using it.  */
  #undef TARGET_DEFAULT
! #define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32)
  
  /* ??? Is a big-endian default intended to be supported?  */
  #if 0 /*TARGET_CPU_DEFAULT & ARM_FLAG_BIG_END*/




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]