This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

[patch] Incorrect CFA when pretend_args_size != 0


The default definition of ARG_POINTER_CFA_OFFSET assumes the CFA coincides 
with the first incoming argument. This is not true on targets that set 
pretend_args_size and push some incoming arguments in the callee function 
prologue.  For these targets the CFA is the first incoming argument pushed by 
the caller.

The patch below adds this offset to the default CFA calculation.

Tested on arm-none-eabi, and spot checks on mips-elf and i686-linux.
This is a regression from 4.0.
Ok for mainline and 4.1?

Paul

2006-03-02  Paul Brook  <paul@codesourcery.com>

	* defaults.h (ARG_POINTER_CFA_OFFSET): Add pretend_args_size.

Index: gcc/defaults.h
===================================================================
--- gcc/defaults.h	(revision 111606)
+++ gcc/defaults.h	(working copy)
@@ -856,9 +856,12 @@ Software Foundation, 51 Franklin Street,
 #define FRAME_GROWS_DOWNWARD 0
 #endif
 
-/* On most machines, the CFA coincides with the first incoming parm.  */
+/* On most machines, the CFA coincides with the first incoming parm.
+   Skip arguments pushed by the callee prologue.  */
 #ifndef ARG_POINTER_CFA_OFFSET
-#define ARG_POINTER_CFA_OFFSET(FNDECL) FIRST_PARM_OFFSET (FNDECL)
+#define ARG_POINTER_CFA_OFFSET(FNDECL) \
+  (FIRST_PARM_OFFSET (FNDECL) \
+   + DECL_STRUCT_FUNCTION(FNDECL)->pretend_args_size)
 #endif
 
 /* The offset from the incoming value of %sp to the top of the stack frame


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