Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* gdb
@ 1999-08-29  0:09 Larry Snyder
  1999-08-30 12:07 ` gdb Max Weninger
  0 siblings, 1 reply; 30+ messages in thread
From: Larry Snyder @ 1999-08-29  0:09 UTC (permalink / raw)
  To: axp-list

I know in the past there have been problems w/ gdb.  Can anyone
fill me in on where things stand now?
TIA,
-ls-


^ permalink raw reply	[flat|nested] 30+ messages in thread
[parent not found: <m0uM6E7-0001thC@atheist.tamu.edu>]
[parent not found: <Pine.SUN.3.91.960510085342.3960A-100000@edge.edge.net>]
[parent not found: <Pine.LNX.3.91.960509080842.11981C-100000@linux.cs.Helsinki.FI>]
[parent not found: <richard@atheist.tamu.edu>]
[parent not found: <Pine.LNX.3.91.960508210447.27170G-100000@linux.cs.Helsinki.FI>]
* Re: gdb
@ 1996-05-09  4:34 David Mosberger-Tang
  0 siblings, 0 replies; 30+ messages in thread
From: David Mosberger-Tang @ 1996-05-09  4:34 UTC (permalink / raw)


>>>>> On Wed, 8 May 96 23:47 EDT, eric@aib.com (Eric Youngdale) said:

  Eric> 	A few further thoughts.  I am not trying to put you
  Eric> off of the idea of optimizing in such a way that we don't
  Eric> leave nops behind, but I just want to impress upon you how
  Eric> difficult such a thing really is.

  Eric> 	Normally the assembler will resolve some things such
  Eric> as local branches without the need for emitting a relocation.
  Eric> The idea is that the branch is pc-relative, so there is no
  Eric> point in wasting time and space by telling the linker about
  Eric> something which it doesn't need to handle anyways.

You know, the reason the OSF/1 optimizer flag is called -om is that it
uses the Object Management (?) technology developed by DEC (this is
the same OM as in AT*OM*, which allows you to do purify and pixie-like
kind of stuff under OSF/1---just more flexibly).

In other words: it's pretty heavy duty stuff.

The other tradeoff is execution time: what you can do at assembly
time, you have to do only once.  This is particularly important for
(static) libraries.  Worse: the size of object files is an important
consideration as well.  We do not want to make object files any bigger
than the current ECOFF files are already.  In fact, I'd like to see
them *much* smaller (particularly the debugging info is huge).

IMHO, binary translation would be the way to go.  It allows you to
achieve the benefits of a smart linking without having to modify the
linker, the assembler, and the object file format all at once.  It's
not for free, obviously, but I like the idea of having an optimizer
that's as independent of other tools as possible.

DEC is huge in this area, but I think it also means that it is about
as proprietary as it gets.

	--david

^ permalink raw reply	[flat|nested] 30+ messages in thread
* Re: gdb
@ 1996-05-09  3:47 Eric Youngdale
  1996-05-09  5:29 ` gdb Linus Torvalds
  0 siblings, 1 reply; 30+ messages in thread
From: Eric Youngdale @ 1996-05-09  3:47 UTC (permalink / raw)


A few further thoughts.  I am not trying to put you off of the
idea of optimizing in such a way that we don't leave nops behind, but
I just want to impress upon you how difficult such a thing really is.

	Normally the assembler will resolve some things such as local
branches without the need for emitting a relocation.  The idea is that
the branch is pc-relative, so there is no point in wasting time and
space by telling the linker about something which it doesn't need to
handle anyways.

	If we were to start removing instructions, it means that we
have to repair all of these local branches.  One way of doing this
would be to have the assembler emit everything as relocations instead
of having it fill in fields that it thinks are fully resolved.  To do
this, absolutely everything, including every local label in the file
must be emitted into the object file so that it is possible for the
linker to optimize the instructions away.

	The other alternative to leaving ine information in the object
file would be for the linker to do code reading to find all of the local
branches, labelize them, optimize the code, and then use the labels
to recompute all of the offsets for the local branches.  In fact this
is probably preferable.

-Eric

