* Re: gdb
[not found] <richard@atheist.tamu.edu>
@ 1996-05-09 14:55 ` Eric Youngdale
1996-10-29 18:50 ` thanks to Richard : Xemacs compiled as ELF Zarmfab Software Development
` (4 subsequent siblings)
5 siblings, 0 replies; 36+ messages in thread
From: Eric Youngdale @ 1996-05-09 14:55 UTC (permalink / raw)
>Well, that's obviously not true.. You said it yourself: the linker _does_
>need to know about it, so the assembler is wrong.
If you assume the linker doesn't remove any code, then I don't
see how the linker would need to know about local branches.
>Now, I don't want to be the linker who tries to find local labels in the
>above. Maybe the data values happen to have patterns that match a "bsr"
>instruction, and then the linker "fixes" it because there is some jsr we
>optimized somewhere.. Uggh..
>
>So, making the linker fix things up is not only hard as h*ll, it's
>actually impossible.
No, it isn't impossible - this is getting close to the sort of
thing I get paid to do in my day job, and I know it can be done given
enough care and persistance. I will agree that it is damn hard, however.
One thing I could suggest however is that if the compiler is
absolutely 100% strict about only putting executable code into the .text
segment, then the problem becomes significantly easier. I would say
that it is even doable. The question is how easy it would be to impose
this restriction. On some architectures, it is not terribly complicated,
but on others it imposes a significant hardship.
If it is not possible to eliminate the use of non-executable
code from the .text segment, then it would be possible to add special
relocations to mark those regions of non-executable code in the text
segment, so the linker still knows to do the right thing.
>So, now think of the problem without a fixed assembler.. What do we get?
We
>get an assembler that isn't a "traditional" assembler any more: we just get
>a smart pre-processor. Essentially, the assembler shouldn't emit runnable
>code, it should emit runnable code _fragments_, and then the linker would
be >free to pad those as it sees fit. You said the hpux setup did something
that
>sounded like this (and take a look at the currently fastest single-CPU
>machine - it's not made by Digital. It's the HP PA-8000, so they have done
>some things _right_, and the compiler is probably one of those things
>even though the memory subsystem seems to be quite good).
I agree, they have done some things right. The older
32 bit versions had some very strange features which must have driven
the compiler and linker people crazy. Things like how their address space
is divided into 4 1Gb quadrants - it is very expensive to call from one
quadrant to another, especially when floating point is involved, so they
added some hacks which basically allow certain functions to be performed
without branching outside of the quadrant. With the 8000 series machine,
they now have a 64 bit machine, and I am told that some of this stupidity
goes away. The compiler people from HP that I have spoken to seem to get
rather excited about no longer having to worry about this sort of crap :-).
I have been told in all seriousness by people from HP that you should
consider static linking programs for optimum performance (basically to
avoid the overhead of branching to another quadrant - the executable
is normally in quadrant 0, and shared libs are in quadrant 1 or 2 depending
upon whether the debugger is in use or not). Anyways, let me explain some
of the things they have done in their compilers and related tools.
If you compile a program with the highest optimziation (+O4) under
SoftBench, the compiler itself doesn't actually generate any code. It
generates an internal representation of the parse tree, and it isn't
easy for me to tell whether much in the way of optimization has been done
at this point.
When you go to link such a file, the linker itself collects all of
the intermediate code that is supposed to go into the output image, and
invokes the code generator (the same one the compiler invokes if lower
levels of optimization are selected). The code generator is able to do all
of the
proper optimizations in order to optimize the *entire* image. I have
been told by people from HP that there are limits to how large a program
you can link in this manner - as you might imagine the VM usage can get
rather impressively large.
Anyways, to sum up, I think this is still a tractible problem for
the linker to handle completely without any help from the assembler
(other than some special relocation types to indicate non-executable code
in the .text section). It is highly academic at this point anyways, since
I have much more important things I need to be hacking right now anyways.
I guess we are still looking for that elusive volunteer :-).
-Eric
--
"The woods are lovely, dark and deep. But I have promises to keep,
And lines to code before I sleep, And lines to code before I sleep."
^ permalink raw reply [flat|nested] 36+ messages in thread* thanks to Richard : Xemacs compiled as ELF
[not found] <richard@atheist.tamu.edu>
1996-05-09 14:55 ` gdb Eric Youngdale
@ 1996-10-29 18:50 ` Zarmfab Software Development
1996-11-15 13:28 ` glibc snapshot 961111 binaries Zarmfab Software Development
` (3 subsequent siblings)
5 siblings, 0 replies; 36+ messages in thread
From: Zarmfab Software Development @ 1996-10-29 18:50 UTC (permalink / raw)
with many help from Richard Henderson i just installed Xemacs 19.14
at my Avanti running Redhat 4.0 as ELF,
many thanks , Richard
--
Martin Cornelius, ZARMFAB software development, University of Bremen
phone: 49-421-218-4807 FAX: 49-421-218-3889
email: fabsoft@zarm.uni-bremen.de
paper-mail: Hochschulring / Am Fallturm, 28359 BREMEN, Germany
--
To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null
^ permalink raw reply [flat|nested] 36+ messages in thread* Re: glibc snapshot 961111 binaries
[not found] <richard@atheist.tamu.edu>
1996-05-09 14:55 ` gdb Eric Youngdale
1996-10-29 18:50 ` thanks to Richard : Xemacs compiled as ELF Zarmfab Software Development
@ 1996-11-15 13:28 ` Zarmfab Software Development
1996-11-18 13:30 ` PLEASE HELP glibc 961111 : can't execute libm - linked programs Zarmfab Software Development
` (2 subsequent siblings)
5 siblings, 0 replies; 36+ messages in thread
From: Zarmfab Software Development @ 1996-11-15 13:28 UTC (permalink / raw)
On Nov 14, 10:02pm, Richard Henderson wrote:
> ps. Recently I've been told that atheist isn't always friendly
> with anon ftp, so someone probably ought to mirror this.
Well, that's true.
I'd ! promise ! to mirror the library at fabsoft.zarm.uni-bremen.de, if i
only could get it.
Couldn't you send it to me by mail, Richard ?
--
Martin Cornelius, ZARMFAB software development, University of Bremen
phone: 49-421-218-4807 FAX: 49-421-218-3889
email: fabsoft@zarm.uni-bremen.de
paper-mail: Hochschulring / Am Fallturm, 28359 BREMEN, Germany
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 36+ messages in thread* PLEASE HELP glibc 961111 : can't execute libm - linked programs
[not found] <richard@atheist.tamu.edu>
` (2 preceding siblings ...)
1996-11-15 13:28 ` glibc snapshot 961111 binaries Zarmfab Software Development
@ 1996-11-18 13:30 ` Zarmfab Software Development
1996-11-19 11:12 ` Miquel van Smoorenburg
1996-11-26 19:15 ` binutils fun Bryan W. Headley
1997-02-17 19:47 ` fclose() Bryan W. Headley
5 siblings, 1 reply; 36+ messages in thread
From: Zarmfab Software Development @ 1996-11-18 13:30 UTC (permalink / raw)
after installing glibc961111 executing any program linked with libm
results in:
<xxx>: error in loading shared libraries
/lib/libm.so.6: undefined symbol: EDOM
can anybody help me with this ?
--
Martin Cornelius, ZARMFAB software development, University of Bremen
phone: 49-421-218-4807 FAX: 49-421-218-3889
email: fabsoft@zarm.uni-bremen.de
paper-mail: Hochschulring / Am Fallturm, 28359 BREMEN, Germany
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 36+ messages in thread* Re: PLEASE HELP glibc 961111 : can't execute libm - linked programs
1996-11-18 13:30 ` PLEASE HELP glibc 961111 : can't execute libm - linked programs Zarmfab Software Development
@ 1996-11-19 11:12 ` Miquel van Smoorenburg
0 siblings, 0 replies; 36+ messages in thread
From: Miquel van Smoorenburg @ 1996-11-19 11:12 UTC (permalink / raw)
You (Zarmfab Software Development) wrote:
> after installing glibc961111 executing any program linked with libm
> results in:
>
> <xxx>: error in loading shared libraries
> /lib/libm.so.6: undefined symbol: EDOM
>
> can anybody help me with this ?
It's because sysdeps/alpha/w_sqrt.S misses a #define __need_Emath
before it includes <errnos.h>. With the standard Linux 2.0.x header
files, EDOM doesn't get defined then.
Wouldn't it be better to change errnos.h so that it does a
#ifndef EMON
#define EDOM ...
.. instead of having the app/lib having to define __need_Emath ?
I don't know if this was fixed after 961114, because I can't reach
alpha.gnu.ai.mit.edu
Mike.
--
Miquel van | Cistron Internet Services -- Alphen aan den Rijn.
Smoorenburg, | mailto:info@cistron.nl http://www.cistron.nl/
miquels@cistron.nl | Our vision is to speed up time, eventually eliminating it.
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 36+ messages in thread
* binutils fun
[not found] <richard@atheist.tamu.edu>
` (3 preceding siblings ...)
1996-11-18 13:30 ` PLEASE HELP glibc 961111 : can't execute libm - linked programs Zarmfab Software Development
@ 1996-11-26 19:15 ` Bryan W. Headley
1996-11-26 18:54 ` Richard Henderson
1997-02-17 19:47 ` fclose() Bryan W. Headley
5 siblings, 1 reply; 36+ messages in thread
From: Bryan W. Headley @ 1996-11-26 19:15 UTC (permalink / raw)
Rich,
Has the bug with objcopy moving from ECOFF to ELF been fixed? Secondary issue
(actually, not), is that compiling "sudo" as a static binary yields assert
errors in elf.c/libbfd in ld. The same damned assert errors that objcopy
enjoys... Will pull in more details as needed.
BTW, thanks for the glibc snapshot. Getting /usr/include straighten out between
elfBall, 3.0.3, 4.0, etc. really helps!
Bryan
--
Bryan W. Headley Home: bheadley@interaccess.com
211 East Pineview Drive Office: bwh@abnamro.com
Round Lake Park, IL 60073 Phone: 847 740-1446
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 36+ messages in thread* Re: binutils fun
1996-11-26 19:15 ` binutils fun Bryan W. Headley
@ 1996-11-26 18:54 ` Richard Henderson
0 siblings, 0 replies; 36+ messages in thread
From: Richard Henderson @ 1996-11-26 18:54 UTC (permalink / raw)
> Has the bug with objcopy moving from ECOFF to ELF been fixed?
No, and such a thing is very low priority. It is a non-trivial
transformation as you have to undo the brain damage inherent in
ECOFF's handling of the GP and the .lita.
> Secondary issue (actually, not), is that compiling "sudo" as a
> static binary yields assert errors in elf.c/libbfd in ld. The
> same damned assert errors that objcopy enjoys.
Those assertion failures turn out to be harmless -- your sudo should
still work -- but that has been fixed in any case for some time.
Which brings me to another point. Would those of you that have
gotten "LITERAL relocation truncated" messages while linking large
binaries contact me privately? I've now got a linker that can
handle multiple .got subsections and before I unleash it on the
world I'd like to try it out on some non-trivial examples.
r~
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: fclose()
[not found] <richard@atheist.tamu.edu>
` (4 preceding siblings ...)
1996-11-26 19:15 ` binutils fun Bryan W. Headley
@ 1997-02-17 19:47 ` Bryan W. Headley
1997-02-17 20:04 ` fclose() Richard Henderson
5 siblings, 1 reply; 36+ messages in thread
From: Bryan W. Headley @ 1997-02-17 19:47 UTC (permalink / raw)
On Feb 17, 1:01pm, Richard Henderson wrote:
> Subject: Re: fclose()
> > fclose(fchan); /* works */
> > fclose(fchan); /* segfaults */
>
> Yep. malloc doen't like it when you free the same pointer twice.
>
> > Ok, so Who's in charge of this code, so I relay my findings?
>
> Me, I guess. This is a known occurrence. The bug, though,
> is with the program trying to fclose twice. The solution of
> course is not to do that.
>
Sometimes you can control that, sometimes you can't. Stupid example:
let's say that I, overly-conscientious guy, fclose stdin and stdout
and then do an exit(). It's exit's job to close all opened file handles,
and naturally it should try to close stdin/stdout. Should exit segv or
exit gracefully? The latter. Especially since fclose() should return
error code in rather than segv'ing.
In professional world, I've seen far too many programs that close all
handles at termination, regardless of whether if known that handle is
open or not. It WOULD be nice to legislate good programming, I agree...
But legacy code rules, especially when practice is "sort of" backed up by API
specs.
--
Bryan W. Headley Home: bheadley@interaccess.com
211 East Pineview Drive Office: bwh@abnamro.com
Round Lake Park, IL 60073 Phone: 847 740-1446
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 36+ messages in thread* Re: fclose()
1997-02-17 19:47 ` fclose() Bryan W. Headley
@ 1997-02-17 20:04 ` Richard Henderson
0 siblings, 0 replies; 36+ messages in thread
From: Richard Henderson @ 1997-02-17 20:04 UTC (permalink / raw)
> In professional world, I've seen far too many programs that close all
> handles at termination, regardless of whether if known that handle is
> open or not. It WOULD be nice to legislate good programming, I agree...
*sigh* Well, there is a solution when you can't fix the source
and that is use a different malloc that can handle multiple frees.
This can be done by either explicitly linking with one when you are
in control of such things or using LD_PRELOAD when you aren't.
But the vast majority of the programs run under Linux *can* have
their sources fixed, and most often it's just a silly little thing
that only takes a few minutes, and so we should.
> But legacy code rules, especially when practice is "sort of" backed up
> by API specs.
There is no API spec that allows "fclose(foo); fclose(foo);".
As always, the effect is undefined/unpredictable.
r~
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 36+ messages in thread
* gdb
@ 1999-08-29 0:09 Larry Snyder
1999-08-30 12:07 ` gdb Max Weninger
0 siblings, 1 reply; 36+ 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] 36+ messages in thread
* Re: gdb
1999-08-29 0:09 gdb Larry Snyder
@ 1999-08-30 12:07 ` Max Weninger
1999-08-30 15:20 ` gdb Michal Jaegermann
0 siblings, 1 reply; 36+ messages in thread
From: Max Weninger @ 1999-08-30 12:07 UTC (permalink / raw)
To: axp-list; +Cc: larrys
Hi,
On 28 Aug, Larry Snyder wrote:
> I know in the past there have been problems w/ gdb. Can anyone
> fill me in on where things stand now?
> TIA,
> -ls-
>
The problems are still there. With a stock gdb 4.17 and egcs you will
get "strange" results using "next" and "step" commands. Strange means
that e.g. next runs till the end.
The problem is that egcs generates incorrect information about function
prologues. This problem has been dicussed on the gdb mailing list.
I use gdb 4.17.0.11 + a special patch (more a hack than a patch :-) )
for using gdb together with egcs (and gcc-2.95).
If needed i can provide the patch.
BTW gdb 4.18 does not work either out of the tgz (e.g. when calling a
function it crashes)
Another problem is reading core dumps generated with 2.2.x kernels. With
a stock 4.17 it is not possible. Some patches where communicated on the
gdb mailing list but i never tried one of them,
Regards
Max
--
_______________________________________________________________
\
o/\_ DI Max Weninger
<\__,\ Email (max@takefive.co.at)
">. |
` .-| TakeFive Software - Jakob-Haringer-Str. 8
. \ A-5020 Salzburg - AUSTRIA
. \ Tel: +43 662 4579150 - Fax: +43 662 4579156
.-|
_________._|____________________________________________________
^ permalink raw reply [flat|nested] 36+ messages in thread* Re: gdb
1999-08-30 12:07 ` gdb Max Weninger
@ 1999-08-30 15:20 ` Michal Jaegermann
1999-08-30 17:12 ` gdb Max Weninger
0 siblings, 1 reply; 36+ messages in thread
From: Michal Jaegermann @ 1999-08-30 15:20 UTC (permalink / raw)
To: axp-list
Max Weninger wrote:
>
> The problems are still there. With a stock gdb 4.17 and egcs you will
> get "strange" results using "next" and "step" commands. Strange means
> that e.g. next runs till the end.
>
> The problem is that egcs generates incorrect information about function
> prologues. This problem has been dicussed on the gdb mailing list.
Somehow this does not mesh up with my experience; i.e. prologues info
is undoubtely incorrect. Still my "private" workaround is after
breaking in a function to step through one or two executable statements.
Unless I compiled with -fomit-frame-pointer gdb as a rule is "catching
up" and a backtrace is looking sane. Is that different for others?
> Another problem is reading core dumps generated with 2.2.x kernels.
I do not recall reasonable cores ever (beyond an information what
generated it). For this a workaround is to run a program from gdb
and provoke a crash. gdb will catch exception and one can usually
get more information than from a static core. Quite often it is
possible to attach gdb to a running process somewhat closer to a point
in which is crashing so an overhead is smaller. This is particularly
true with programs with GUI or some other user interaction.
Michal
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: gdb
1999-08-30 15:20 ` gdb Michal Jaegermann
@ 1999-08-30 17:12 ` Max Weninger
1999-08-30 18:19 ` gdb Wes Bauske
0 siblings, 1 reply; 36+ messages in thread
From: Max Weninger @ 1999-08-30 17:12 UTC (permalink / raw)
To: axp-list
On 30 Aug, Michal Jaegermann wrote:
> Max Weninger wrote:
>>
>> The problems are still there. With a stock gdb 4.17 and egcs you will
>> get "strange" results using "next" and "step" commands. Strange means
>> that e.g. next runs till the end.
>>
>> The problem is that egcs generates incorrect information about function
>> prologues. This problem has been dicussed on the gdb mailing list.
>
> Somehow this does not mesh up with my experience; i.e. prologues info
> is undoubtely incorrect. Still my "private" workaround is after
> breaking in a function to step through one or two executable statements.
> Unless I compiled with -fomit-frame-pointer gdb as a rule is "catching
> up" and a backtrace is looking sane. Is that different for others?
What do you mean with "executable statements" ?
>> Another problem is reading core dumps generated with 2.2.x kernels.
>
> I do not recall reasonable cores ever (beyond an information what
> generated it). For this a workaround is to run a program from gdb
> and provoke a crash. gdb will catch exception and one can usually
> get more information than from a static core. Quite often it is
> possible to attach gdb to a running process somewhat closer to a point
> in which is crashing so an overhead is smaller. This is particularly
> true with programs with GUI or some other user interaction.
IMHO analysing core dumps is on of the favour "features" of unixes.
e.g. when a customer of us has a crash he just sends the core dump. This
can give you an huge amount of information what leads to the crash.
Max
--
_______________________________________________________________
\
o/\_ DI Max Weninger
<\__,\ Email (max@takefive.co.at)
">. |
` .-| TakeFive Software - Jakob-Haringer-Str. 8
. \ A-5020 Salzburg - AUSTRIA
. \ Tel: +43 662 4579150 - Fax: +43 662 4579156
.-|
_________._|____________________________________________________
^ permalink raw reply [flat|nested] 36+ messages in thread* Re: gdb
1999-08-30 17:12 ` gdb Max Weninger
@ 1999-08-30 18:19 ` Wes Bauske
1999-08-30 20:15 ` gdb Michal Jaegermann
1999-08-31 8:56 ` gdb Max Weninger
0 siblings, 2 replies; 36+ messages in thread
From: Wes Bauske @ 1999-08-30 18:19 UTC (permalink / raw)
To: axp-list
Max Weninger wrote:
>
>
> What do you mean with "executable statements" ?
>
Uh, like a=a+b;
vs /* comment */
> >> Another problem is reading core dumps generated with 2.2.x kernels.
> >
> > I do not recall reasonable cores ever (beyond an information what
> > generated it). For this a workaround is to run a program from gdb
> > and provoke a crash. gdb will catch exception and one can usually
> > get more information than from a static core. Quite often it is
> > possible to attach gdb to a running process somewhat closer to a point
> > in which is crashing so an overhead is smaller. This is particularly
> > true with programs with GUI or some other user interaction.
>
> IMHO analysing core dumps is on of the favour "features" of unixes.
> e.g. when a customer of us has a crash he just sends the core dump. This
> can give you an huge amount of information what leads to the crash.
>
I agree, core's are useful. In fact, a while back someone
posted a fix to allow reading core files on Alphas to this
list. If I remember correctly, there is a problem in the
definitions of registers or some such that causes the core
to be unreadable. If the archives go back far enough, you
should be able to find it. Also, I think it was related to
having to be able to sort out the difference between two
formats and gdb just didn't know how to do it. Anyone ever
try the patch? I get along doing as Michal suggests.
Wes
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: gdb
1999-08-30 18:19 ` gdb Wes Bauske
@ 1999-08-30 20:15 ` Michal Jaegermann
1999-08-31 8:56 ` gdb Max Weninger
1 sibling, 0 replies; 36+ messages in thread
From: Michal Jaegermann @ 1999-08-30 20:15 UTC (permalink / raw)
To: axp-list
Wes Bauske wrote:
>
> Max Weninger wrote:
> >
> >
> > What do you mean with "executable statements" ?
> >
>
> Uh, like a=a+b;
> vs /* comment */
And also vs. assorted tests, branches and maybe calls. Take that
as a suggestion and not a new definition. :-)
>
> I agree, core's are useful.
If what I wrote suggested something opposite that I did not express
myself clearly. I meant that cores are not something you cannot live
without. Nice to have sometimes but hardly crucial; still this should
be fixed.
The problem with a mythical "customer" sending a core is that often
they will have either 'ulimit -c' set to something and the "interesting"
part invariably will be in this unrecorded part. :-) Or they will
have core sizes unlimited and with many troublesome programs and
nowadays memories this will create such huge file that it will be hardly
feasible to look at it - not mentioning sending it around.
When I was consulting for some outfit with commercial support contracts
for their "professional" software nobody from suppliers ever wanted
to peek at core files they were collecting at an alarming rate. :-)
Michal
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: gdb
1999-08-30 18:19 ` gdb Wes Bauske
1999-08-30 20:15 ` gdb Michal Jaegermann
@ 1999-08-31 8:56 ` Max Weninger
1 sibling, 0 replies; 36+ messages in thread
From: Max Weninger @ 1999-08-31 8:56 UTC (permalink / raw)
To: axp-list
Hi,
On 30 Aug, Wes Bauske wrote:
> I agree, core's are useful. In fact, a while back someone
> posted a fix to allow reading core files on Alphas to this
> list. If I remember correctly, there is a problem in the
> definitions of registers or some such that causes the core
> to be unreadable. If the archives go back far enough, you
> should be able to find it. Also, I think it was related to
> having to be able to sort out the difference between two
> formats and gdb just didn't know how to do it. Anyone ever
> try the patch? I get along doing as Michal suggests.
You are right, the problem was the different format of the timeval
struct members (int vs. long) between the kernel and libc.
I just found the fix you mentioned on the gdb-bugs mailing list. I will
try to apply it :-)
Regards
Max
--
_______________________________________________________________
\
o/\_ DI Max Weninger
<\__,\ Email (max@takefive.co.at)
">. |
` .-| TakeFive Software - Jakob-Haringer-Str. 8
. \ A-5020 Salzburg - AUSTRIA
. \ Tel: +43 662 4579150 - Fax: +43 662 4579156
.-|
_________._|____________________________________________________
^ permalink raw reply [flat|nested] 36+ messages in thread
[parent not found: <m0uM6E7-0001thC@atheist.tamu.edu>]
* Re: gdb
[not found] <m0uM6E7-0001thC@atheist.tamu.edu>
@ 1996-05-22 11:45 ` Jim Nance
0 siblings, 0 replies; 36+ messages in thread
From: Jim Nance @ 1996-05-22 11:45 UTC (permalink / raw)
> > I think compiling with the -om flag under Digital Unix does this. The
> > reason I point this out is that Digital wrote a nice paper on doing this
> > type of optimization, and you can get it by mailing to an address at DEC.
> > Unfortunatly, I cant remember the address. If anyone wants the paper, I
> > will try to dig up the address, just send me some email. If anyone knows
> > the address, please send it to me so I don't have to dig it up :-)
>
> I'd like to see it, if you can find it, or find someone who can
> find it. I am contemplating just such an optimization for gld,
> and it certainly wouldn't hurt to look at available source material.
I found it on their web page. The following URL lists all the technical
reports they have available:
http://www.research.digital.com/wrl/techreports/pubslist.html
Of specific interest are:
http://www.research.digital.com/wrl/techreports/abstracts/92.6.html
http://www.research.digital.com/wrl/techreports/abstracts/94.1.html
http://www.research.digital.com/wrl/techreports/abstracts/89.17.html
If you look at the list of papers that are available, you get they idea
that the people at DEC's WRL are into a lot of different and interesting
things. I asked one of them about this once, and he told me they got to
work on almost anything they wanted to. I keep hoping that one of them
will decide that Linux would be really cool to play with :-)
Jim
^ permalink raw reply [flat|nested] 36+ messages in thread
[parent not found: <Pine.SUN.3.91.960510085342.3960A-100000@edge.edge.net>]
* Re: gdb
[not found] <Pine.SUN.3.91.960510085342.3960A-100000@edge.edge.net>
@ 1996-05-17 15:56 ` Harald Koenig
0 siblings, 0 replies; 36+ messages in thread
From: Harald Koenig @ 1996-05-17 15:56 UTC (permalink / raw)
> > -rwxrwxr-x 1 root root 3235840 May 9 10:12 XF86_S3
>
> Where can I get this at so I can get my xserver working?
we've decided to build a first binary distribution based on XFree86 3.1.2E
(which is a public beta test with sources available only for beta-testers)
which should be readable now on ftp.xfree86.org.
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] 36+ messages in thread
[parent not found: <Pine.LNX.3.91.960509080842.11981C-100000@linux.cs.Helsinki.FI>]
* Re: gdb
[not found] <Pine.LNX.3.91.960509080842.11981C-100000@linux.cs.Helsinki.FI>
@ 1996-05-09 15:43 ` Richard Henderson
0 siblings, 0 replies; 36+ messages in thread
From: Richard Henderson @ 1996-05-09 15:43 UTC (permalink / raw)
Linus wrote:
> So, now think of the problem without a fixed assembler.. What do we get? We
> get an assembler that isn't a "traditional" assembler any more: we just get a
> smart pre-processor. Essentially, the assembler shouldn't emit runnable code,
> it should emit runnable code _fragments_, and then the linker would be free
> to pad those as it sees fit.
I don't believe that ELF is compatible with the notion of subsections,
at least in the same way that it supports regular sections. However,
this has sparked an Idea.
We introduce a new relocation type (CALL) which marks a bsr insn.
We introduce a new assembler macro (call) that emits this relocation.
This obviates the need for the assembler to have any special intuition
about the code -- intutition that is often wrong when people are doing
odd hand assembly stuff.
The assembler is required to retain fixup information across CALLs.
We allow the assembler to elide branch relocs that do not cross calls
to help reduce the size of the object file and speed linking.
When the linker goes to put all this together, based on the specifics of
the situation, it expands the CALL reloc in one of three ways:
(1) intra-module, to a function with the same gp:
Fixes up the bsr with the function address. If exists a
GPDISP relocation at the function address, we add 8.
(2) intra-module, to a function with a different gp:
Expands to:
ldq $27,fn($gp)
bsr reg,fn
ldgp $gp,0(reg)
where reg is extracted from the original bsr insn.
This rather than hard-code $26 to support functions
such as __divq that use t9.
(3) inter-module:
Expands to:
ldq $27,fn($gp)
jsr reg,($27)
ldgp $gp,0(reg)
So the linker will have to expand the section to accomodate the added
code (worst case by a factor of four), but we already specified that
the assembler must retain relocation information across the call, so the
linker has everything it needs to fix things up after its changes.
Comments?
r~
^ permalink raw reply [flat|nested] 36+ messages in thread
[parent not found: <Pine.LNX.3.91.960508210447.27170G-100000@linux.cs.Helsinki.FI>]
* Re: gdb
[not found] <Pine.LNX.3.91.960508210447.27170G-100000@linux.cs.Helsinki.FI>
@ 1996-05-09 8:16 ` Harald Koenig
0 siblings, 0 replies; 36+ messages in thread
From: Harald Koenig @ 1996-05-09 8:16 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).
this happens when linking the X11 server. this is the *stripped* binary
(and adding PEX, XIE, and eventually MESA for GLX/OpenGL support will
get much larger ;-)
-rwxrwxr-x 1 root root 3235840 May 9 10:12 XF86_S3
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] 36+ messages in thread
* Re: gdb
@ 1996-05-09 4:34 David Mosberger-Tang
0 siblings, 0 replies; 36+ 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] 36+ messages in thread
* Re: gdb
@ 1996-05-09 3:47 Eric Youngdale
1996-05-09 5:29 ` gdb Linus Torvalds
0 siblings, 1 reply; 36+ 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] 36+ messages in thread
* Re: gdb
1996-05-09 3:47 gdb Eric Youngdale
@ 1996-05-09 5:29 ` Linus Torvalds
0 siblings, 0 replies; 36+ messages in thread
From: Linus Torvalds @ 1996-05-09 5:29 UTC (permalink / raw)
On Wed, 8 May 1996, Eric Youngdale wrote:
>
> 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.
I _hope_ that it wouldn't be too difficult if we just did it the right
way..
> 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.
Well, that's obviously not true.. You said it yourself: the linker _does_
need to know about it, so the assembler is wrong.
> 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.
Umm, I really would prefer the assembler leaving enough information -
otherwise the linker bugs will be so horrible to find that it's not worth
it . In particular think about this kind of code:
function:
nop /* align */
br $1,1f
.quad 0xYYYYYYYYYYYYYYYY
.quad 0xYYYYYYYYYYYYYYYY
1: ldq $2,0($1)
ldq $3,8($1)
...
Now look at that code: it's one way to pack in some static data in the
code segment. Admittedly gcc doesn't do this, but it's actually useful
for some very low-level assembly where you don't want to have the gp
value at all..
Now, I don't want to be the linker who tries to find local labels in the
above. Maybe the data values happen to have patterns that match a "bsr"
instruction, and then the linker "fixes" it because there is some jsr we
optimized somewhere.. Uggh..
So, making the linker fix things up is not only hard as h*ll, it's
actually impossible.
So, now think of the problem without a fixed assembler.. What do we get? We
get an assembler that isn't a "traditional" assembler any more: we just get a
smart pre-processor. Essentially, the assembler shouldn't emit runnable code,
it should emit runnable code _fragments_, and then the linker would be free
to pad those as it sees fit. You said the hpux setup did something that
sounded like this (and take a look at the currently fastest single-CPU
machine - it's not made by Digital. It's the HP PA-8000, so they have done
some things _right_, and the compiler is probably one of those things
even though the memory subsystem seems to be quite good).
We don't really have to be object-file compatible with OSF/1.. Doesn't
the GNU linker already handle multiple different types of segments? We
should be able to link normal ECOFF segments with the "fragment" setup
without any fundamental problem (I'm not saying fragment handling is
easy, but it shouldn't be fundamentally impossible).
With a fragmenting assembler, the assembler can do something like this:
- assume that the jump is always local, do a "bsr", but also do a "end
fragment" at the bsr.
- the linker reads in a stream of fragments, notices that "oops, we
can't do a bsr here", and expands the bsr to the proper address load
and jsr. If it _can_ do a "bsr", it obviously has to know where the
target is already, so it takes a look at the target, sees if there is
any "ldgp" sequence at the start, and fixes up the "bsr" to jump over
it.
You already showed some nervousness about the assembler creating the .lita
entries, so it seems there are some fundamental design mistakes in the
current setup, and maybe we _should_ be thinking about moving parts of the
assembler into the linker instead (others have done this for similar reasons
- you can do some other limited global optimizations with this same technique
where the assembler doesn't generate fixed code)
Linus
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: gdb
@ 1996-05-08 20:15 Richard Henderson
1996-05-09 8:23 ` gdb Harald Koenig
0 siblings, 1 reply; 36+ 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] 36+ messages in thread* Re: gdb
1996-05-08 20:15 gdb Richard Henderson
@ 1996-05-09 8:23 ` Harald Koenig
1996-05-09 16:04 ` gdb Richard Henderson
0 siblings, 1 reply; 36+ messages in thread
From: Harald Koenig @ 1996-05-09 8:23 UTC (permalink / raw)
> 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.
my idea was just to use the actual gp value from the registers ("info reg")
which would allow to check these addresses at least for the current subroutine
when using breakpoints. not a really general solution but quite helpful
for the few "disassembler sessions" I've had so far.
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] 36+ messages in thread* Re: gdb
1996-05-09 8:23 ` gdb Harald Koenig
@ 1996-05-09 16:04 ` Richard Henderson
0 siblings, 0 replies; 36+ messages in thread
From: Richard Henderson @ 1996-05-09 16:04 UTC (permalink / raw)
> my idea was just to use the actual gp value from the registers ("info reg")
> which would allow to check these addresses at least for the current subroutine
> when using breakpoints. not a really general solution but quite helpful
> for the few "disassembler sessions" I've had so far.
Two problems: (1) the disassembler cannot get hold of the registers
under gdb, and (2) it must also work when invoked under objdump in
which there are no registers and no coherant table from which to
extract the addresses.
Perhaps easier would be to have some simple macro to print a symbol
name given a gp offset. Something like
gdb> pgp -1234
$2 = {int ()} 0x140040274 <foo>
Without testing, try:
define pgp
p *((int (*))($ + $gp))
end
which would actually require you to type
gdb> p -1234
$1 = (int) -1234
gdb> pgp
$2 = {int ()} 0x123456789 <foo>
At some point, they really ought to add arguments to gdb macros.
r~
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: gdb
@ 1996-05-08 19:07 Richard Gorton
0 siblings, 0 replies; 36+ 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] 36+ messages in thread
* Re: gdb
@ 1996-05-08 18:51 Craig Burley
0 siblings, 0 replies; 36+ 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] 36+ messages in thread* Re: gdb
@ 1996-05-08 17:53 David Mosberger
1996-05-08 18:16 ` gdb Linus Torvalds
0 siblings, 1 reply; 36+ 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] 36+ messages in thread
* Re: gdb
1996-05-08 17:53 gdb David Mosberger
@ 1996-05-08 18:16 ` Linus Torvalds
0 siblings, 0 replies; 36+ messages in thread
From: Linus Torvalds @ 1996-05-08 18:16 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 36+ messages in thread
[parent not found: <torvalds@cs.Helsinki.FI>]
* Re: gdb
[not found] <torvalds@cs.Helsinki.FI>
@ 1996-05-08 17:19 ` Eric Youngdale
1996-05-08 18:24 ` gdb Eric Youngdale
1 sibling, 0 replies; 36+ messages in thread
From: Eric Youngdale @ 1996-05-08 17:19 UTC (permalink / raw)
>Umm, while I agree that it might make it a lot easier to debug things on
the
>alpha, I hope nobody writes a patch like that for gdb. The reason I hope
>that is that I hope that it will be unnecessary. The _correct_ way to
handle >it is to never generate those d*mn instructions in the first place.
We need >an optimizing linker that gets rid of them and makes it into a
single "bsr"
>instruction instead.
This wouldn't be a hard optimization, and in fact it would make
shared libraries a bit easier for those cases where you can safely call
without going through a PLT (i.e. we are not using up a valuable .got
slot for a pointer). It would tend to be used for things like static
functions that we would want to do this in shared libs. For normal
executables, it is more just a question of whether the branch is in range or
not.
Remind me about this in about 4 months :-). I think the actual
code for this would be relatively simple. Note that we would leave behind
a NOP, since it would be a lot harder for the linker to compress this
out.
If someone else wants to attempt this they can, of course, and I
can give pointers as to what would be needed.
-Eric
--
"The woods are lovely, dark and deep. But I have promises to keep,
And lines to code before I sleep, And lines to code before I sleep."
^ permalink raw reply [flat|nested] 36+ messages in thread* Re: gdb
[not found] <torvalds@cs.Helsinki.FI>
1996-05-08 17:19 ` gdb Eric Youngdale
@ 1996-05-08 18:24 ` Eric Youngdale
1 sibling, 0 replies; 36+ messages in thread
From: Eric Youngdale @ 1996-05-08 18:24 UTC (permalink / raw)
>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).
Actually, the .lita sections are generated by the assembler,
so the optimization would basically mean that there are unused portions
of the file. The linker is just appending all of the .lita sections
that the assembler generates without removing duplicates, and without
compressing it.
Frankly, I have doubts as to whether it is really wise
to generate .lita at assembly time (it should be generated by the linker
as required, instead), but I am not yet sure whether it is possible to
defer creation of this section to the linker.
-Eric
--
"The woods are lovely, dark and deep. But I have promises to keep,
And lines to code before I sleep, And lines to code before I sleep."
^ permalink raw reply [flat|nested] 36+ 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; 36+ 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] 36+ messages in thread
* Re: gdb
1996-05-07 14:23 gdb David Mosberger-Tang
@ 1996-05-07 15:48 ` Richard Henderson
0 siblings, 0 replies; 36+ messages in thread
From: Richard Henderson @ 1996-05-07 15:48 UTC (permalink / raw)
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 ?
DMT> In general, this can't be done reliably since the bits in the jsr
DMT> instruction are a hint only. And the hint is so small that many times
DMT> the target address you'd get based on the hint would be wrong.
DMT> Displaying a wrong hint can be very confusing and is IMHO worse than
DMT> saying nothing at all.
I'm guessing that Harold just wants to know what symbol lives at -19896(gp).
Since the contents of the registers are not available in the context
of the disassembler, some sort of code search would have to be performed
to find out what $gp should be. Once that was available, printing the
symbol whose address is being referenced in the GOT is trivial.
I'll think about it and see how hard it would be to get hold of the gp.
r~
^ permalink raw reply [flat|nested] 36+ messages in thread
* gdb
@ 1996-05-07 6:32 Harald Koenig
1996-05-08 17:06 ` gdb Linus Torvalds
0 siblings, 1 reply; 36+ 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] 36+ messages in thread* Re: gdb
1996-05-07 6:32 gdb Harald Koenig
@ 1996-05-08 17:06 ` Linus Torvalds
0 siblings, 0 replies; 36+ messages in thread
From: Linus Torvalds @ 1996-05-08 17:06 UTC (permalink / raw)
On Tue, 7 May 1996, Harald Koenig wrote:
>
> 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 ?
Umm, while I agree that it might make it a lot easier to debug things on the
alpha, I hope nobody writes a patch like that for gdb. The reason I hope that
is that I hope that it will be unnecessary. The _correct_ way to handle it is
to never generate those d*mn instructions in the first place. We need an
optimizing linker that gets rid of them and makes it into a single "bsr"
instruction instead.
The reasons for doing it with "bsr":
- it's smaller (no data space needed, and only 1 insn)
- it's faster (roughly 10-1000 times faster! The load will stall, and it
will stall a _lot_ if it wasn't in the cache)
- it doesn't have any problems like the above when debugging - you see
the bsr target quite well.
- secondary issues: cache footprints etc.
The reason it's not done with "bsr" now:
- the compiler can't know at compile-time if the target will be within
21 bits (or whatever the branch offset was). In 99% of all cases it
_will_ be in range, and it's essentially just calling a shared library
that can't be optimized.
- thus the linker needs to do the optimizing, and the linker isn't
clever enough (it should also look at the target, and jump over any
"ldgp" instructions when it's within the same ldgp area).
So if somebody wants to do something worthwhile on the alpha, and doesn't
like the instruction scheduling stuff, _this_ single optimization would
probably make more of a difference.. The easy way to handle it is within
the compiler (make gcc always use "bsr" and never reload "gp"), but that
doesn't work for the generic case, so it's not really worth pursuing (I
wrote patches to gcc that did it, but I threw them away after I noticed
all the problems with shared libs etc).
gcc _does_ produce "bsr" calls, but only for local jumps (static
functions or calls to a function that was defined earlier in the same
source file). That makes it very inefficient to do subroutine calls (it's
not just the added instructions, it's the data segment access I don't
like either).
There are some other optimizations that it would be interesting if gcc did:
"known alignment byte and word fetch/store". There are cases where you know
the alignment of a byte or short value (when the access is through a
structure or union that has guaranteed alignment due to other larger
members), but gcc creates code for the generic byte load case. For example:
struct example {
struct example * next;
unsigned char data;
};
gcc will compile "example->data = 1" as something like this (note the silly
"addq $16,8,$3", even though we are only interested in the low 7 bits of the
address for the byte masking ops, but note even more the whole broken
algorithm):
ldq_u $2,8($16)
bis $31,1,$1
addq $16,8,$3
insbl $1,$3,$1
mskbl $2,$3,$2
bis $1,$2,$1
stq_u $1,8($16)
it _should_ be something like this (note that this example happens to be
exactly aligned on a 8-byte boundary, but the same thing works with very
minor modifications for any structure byte access, because we know what
the alignment withing the quadword should be):
ldq $1,8($16)
zap $1,1,$1
bis $1,1,$1
stq $1,8($16)
I would really like to get the code density a bit better - alpha binaries are
inherently larger than x86 and most others, but it doesn't exactly help that
gcc is stupid in some ways. And I'd like to work on gcc - I've done small
hacks before and it could be interesting - but I don't honestly think I'll
have the time to do anything real..
Linus
^ permalink raw reply [flat|nested] 36+ messages in thread
end of thread, other threads:[~1999-08-31 8:56 UTC | newest]
Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <richard@atheist.tamu.edu>
1996-05-09 14:55 ` gdb Eric Youngdale
1996-10-29 18:50 ` thanks to Richard : Xemacs compiled as ELF Zarmfab Software Development
1996-11-15 13:28 ` glibc snapshot 961111 binaries Zarmfab Software Development
1996-11-18 13:30 ` PLEASE HELP glibc 961111 : can't execute libm - linked programs Zarmfab Software Development
1996-11-19 11:12 ` Miquel van Smoorenburg
1996-11-26 19:15 ` binutils fun Bryan W. Headley
1996-11-26 18:54 ` Richard Henderson
1997-02-17 19:47 ` fclose() Bryan W. Headley
1997-02-17 20:04 ` fclose() Richard Henderson
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] <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
[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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox