From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22608 invoked by alias); 1 Aug 2002 01:30:12 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 22596 invoked from network); 1 Aug 2002 01:30:10 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 1 Aug 2002 01:30:10 -0000 Received: from int-mx2.corp.redhat.com (nat-pool-rdu.redhat.com [172.16.52.200] (may be forged)) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id g711Hjl12951 for ; Wed, 31 Jul 2002 21:17:45 -0400 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id g711U8u03693; Wed, 31 Jul 2002 21:30:08 -0400 Received: from romulus.sfbay.redhat.com (IDENT:a+M1ePTLd2IwlhLe/FvlOLPk9/mINgIa@romulus.sfbay.redhat.com [172.16.27.251]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id g711U6m02395; Wed, 31 Jul 2002 18:30:06 -0700 Received: (from kev@localhost) by romulus.sfbay.redhat.com (8.11.6/8.11.6) id g711U4024891; Wed, 31 Jul 2002 18:30:04 -0700 Date: Wed, 31 Jul 2002 18:33:00 -0000 From: Kevin Buettner Message-Id: <1020801013004.ZM24890@localhost.localdomain> In-Reply-To: Kevin Buettner "Re: [RFA] mips_push_arguments(): Make O64 ABI test explicit" (Jul 31, 6:10pm) References: <1020731210452.ZM23445@localhost.localdomain> <3D486843.8007D610@redhat.com> <1020731232203.ZM24308@localhost.localdomain> <3D4870EB.BB9C282A@redhat.com> <1020801011054.ZM24816@localhost.localdomain> To: Kevin Buettner , Michael Snyder Subject: Re: [RFA] mips_push_arguments(): Make O64 ABI test explicit Cc: ac131313@redhat.com, gdb-patches@sources.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-07/txt/msg00650.txt.bz2 On Jul 31, 6:10pm, Kevin Buettner wrote: > So, it seems that cc wants small structs shifted, but that gcc does not. > > Time for me to dig into the ABI documents to find out which compiler's > right... It looks to me like the SGI (cc) compiler is right. The text below was obtained from: http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi/srch3@n64/0650/bks/SGI_Developer/books/Mpro_n32_ABI/sgi_html/ch02.html * Structs, unions, or other composite types are treated as a sequence of doublewords, and are passed in integer or floating point registers as though they were simple scalar parameters to the extent that they fit, with any excess on the stack packed according to the normal memory layout of the object. More specifically: - Regardless of the struct field structure, it is treated as a sequence of 64-bit chunks. If a chunk consists solely of a double float field (but not a double, which is part of a union), it is passed in a floating point register. Any other chunk is passed in an integer register. - A union, either as the parameter itself or as a struct parameter field, is treated as a sequence of integer doublewords for purposes of assignment to integer parameter registers. No attempt is made to identify floating point components for passing in floating point registers. - Array fields of structs are passed like unions. Array parameters are passed by reference (unless the relevant language standard requires otherwise). - Right-justifying small scalar parameters in their save area slots notwithstanding, struct parameters are always left-justified. This applies both to the case of a struct smaller than 64 bits, and to the final chunk of a struct which is not an integral multiple of 64 bits in size. The implication of this rule is that the address of the first chunk's save area slot is the address of the struct, and the struct is laid out in the save area memory exactly as if it were allocated normally (once any part in registers has been stored to the save area). [These rules are analogous to the o32-bit ABI treatment - only the chunk size and the ability to pass double fields in floating point registers are different.] So, if I understand this correctly, gdb ought to be left shifting small struct parameters for the o32, n32, and n64 ABIs. I.e, I think my patch was correct, though I do agree with Michael that it might be better to list the ABIs that we want to do this struct shifting for instead of trying to list the ones that we don't want to shift. Kevin