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] mudflap: remove usage of builtin_frame_address


Hi,

the attached patch fixes a mudflap regression on s390 (31bit). The
__mf_wrap_alloca_indirect (mf-hooks1.c) function uses __builtin_frame_address to
get a stack address below everything allocated by the calling function.
The same can be achieved by simply taking the address of a local variable which
is guaranteed to reside on stack.
The problem with builtin_frame_address is that is does not work when
-fomit-frame-pointer is set which it is per default on s390.
The patch solution works whether we have a frame pointer or not. 

The patch fixes the pass45-frag.c mudflap regression on s390 (31bit).

Bootstrapped without regressions on i386, s390 and s390x.

OK?

Bye,

-Andreas-


2005-01-12  Andreas Krebbel  <krebbel1@de.ibm.com>

	* libmudflap/mf-hooks1.c (__mf_wrap_alloca_indirect): Remove usage of
	__builtin_frame_address.


Index: libmudflap/mf-hooks1.c
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/mf-hooks1.c,v
retrieving revision 1.4
diff -p -c -r1.4 mf-hooks1.c
*** libmudflap/mf-hooks1.c	24 Jun 2004 21:12:16 -0000	1.4
--- libmudflap/mf-hooks1.c	12 Jan 2005 08:42:01 -0000
*************** __mf_wrap_alloca_indirect (size_t c)
*** 403,409 ****
    struct alloca_tracking { void *ptr; void *stack; struct alloca_tracking* next; };
    static struct alloca_tracking *alloca_history = NULL;
  
!   void *stack = __builtin_frame_address (0);
    void *result;
    struct alloca_tracking *track;
  
--- 403,409 ----
    struct alloca_tracking { void *ptr; void *stack; struct alloca_tracking* next; };
    static struct alloca_tracking *alloca_history = NULL;
  
!   void *stack = &stack;
    void *result;
    struct alloca_tracking *track;
  


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