public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "H. J. Lu" <hjl@lucon.org>
To: Andreas Schwab <schwab@suse.de>
Cc: gcc@gcc.gnu.org
Subject: Re: Does gcc violate the ia64 ABI?
Date: Fri, 16 May 2003 22:27:00 -0000	[thread overview]
Message-ID: <20030516152508.A4885@lucon.org> (raw)
In-Reply-To: <je7k8q7dc9.fsf@sykes.suse.de>; from schwab@suse.de on Sat, May 17, 2003 at 12:09:58AM +0200

On Sat, May 17, 2003 at 12:09:58AM +0200, Andreas Schwab wrote:
> "H. J. Lu" <hjl@lucon.org> writes:
> 
> |> I will open a bug in gcc bugzilla when conversion is done. In the
> |> meantime, I opened
> |> 
> |> https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=91056
> |> 
> |> The problem is gcc doesn't save/store gp across call. According to the
> |> ia64 ABI, callee can change gp and gp must be saved/restore by caller
> |> across calls. It is on page 5-2 in the Itanium Software Conventions
> |> and Runtime Architecture Guide. Am I right?
> 
> I don't see where's the problem.  If a function does not use a
> call-clobbered register there is no need for saving/restoring it.  It's
> the duty of the caller to do it.

gp is a special register in the ia64 ABI:

On page 5-2 in Itanium Software Conventions and Runtime Architecture
Guide, there are

...
a. On entry to a procedure, gp is guaranteed valide for that procedure.
b. At any direct procedure call, gp must be valid (for the caller). This
guarantees that an import stub (see Section 8.4.1) can access the linkage
table.
c. Any procedure call (indirect or direct) may modify gp - unless the call
is known to be local to the load module.
d. At procedure return, gp must be valid (for the returning prodecure).
This allows the compiler to optimize calls known to be local (i.e., the
exceptions to Rule 'c').

The effect of the rules is that gp must be treated as scratch register
at the point of call (i.e., it must be saved by the caller), and it must
be preserved from entry to exit.

Since bar () may modify gp, at the return of foo, gp must be valid for foo
even if foo doesn't use gp at all. Did I miss something here?


H.J.

  reply	other threads:[~2003-05-16 22:25 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-16 21:55 H. J. Lu
2003-05-16 22:10 ` Andreas Schwab
2003-05-16 22:27   ` H. J. Lu [this message]
2003-05-17  0:50     ` Richard Henderson
2003-05-17  5:52       ` H. J. Lu
2003-05-17 18:58         ` Richard Henderson
2003-05-17 22:02           ` H. J. Lu
2003-05-18  0:08             ` Richard Henderson
2003-05-18  3:10               ` H. J. Lu
2003-05-20 23:21               ` H. J. Lu
2003-05-21  3:22                 ` Richard Henderson
2003-05-16 23:37 John David Anglin
2003-05-17 18:58 John David Anglin
2003-05-17 20:43 ` H. J. Lu
2003-05-17 23:27   ` John David Anglin
2003-05-17 23:45     ` H. J. Lu
2003-05-18  3:22       ` John David Anglin
2003-05-18  4:10         ` H. J. Lu
2003-05-18 23:00           ` John David Anglin
2003-05-19  3:08             ` Fergus Henderson
2003-05-19  6:18               ` Richard Henderson
2003-05-19 15:00                 ` H. J. Lu
2003-05-19 15:06                   ` Jakub Jelinek
2003-05-19 15:27                     ` H. J. Lu
2003-05-19 20:43                       ` Richard Henderson

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=20030516152508.A4885@lucon.org \
    --to=hjl@lucon.org \
    --cc=gcc@gcc.gnu.org \
    --cc=schwab@suse.de \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).