^ permalink raw reply	[flat|nested] 30+ messages in thread
* Re: gdb
@ 1996-05-08 20:15 Richard Henderson
  1996-05-09  8:23 ` gdb Harald Koenig
  0 siblings, 1 reply; 30+ messages in thread
From: Richard Henderson @ 1996-05-08 20:15 UTC (permalink / raw)


[My yall are talkative today -- this is about 5 messages cut up
and pasted back together, hopefully by topic.]

Linus> On Tue, 7 May 1996, Harald Koenig wrote:
Linus> > 
Linus> > does anyone have a patch for gdb which would allow to display the
Linus> > sybmolic destination of a JSR like this
Linus> > 
Linus> >           a77db248        ldq     t12, -19896(gp)
Linus> >           6b5b6c2a        jsr     ra, (t12), 0x12004c0e4
Linus> > 
Linus> > and other accesses via (gp) for the disassebmle or x/i instruction
Linus> > for a running process ?
Linus> 
Linus> Umm, while I agree that it might make it a lot easier to debug things
Linus> on the alpha, I hope nobody writes a patch like that for gdb. The
Linus> reason I hope that is that I hope that it will be unnecessary. The
Linus> _correct_ way to handle it is to never generate those d*mn instructions
Linus> in the first place. We need an optimizing linker that gets rid of them
Linus> and makes it into a single "bsr" instruction instead. 

Well, it would have been usefull for other things as well like

	ldq	t0,-1234(gp)
	stq	v0,0(t0)

What symbol is being modified?  However, I looked at this yesterday
and I do not believe that it is possible for the disassembler to get
hold of enough context to be able to make this work.

EricY> 	This wouldn't be a hard optimization, and in fact it would make
EricY> shared libraries a bit easier for those cases where you can safely call
EricY> without going through a PLT (i.e. we are not using up a valuable .got
EricY> slot for a pointer).  It would tend to be used for things like static
EricY> functions that we would want to do this in shared libs.   For normal
EricY> executables, it is more just a question of whether the branch is in 
EricY> range or not.

Are you thinking of performing the optimization if (1) we're doing
a static executable or (2) dynamic executable and (2a) the symbol is in
the library or (2b) it is out of range?

As Linus already mentioned, The static function call case is
already handled within gcc.

DMT> But if somebody starts to work on the linker optimizations proposed by
DMT> Linus, do keep in mind that the calling convention requires $27 (pv) to
DMT> point to the starting address of the called function.  It is possible to
DMT> avoid having to load $27 but only if the global pointer register has the
DMT> same value in the caller and the callee.  In that case, you'd have to skip
DMT> the prologue code that establishes the gp (normally the first two
DMT> instructions).

The position (and existance) of the gp load can be verified by noticing
the position and existance of the appropriate fixups.

Linus> Yeah, bit me when I did the gcc optimization, which was why I eventually 
Linus> decided that we can't do it with gcc at all for the normal case.

I am thinking that there is still room for the optimization in gcc.
In the form of a flag that forces a single gp and all code to fall
within a 23-bit window (8MB?).  

How are modules handled in the kernel right now?  Surely each module
has to have its own gp?  Is it feasable to have all modules mapped 
into the same 8MB window as the rest of the kernel, or do they need
to have their calls go through a the gp?

EricY> 	Actually, the .lita sections are generated by the assembler,
EricY> so the optimization would basically mean that there are unused portions
EricY> of the file.  The linker is just appending all of the .lita sections
EricY> that the assembler generates without removing duplicates, and without
EricY> compressing it.
EricY> 
EricY> 	Frankly, I have doubts as to whether it is really wise
EricY> to generate .lita at assembly time (it should be generated by the linker
EricY> as required, instead), but I am not yet sure whether it is possible to
EricY> defer creation of this section to the linker.

:-) I was thinking of asking you if you thought adding a new
relocation type to preclude the need for the assembler to
generate the lita section was a good idea.  I was thinking that
something like that was going to be necessary to do the GOT
compression we'd been talking about.

Linus> There are some other optimizations that it would be interesting if gcc
Linus> did: "known alignment byte and word fetch/store". There are cases where
Linus> you know the alignment of a byte or short value (when the access is
Linus> through a structure or union that has guaranteed alignment due to
Linus> other larger members), but gcc creates code for the generic byte load
Linus> case. For example: 

I've been thinking about this one too.  I'd also want to have gcc know how
to do something like

    unsigned long __attribute__((align(2))) * foo;

to say that foo points to a long aligned on a short boundary.  The
Architecture Manual points out that there are simpler ways to do 
loads that are "partially" aligned.

The implementation of this optimization will likely be a bit harder
than the previous though.

r~

^ permalink raw reply	[flat|nested] 30+ messages in thread
* Re: gdb
@ 1996-05-08 19:07 Richard Gorton
  0 siblings, 0 replies; 30+ messages in thread
From: Richard Gorton @ 1996-05-08 19:07 UTC (permalink / raw)


>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).

For our FreePort Express SunOS --> Digital UNIX binary translator, we
hit this problem with a couple of our input executables.  Since the
calling convention of Linux/Alpha is currently the same as that of Digital
UNIX, it may happen with large executables under Linux/Alpha.

	Rick

Richard Gorton			All standard disclaimers apply.
Alpha Migration Tools		Projects: DECmigrate (mx), FreePort Express,
Digital Semiconductor			  Linux/Alpha
Digital Equipment Corporation
Reply-to: gorton@tallis.enet.dec.com

^ permalink raw reply	[flat|nested] 30+ messages in thread
* Re: gdb
@ 1996-05-08 18:51 Craig Burley
  0 siblings, 0 replies; 30+ messages in thread
From: Craig Burley @ 1996-05-08 18:51 UTC (permalink / raw)


>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).

It happens when I build g77 -- the f771 executable, and at
least one other, as I recall (maybe cc1plus).  Admittedly,
f771 is a highly inflated executable....

        tq vm, (burley)

^ permalink raw reply	[flat|nested] 30+ messages in thread
* Re: gdb
@ 1996-05-08 17:53 David Mosberger
  1996-05-08 18:16 ` gdb Linus Torvalds
  0 siblings, 1 reply; 30+ messages in thread
