From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29199 invoked by alias); 20 Nov 2002 16:10:19 -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 29183 invoked from network); 20 Nov 2002 16:10:15 -0000 Received: from unknown (HELO hub.ott.qnx.com) (209.226.137.76) by sources.redhat.com with SMTP; 20 Nov 2002 16:10:15 -0000 Received: from smtp.ott.qnx.com (smtp.ott.qnx.com [10.0.2.158]) by hub.ott.qnx.com (8.9.3/8.9.3) with ESMTP id LAA22163; Wed, 20 Nov 2002 11:06:17 -0500 Received: from catdog ([10.4.2.2]) by smtp.ott.qnx.com (8.8.8/8.6.12) with SMTP id LAA01260; Wed, 20 Nov 2002 11:00:44 -0500 Message-ID: <190001c290af$4447fc00$0202040a@catdog> From: "Kris Warkentin" To: Cc: , References: <200211201556.gAKFubQ13945@pc960.cambridge.arm.com> Subject: Re: ARM stack alignment on hand called functions Date: Wed, 20 Nov 2002 08:10:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-SW-Source: 2002-11/txt/msg00258.txt.bz2 ----- Original Message ----- From: "Richard Earnshaw" > No, I don't think this is correct, since it will mean that the structure > starts at an unaligned address. Instead the space allocated for the > structure on the stack should be rounded up to a word and then the > structure copied into that space with an aligned starting point. But in this case, the issue isn't with passing arguments but rather with returning them. Earlier in hand_function_call() (in valops.c), there is some code where if a structure is being returned, we enlarge the stack by the size of the structure. This is what wasn't aligned. For example, if you called 'fun2()', which returns a 2 byte structure, the type length was '2' which is how much the stack pointer is out. This way, when we write the stack at the start of the called function, our sp is misaligned. The frame pointer is fine so the function gets the arguments alright, it's just writing stack variables and return values to the stack that is buggered. I'm looking at this and thinking, it just gives a little padding on the stack to maintain alignment. cheers, Kris