Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Eric Youngdale <eric@aib.com>
Subject: Re: gdb
Date: Thu, 9 May 1996 10:55:15 -0400	[thread overview]
Message-ID: <9605091055.ZM24522@aib.com> (raw)
In-Reply-To: <richard@atheist.tamu.edu>

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

       reply	other threads:[~1996-05-09 14:55 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <richard@atheist.tamu.edu>
1996-05-09 14:55 ` Eric Youngdale [this message]
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
     [not found] <torvalds@cs.Helsinki.FI>
1996-05-08 17:19 ` gdb Eric Youngdale
1996-05-08 18:24 ` gdb Eric Youngdale
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
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