public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@redhat.com>
To: binutils@sources.redhat.com, Steve Munroe <sjmunroe@us.ibm.com>,
	Anton Blanchard <antonb@au1.ibm.com>,
	Paul Mackerras <paulus@au1.ibm.com>
Subject: Re: powerpc new PLT and GOT
Date: Thu, 12 May 2005 18:07:00 -0000	[thread overview]
Message-ID: <20050512171412.GA6429@redhat.com> (raw)
In-Reply-To: <20050512083650.GH29302@bubble.grove.modra.org>

On Thu, May 12, 2005 at 06:06:50PM +0930, Alan Modra wrote:
> # ith PLT code stub.
> 	addis 11,30,(plt+(i-1)*4-got)@ha
> 	lwz 11,(plt+(i-1)*4-got)@l(11)
> 	mtctr 11
> 	bctr
> # or, if plt+(i-1)*4-got is less than 32k
> 	lwz 11,(plt+(i-1)*4-got)(30)
> 	mtctr 11
> 	bctr
> 
> # A table of branches, one for each plt entry.
> # The idea is that the plt call stub loads ctr (and r11) with these
> # addresses, so (r11 - res_0) gives the plt index * 4.
> res_0:	b PLTresolve
> res_1:	b PLTresolve
> .
> # Some number of entries towards the end can be nops
> res_n_m3: nop
> res_n_m2: nop
> res_n_m1:

I'm not thrilled, but I suppose in the normal case we'll still be
consuming only 4 words per plt.  And update forms are slow, and to
be avoided if possible.

> 	addis 11,11,(1b-res_0)@ha
> 	addi 11,11,(1b-res_0)@l
> 	sub 11,11,12			# r11 = index * 4

Reverse the res entries and you can compute

	sub 11,12,11
	subi 11,11,(1b-res_0)

> Of course, if we want to make the normal plt call path go fast, then the
> thing to do is have gcc generate the plt call stubs so that they can be
> scheduled.  So gcc generates
> 
>  addis 11,30,foo@gotplt@ha
>  lwz 11,foo@gotplt@l(11)
>  mtctr 11,foo@gotplt_marker
>  bctr foo@gotplt_marker
> 
> hopefully with other instructions scheduled in the sequence.  The funny
> looking gotplt_marker relocs are because ld might resolve "foo" to a
> local function, and would then turn the sequence into
> 
>  nop
>  nop
>  nop
>  bl foo

I don't think this is worthwhile.  IF we ever make gcc inline plt entries,
we should only do so when we have a good idea the target isn't local.
Relocations that get gotplt entries can be useful though.



r~

  parent reply	other threads:[~2005-05-12 17:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-11 14:22 Alan Modra
2005-05-11 14:29 ` Daniel Jacobowitz
2005-05-11 14:59   ` Alan Modra
2005-05-11 15:10     ` Andreas Schwab
2005-05-11 15:39       ` Alan Modra
2005-05-11 15:16     ` Daniel Jacobowitz
2005-05-11 16:37       ` Richard Earnshaw
2005-05-11 14:45 ` Andreas Schwab
2005-05-12  6:08 ` Richard Henderson
2005-05-12  6:13   ` Alan Modra
2005-05-12  7:47     ` Richard Henderson
2005-05-12  9:02       ` Alan Modra
2005-05-12 16:10         ` Alan Modra
2005-05-12 18:07         ` Richard Henderson [this message]
2005-05-14  5:57           ` Alan Modra
2005-05-17 14:16             ` Alan Modra
2005-05-19  8:32               ` Alan Modra

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=20050512171412.GA6429@redhat.com \
    --to=rth@redhat.com \
    --cc=antonb@au1.ibm.com \
    --cc=binutils@sources.redhat.com \
    --cc=paulus@au1.ibm.com \
    --cc=sjmunroe@us.ibm.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).