Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: Kevin Buettner <kevinb@redhat.com>, Michael Snyder <msnyder@redhat.com>
Cc: ac131313@redhat.com, gdb-patches@sources.redhat.com
Subject: Re: [RFA] mips_push_arguments(): Make O64 ABI test explicit
Date: Wed, 31 Jul 2002 18:33:00 -0000	[thread overview]
Message-ID: <1020801013004.ZM24890@localhost.localdomain> (raw)
In-Reply-To: Kevin Buettner <kevinb@redhat.com> "Re: [RFA] mips_push_arguments(): Make O64 ABI test explicit" (Jul 31,  6:10pm)

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


  reply	other threads:[~2002-08-01  1:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-31 15:40 Kevin Buettner
2002-07-31 16:11 ` Michael Snyder
2002-07-31 16:27   ` Kevin Buettner
2002-07-31 16:47     ` Michael Snyder
2002-07-31 18:16       ` Kevin Buettner
2002-07-31 18:33         ` Kevin Buettner [this message]
     [not found]           ` <20020801013959.GA15821@nevyn.them.org>
2002-08-01 16:56             ` Eric Christopher
2002-08-01 17:02               ` Kevin Buettner
2002-08-01 17:08                 ` Eric Christopher
2002-08-01 14:55         ` Andrew Cagney
2002-08-01 15:18           ` Kevin Buettner
2002-08-01 15:27             ` Andrew Cagney
2002-08-01 15:47               ` Kevin Buettner
2002-07-31 16:13 ` Michael Snyder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1020801013004.ZM24890@localhost.localdomain \
    --to=kevinb@redhat.com \
    --cc=ac131313@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=msnyder@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox