[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Questions/Suggestion regarding RTEMS PowerPC code (long)



On Tue, 18 May 1999, VALETTE Eric wrote:

> 3) R2/R13 manipulation for EABI implementation
> ----------------------------------------------
> 
> I do not understand the handling of r2 and r13 in the
> EABI case. The specification for r2 says pointer to sdata2,
> sbss2 section => constant. However I do not see -ffixed-r2
> passed to any compilation system in make/custom/*
> (for info linux does this on PPC).
> 
> So either this is a default compiler option when choosing 
> powerpc-rtems and thus we do not need to do anything with
> this register as all the code is compiled with this compiler
> and linked together OR this register may be used by rtems code
> and then we do not need any special initialization or 
> handling.
> 
> The specification for r13 says pointer to the small data
> area. r13 argumentation is the same except that as far 
> as I know the usage of the small data area requires 
> specific compiler support so that access to variables is 
> compiled via loading the LSB in a register and then 
> using r13 to get full address... It is like a small
> memory model and it was present in IBM C compilers.
> 
> => I propose to suppress any specific code for r2 and 
> r13 in the EABI case.

Boy this is an ugly one to track through the tools.

powerpc-rtems is essentially powerpc-eabi.  

The ABI ends up being called "sysv" in the config files.  Note this:

/* Default ABI to use */
#define RS6000_ABI_NAME "sysv"

But the TARGET_DEFAULT setting is in eabi.h and sets MASK_EABI, so I think
the r2/r13 for small data is on by default:

#include "rs6000/sysv4.h"

/* Add -meabi to target flags */
#undef TARGET_DEFAULT
#define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_EABI)

So I think everything is turned on to use r2/r13 by default.

Was that the basic issue?

--joel