Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Kris Warkentin" <kewarken@qnx.com>
To: <Richard.Earnshaw@arm.com>
Cc: <gdb@sources.redhat.com>
Subject: Re: ARM stack alignment on hand called functions
Date: Wed, 20 Nov 2002 08:26:00 -0000	[thread overview]
Message-ID: <191601c290b1$942159e0$0202040a@catdog> (raw)
In-Reply-To: <200211201618.gAKGITW18622@pc960.cambridge.arm.com>

The problem arises only with functions which return structures whose size is
not evenly divisible by 4.  Below is what I did to solve it.

Index: arm-tdep.c
===================================================================
RCS file: /product/tools/gdb/gdb/arm-tdep.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -c -r1.9 -r1.10
*** arm-tdep.c  20 Sep 2002 17:11:31 -0000      1.9
--- arm-tdep.c  19 Nov 2002 18:33:37 -0000      1.10
***************
*** 1480,1485 ****
--- 1480,1486 ----
        }
      }

+   sp = (sp + 3) & ~3;
    /* Return adjusted stack pointer.  */
    return sp;
  }

The code in valops.c : hand_function_call() that was causing the problem was
this:

  /* Reserve space for the return structure to be written on the
     stack, if necessary */
  if (struct_return)
    {
      int len = TYPE_LENGTH (value_type);
      if (STACK_ALIGN_P ())
 /* MVS 11/22/96: I think at least some of this stack_align
    code is really broken.  Better to let PUSH_ARGUMENTS adjust
    the stack in a target-defined manner.  */
 len = STACK_ALIGN (len);
      if (INNER_THAN (1, 2))
 {
   /* stack grows downward */
   sp -= len;
   struct_addr = sp;
 }

So what I did was to make sure that arm_push_arguments would always return
an aligned stack pointer.  I think we can safely agree that
arm_push_arguments should NEVER return an unaligned stack pointer right?

cheers,

Kris


  reply	other threads:[~2002-11-20 16:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-20  7:29 Kris Warkentin
2002-11-20  7:58 ` Richard Earnshaw
2002-11-20  8:10   ` Kris Warkentin
2002-11-20  8:21     ` Richard Earnshaw
2002-11-20  8:26       ` Kris Warkentin [this message]
2002-11-20  9:18         ` Andrew Cagney
2002-11-20  9:35           ` Kris Warkentin
2002-11-26 14:01             ` Andrew Cagney
2002-11-27  1:18               ` Richard Earnshaw
2002-11-20 10:37         ` Richard Earnshaw
2002-11-20 10:59           ` Kris Warkentin
2002-11-20 11:40             ` Kris Warkentin
2002-11-21  2:58               ` Richard Earnshaw
     [not found] <200211272021.PAA04606@hub.ott.qnx.com>
2002-11-27 13:13 ` Kris Warkentin

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='191601c290b1$942159e0$0202040a@catdog' \
    --to=kewarken@qnx.com \
    --cc=Richard.Earnshaw@arm.com \
    --cc=gdb@sources.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