From: Linus Torvalds <torvalds@cs.Helsinki.FI>
Subject: Re: gdb
Date: Wed, 8 May 1996 21:16:52 +0300 (EET DST) [thread overview]
Message-ID: <a2fef3f67df41102a07833715a594e81.axp-list@archive.invalid> (raw)
In-Reply-To: <199605081753.KAA24010@web.azstarnet.com>
On Wed, 8 May 1996, David Mosberger wrote:
>
> But if somebody starts to work on the linker optimizations proposed by
> Linus, do keep in mind that the calling convention requires $27 (pv) to
> point to the starting address of the called function. It is possible to
> avoid having to load $27 but only if the global pointer register has the
> same value in the caller and the callee. In that case, you'd have to skip
> the prologue code that establishes the gp (normally the first two instructions).
>
> I know this is an old hat, but it keeps biting people...
Yeah, bit me when I did the gcc optimization, which was why I eventually
decided that we can't do it with gcc at all for the normal case.
However, my gcc was perfectly fine for stand-alone objects (notably: kernel)
with just one gp-value. It also resulted in impressive improvements in
kernel size (it was _really_ noticeable - surprisingly much so at first
look, and the gp table shrunk to some much nicer proportions).
> PS: Not to give the wrong impression: the optimization looks *very* promising
> and I think it's well worth doing. Even if you can't get rid of the load of
> $27, it still is preferable to use a bsr instruction since it won't have a
> data dependency on the load of $27 and since it is always predicted correctly.
Umm. That does help a bit, but not really that much. It's much better if
the linker just gets rid of the $27 stuff completely. It most probably
requires that the linker have all of the result binary in memory so that
it can fix up the addresses easily to jump over the ldgp thing, but I do
believe it would be noticeable for real-life code (maybe not fortran ;-)
Most functions calls are going to be withing the 4MB window, and they are
going to be to a function with the same gp value (doesn't the current
linker warn you when it has to use multiple gp's? I've never seen that
warning, so it hasn't happened with any programs I've done, but it might
happen with programs I'm not aware of).
Also note that the jsr->bsr optimization actually cuts down on the gp
table quite a lot, so just applying the optimization would also make it
less likely that we need multiple gp's per binary (I'm not counting
shared libraries or stuff like that - they obviously have their own
gp's).
Linus
next prev parent reply other threads:[~1996-05-08 18:16 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-05-08 17:53 gdb David Mosberger
1996-05-08 18:16 ` Linus Torvalds [this message]
-- strict thread matches above, loose matches on Subject: below --
1999-08-29 0:09 gdb Larry Snyder
1999-08-30 12:07 ` gdb Max Weninger
1999-08-30 15:20 ` gdb Michal Jaegermann
1999-08-30 17:12 ` gdb Max Weninger
1999-08-30 18:19 ` gdb Wes Bauske
1999-08-30 20:15 ` gdb Michal Jaegermann
1999-08-31 8:56 ` gdb Max Weninger
[not found] <m0uM6E7-0001thC@atheist.tamu.edu>
1996-05-22 11:45 ` gdb Jim Nance
[not found] <Pine.SUN.3.91.960510085342.3960A-100000@edge.edge.net>
1996-05-17 15:56 ` gdb Harald Koenig
[not found] <Pine.LNX.3.91.960509080842.11981C-100000@linux.cs.Helsinki.FI>
1996-05-09 15:43 ` gdb Richard Henderson
[not found] <richard@atheist.tamu.edu>
1996-05-09 14:55 ` gdb Eric Youngdale
[not found] <Pine.LNX.3.91.960508210447.27170G-100000@linux.cs.Helsinki.FI>
1996-05-09 8:16 ` gdb Harald Koenig
1996-05-09 4:34 gdb David Mosberger-Tang
1996-05-09 3:47 gdb Eric Youngdale
1996-05-09 5:29 ` gdb Linus Torvalds
1996-05-08 20:15 gdb Richard Henderson
1996-05-09 8:23 ` gdb Harald Koenig
1996-05-09 16:04 ` gdb Richard Henderson
1996-05-08 19:07 gdb Richard Gorton
1996-05-08 18:51 gdb Craig Burley
[not found] <torvalds@cs.Helsinki.FI>
1996-05-08 17:19 ` gdb Eric Youngdale
1996-05-08 18:24 ` gdb Eric Youngdale
1996-05-07 14:23 gdb David Mosberger-Tang
1996-05-07 15:48 ` gdb Richard Henderson
1996-05-07 6:32 gdb Harald Koenig
1996-05-08 17:06 ` gdb Linus Torvalds
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox