From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12564 invoked by alias); 26 Sep 2002 17:10:36 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 12553 invoked from network); 26 Sep 2002 17:10:35 -0000 Received: from unknown (HELO smtp.superh.com) (65.219.1.204) by sources.redhat.com with SMTP; 26 Sep 2002 17:10:35 -0000 Received: from sh-us-ex01.us.w2k.superh.com (sh-us-ex01.us.superh.com [192.168.4.40]) by smtp.superh.com (Switch-2.2.0/Switch-2.2.0) with ESMTP id g8QH2fN11315; Thu, 26 Sep 2002 10:02:41 -0700 (PDT) content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: sh4 abi doc X-MimeOLE: Produced By Microsoft Exchange V6.0.5762.3 Date: Thu, 26 Sep 2002 10:10:00 -0000 Message-ID: <287E4644B5249D449C56FA5409A874AE03EFB9@sh-us-ex01.us.w2k.superh.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: From: "Clarke, Stephen" To: "Elena Zannoni" Cc: X-SW-Source: 2002-09/txt/msg00437.txt.bz2 > From: Elena Zannoni [mailto:ezannoni@redhat.com]=20 > Sent: Thursday, September 26, 2002 9:51 AM > in the meantime, do you know what is the official rule for returning > results on the stack, instead of in the return register? > Seems that gdb and gcc are disagreeing on this. > Gdb expects structs to be returned on the stack if their size is > 1. Here's what we have: "Aggregate types not bigger than 8 bytes that have the same size and alignment as one of the integer scalar types are returned in the same registers as the integer type they match. "For example, a 2-byte aligned structure with size 2 bytes has the same size and alignment as a short int, and will be returned in R0. A 4-byte aligned structure with size 8 bytes has the same size and alignment as a long long int, and will be returned in R0 and R1. "When an aggregate type is returned in R0 and R1, R0 contains the first four bytes of the aggregate, and R1 contains the remainder. If the size of the aggregate type is not a multiple of 4 bytes, the aggregate is tail-padded up to a multiple of 4 bytes. The value of the padding is undefined. "All other aggregate types are returned by address. The caller function passes the address of an area large enough to hold the aggregate value in R2. The called function stores the result in this location." I hope that makes sense, it was difficult to describe both clearly and accurately!=20=20 Actually, the SH-4 ABI documentation that Red Hat supplies with the gnupro tools says the same thing in fewer words, but (IMO) not as clearly. Steve.