From: David Mosberger @ 1996-05-08 17:53 UTC (permalink / raw)


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...

	--david

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.
A final note: OSF/1's linker does this kind of optimizations when using the
-om flag (and possibly others, I forget).  It may be worthwhile to play with
that a little to get a feeling of what would have the biggest payoff.

^ permalink raw reply	[flat|nested] 30+ messages in thread
* Re: gdb
@ 1996-05-07 14:23 David Mosberger-Tang
  1996-05-07 15:48 ` gdb Richard Henderson
  0 siblings, 1 reply; 30+ messages in thread
From: David Mosberger-Tang @ 1996-05-07 14:23 UTC (permalink / raw)


>>>>> On Tue, 7 May 1996 08:32:42 +0200 (MET DST), koenig@tat.physik.uni-tuebingen.de (Harald Koenig) said:

  Harald> Hi, does anyone have a patch for gdb which would allow to
  Harald> display the sybmolic destination of a JSR like this

  Harald>           a77db248 ldq t12, -19896(gp)
  Harald>	    6b5b6c2a jsr ra, (t12), 0x12004c0e4

  Harald> and other accesses via (gp) for the disassebmle or x/i
  Harald> instruction for a running process ?

In general, this can't be done reliably since the bits in the jsr
instruction are a hint only.  And the hint is so small that many times
the target address you'd get based on the hint would be wrong.
Displaying a wrong hint can be very confusing and is IMHO worse than
saying nothing at all.

In object files, you can do it since there is relocation entry for the
jsr-hint giving the full address, but if the relocation information is
gone, you'd have to emulate the code far enough to know what the value
of the destination register is.  Certainly nothing that can be done in
general.  Notice that even in the code above you're not guaranteed
that t12 has the value of *(-19896(gp)) since the jsr instruction
itself could be a destination of a branch itself.

Is it doable for the common case?  Probably so.  Is it it worthwhile?
I'm not sure.

	--david

^ permalink raw reply	[flat|nested] 30+ messages in thread
* gdb
@ 1996-05-07  6:32 Harald Koenig
  1996-05-08 17:06 ` gdb Linus Torvalds
  0 siblings, 1 reply; 30+ messages in thread
From: Harald Koenig @ 1996-05-07  6:32 UTC (permalink / raw)


Hi, 

does anyone have a patch for gdb which would allow to display the
sybmolic destination of a JSR like this

          a77db248        ldq     t12, -19896(gp)
          6b5b6c2a        jsr     ra, (t12), 0x12004c0e4

and other accesses via (gp) for the disassebmle or x/i instruction
for a running process ?

Thanks,
Harald

-- 
All SCSI disks will from now on                     ___       _____
be required to send an email notice                0--,|    /OOOOOOO\
24 hours prior to complete hardware failure!      <_/  /  /OOOOOOOOOOO\
                                                    \  \/OOOOOOOOOOOOOOO\
                                                      \ OOOOOOOOOOOOOOOOO|//
Harald Koenig,                                         \/\/\/\/\/\/\/\/\/
Inst.f.Theoret.Astrophysik                              //  /     \\  \
koenig@tat.physik.uni-tuebingen.de                     ^^^^^       ^^^^^

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~1999-08-31  8:56 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <torvalds@cs.Helsinki.FI>
1996-05-08 17:19 ` gdb Eric Youngdale
1996-05-08 18:24 ` gdb Eric Youngdale
1996-07-21  0:30 ` V2.0.8 Bryan W. Headley
1996-09-09  9:03 ` Oops with 2.0.18 Martin Cornelius
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
  -- strict thread matches above, loose matches on Subject: below --
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
1996-05-08 17:53 gdb David Mosberger
1996-05-08 18:16 ` gdb Linus Torvalds
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox