Subject: compilers [was GNU stuff}
To: None <port-pmax@NetBSD.ORG>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: port-pmax
Date: 12/26/1994 23:41:05
I'm using gcc-2.5.8, with a  NetBSD config consed up from
the 4.4BSD (mips-dec-bsd) configuration -- basically just
a new specfile -- plus binutils-2.5.2 with a `true' NetBSD a.out backend.

The binutils back-end is a simple bugfix for the  byteswapping
of magic numbers (which is only half done in the BFD).

I have always refused to buy into porting the ``native'' NetBSD
toolset to the mips.  The native as and ld are derived from very old
versions of gas and ld.  Adding support for mips processors, and the
requisite mips machinery (GP-relative addressing) to these tools takes
more time than I've ever considered worthwhile.

For anyone who doesn't know, GP-relative addressing on the MIPS is using
the $gp register to point into a "constant pool" where small constants
can reside.  This is a workaround for the instruction set only having small
offets, and that therefore loading an arbitrary 32-bit address, or constant,
requires two immediate loads with 16-bit offets. It's measurably faster
to put small constants into a linker section addressed by the $gp register,
which is loaded appropriattely at startup time.  However, this requires
back-end support for the relevant sections (.rdata, .sdata, .sbss?),
which is impossible to do in standard a.out format.

===>  The most important thing in all this is, current versions
      of GCC absolutey __require__  GP-relative addressing for
      loading floating-point constants.  So we NEED GP-relative addressing.
      I can't currently compile  all of libm.a, because some of
      the files cause gcc 2.5.8 to coredump, and I can't even bootstrap
      2.6.{0,1,2,3} because of the double-precision floating-point constants.
	
I think Ted's suggestion of using ELF is a good one.


There is also source code from Ralph Campbell that encapsulates the
special MIPS linker sections in a.out format, using special names to
delimit the implict ``sections'' within .text, .data, and .bss; but
this for an old version of gas and binutils, which in turn has other
bugs in the BFD that affect NetBSD-style magic numbers.  If I had time
I'd port Ralph's gp-relative changes back into a current GNU bintuils.
But I don't.


Is it possible that the 4.4BSD-on-Decstation community that uses a.out
(ted, ralph, who else?) could be persuaded to use NetBSD-style a.out,
with the byteswapped magic number?  That would make life much simpler
all around.

--Jonathan