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]

Re: MIPS: o32 ABI problem with structs that require padding


On Apr  2, 2002, Mark Mitchell <mark@codesourcery.com> wrote:

>> Thanks, it's in.  How about other the 2 other patches that fix ABI
>> alignment and varargs problems on various MIPS ABIs go in 3.1 too?

> Send me the URLs and I will review them.

Mark ended up approving the first attached patch, since it was an ABI
fix, so I checked it in.  Other patches didn't have real effects on
ABIs (other than making a few unusable corner cases usable), but since
I can't prove the patches fix regressions from earlier releases, I'm
leaving it at that.  In case anyone got spare cycles to check for mips
regressions, let me know, and I'll send the additional patches.
Otherwise, they'll not make it to 3.1.

>From gcc-patches-return-54714-listarch-gcc-patches=gcc dot gnu dot org at gcc dot gnu dot org Sat Mar 09 05:43:28 2002
Return-Path: <gcc-patches-return-54714-listarch-gcc-patches=gcc dot gnu dot org at gcc dot gnu dot org>
Delivered-To: listarch-gcc-patches at gcc dot gnu dot org
Received: (qmail 28184 invoked by alias); 9 Mar 2002 05:43:27 -0000
Mailing-List: contact gcc-patches-help at gcc dot gnu dot org; run by ezmlm
Precedence: bulk
List-Archive: <http://gcc.gnu.org/ml/gcc-patches/>
List-Post: <mailto:gcc-patches at gcc dot gnu dot org>
List-Help: <mailto:gcc-patches-help at gcc dot gnu dot org>
Sender: gcc-patches-owner at gcc dot gnu dot org
Delivered-To: mailing list gcc-patches at gcc dot gnu dot org
Received: (qmail 28129 invoked from network); 9 Mar 2002 05:43:24 -0000
Received: from unknown (HELO cygnus.com) (205.180.230.5)
  by sources dot redhat dot com with SMTP; 9 Mar 2002 05:43:24 -0000
Received: from cse.cygnus.com (cse.cygnus.com [205.180.230.236])
	by runyon dot cygnus dot com (8 dot 8 dot 7-cygnus/8 dot 8 dot 7) with ESMTP id VAA20849
	for <gcc-patches at gcc dot gnu dot org>; Fri, 8 Mar 2002 21:43:24 -0800 (PST)
Received: from free.redhat.lsd.ic.unicamp.br (vpnuser.sfbay.redhat.com [10.255.17.131]) by cse.cygnus.com (8.8.8+Sun/8.6.4) with ESMTP id VAA20122 for <gcc-patches@gcc.gnu.org>; Fri, 8 Mar 2002 21:43:22 -0800 (PST)
Received: (from aoliva@localhost)
	by free dot redhat dot lsd dot ic dot unicamp dot br (8 dot 11 dot 6/8 dot 11 dot 6) id g295hLK18721;
	Sat, 9 Mar 2002 02:43:21 -0300
To: gcc-patches at gcc dot gnu dot org
Subject: eabi by-reference vararg may be loaded from the wrong address
From: Alexandre Oliva <aoliva at redhat dot com>
Organization: GCC Team, Red Hat
Date: 09 Mar 2002 02:43:21 -0300
Message-ID: <orbsdyz47a.fsf@free.redhat.lsd.ic.unicamp.br>
Lines: 18
User-Agent: Gnus/5.0805 (Gnus v5.8.5) Emacs/20.7
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="

--=-=-=

Large structures are passed by transparent reference in eabi.  The
problem is that, when GP registers are 64-bits wide but addresses are
only 32-bits wide (-mgp64 -mlong32), we fail to apply the padding
offset to the 32-bit address from which the address of the argument is
loaded, so we lose in big-endian mode.  This patch fixes this
problem.  This fixes gcc.c-torture/execute/920625-1.c and
g++.other/vaarg2.C.  Eric Christopher approved this change, that I
have tested with the same Red Hat-internal mips port, as well as with
a bootstrap on mips-sgi-irix6.5.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline;
  filename=mips-eabi-be-indirect-arg-addr-offset.patch

Index: gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>
	* config/mips/mips.c (mips_va_arg): Apply big-endianness address
	offset before loading address of argument passed by transparent
	reference.

Index: gcc/config/mips/mips.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/mips/mips.c,v
retrieving revision 1.178
diff -u -p -r1.178 mips.c
--- gcc/config/mips/mips.c 2002/03/09 04:03:03 1.178
+++ gcc/config/mips/mips.c 2002/03/09 04:06:19
@@ -4726,17 +4726,17 @@ mips_va_arg (valist, type)
           emit_queue();
           emit_label (lab_over);
 
+	  if (BYTES_BIG_ENDIAN && rsize != size)
+	    addr_rtx = plus_constant (addr_rtx, rsize - size);
+
           if (indirect)
    	    {
-       	      r = gen_rtx_MEM (Pmode, addr_rtx);
+	      addr_rtx = force_reg (Pmode, addr_rtx);
+	      r = gen_rtx_MEM (Pmode, addr_rtx);
 	      set_mem_alias_set (r, get_varargs_alias_set ());
 	      emit_move_insn (addr_rtx, r);
 	    }
-      	  else
-	    {
-	      if (BYTES_BIG_ENDIAN && rsize != size)
-	      addr_rtx = plus_constant (addr_rtx, rsize - size);
-	    }
+
       	  return addr_rtx;
 	}
     }

--=-=-=


-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

--=-=-=--


-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

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