This is the mail archive of the
mailing list for the GCC project.
ARM: structure return fix
- From: Nick Clifton <nickc at cambridge dot redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: 06 Dec 2001 15:22:27 +0000
- Subject: ARM: structure return fix
The ARM port has been broken for a while now, in that when a
function has to return a large structure it was passing a hidden
memory pointer in the second argument register (r1) instead of the
first (r0). This breaks compatibility with the ARM ABI standard
(ATPCS) and also interferes with thunk handling which wants to use
Fixed, for now, by applying the following patch. One day it would
be good to switch back to using STRUCT_VALUE and fix the backend to
remove the special case code.
2001-12-06 Nick Clifton <firstname.lastname@example.org>
* config/arm/arm.h (STRUCT_VALUE): Suppress definition.
(STRUCT_VALUE_REGNUM): Restore definition.
RCS file: /cvs/gcc/gcc/gcc/config/arm/arm.h,v
retrieving revision 1.123
diff -p -c -r1.123 arm.h
*** arm.h 2001/12/05 20:32:08 1.123
--- arm.h 2001/12/06 15:11:57
*************** extern const char * structure_size_strin
*** 905,912 ****
--- 905,923 ----
/* Return the regiser number of the N'th (integer) argument. */
#define ARG_REGISTER(N) (N - 1)
+ #if 0 /* FIXME: The ARM backend has special code to handle structure
+ returns, and will reserve its own hidden first argument. So
+ if this macro is enabled a *second* hidden argument will be
+ reserved, which will break binary compatability with old
+ toolchains and also thunk handling. One day this should be
+ fixed. */
/* RTX for structure returns. NULL means use a hidden first argument. */
#define STRUCT_VALUE 0
+ /* Register in which address to store a structure value
+ is passed to a function. */
+ #define STRUCT_VALUE_REGNUM ARG_REGISTER (1)
/* Specify the registers used for certain standard purposes.
The values of these macros are register numbers. */