🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #52766

Re: cross compiling gcc-2.1 host=sparc, target=sun3/m68k

#52766
From: Andrew McRae
Date: Thu, 04 Jun 1992 04:46
78 lines
4237 bytes
There have been a number of questions about cross-compiling, with
the most common case being host=sparc target=sun3. We have had
this configuration operational for a long time, and I thought I
would give a brief rundown on the way I put it together.

Building a cross compiler is easy, and as expected all you do
is run configure with target=sun3 host=sparc. You then have a
gcc which can be installed as gcc20 (or cc68 or whatever) in your
bin directory; cc1 & cc1plus can be installed in $LIBDIR/gcc-lib/sun3/2.1;
Make sure you are using gcc-2.1, which knows a bit more about cross-compiling
than gcc-2.0 (i.e doesn't try to build libgcc for the target processor).

Next thing is you get gas-1.38 and make a68 (which makes an as which
groks the 68k code generated by the compiler). You install this as
in $LIBDIR/gcc-lib/sun3/2.1/as.

The trickiest bit is the loader. I am not aware if the binutils-1.94
stuff works OK, but the loader we run here was obtained from
sprite.berkeley.edu, under cross-ld (or a similar name).
This is the GNU ld which has been
modified to cross-ld different machine types (it has support for
differing endian machines, but I don't know how complete it is).
Install this ld as $LIBDIR/gcc-lib/sun3/2.1/ld. What we do is
symbolically link both as and ld in $LIBDIR/gcc-lib/sun3/2.1 to
bin programs /usr/local/bin/as20 and /usr/local/bin/ld20 so that
you can run these programs directly.

You can now compile, assemble and link sun3 binaries on sparc, but
you may not have any libraries or run-time support code to link
with. Well, one suggestion is to copy over the Sun 3 libraries and
put them somewhere like $LIBDIR/gcc-lib/sun3/2.1/lib and set
STANDARD_SEARCH_DIRS in cross-ld to the right directory. I guess
you can do this *if* you already have a Sun 3 (i.e I am not advocating
unlicensed copying of Sun's libraries). We haven't
done this, as we have our own set of libraries (we are not really
targeting sun3, but an embedded 680x0 environment). You may also
have to write library stubs for some of the support routines (e.g
floating point if you don't have a 68881).

One interesting thing to try would be to build GNU libc 1.03 with
this environment and see if you could get a complete cross
compilation system - I haven't had the time to try this.

Another tip is look at the BSD Net/2 release under the hp300
and other lib source, as there are lots of library routines
that can use therein.

This set-up works just fine for us, and even lets you cross-compile C++.

The README of cross-ld follows:

>This linker is the Gnu linker with some modifications that allow it
>to be used as a cross-linker between different machine types.
>
>You can change the target machine by defining `TARGET_MACHINE' in the
>Makefile.  If you do not define a TARGET_MACHINE it will default to
>the same as the host machine.
>
>It has been tested for the following hosts and targets:
>
>Host            Target          OS
>sun4            sun3,sun4       sunOS, sprite
>sun3            sun3,sun4       sunOS, sprite
>ds3100          sun3,sun4       sprite
>
>If you have any problems or questions, please send email to
>
>        rab@sprite.Berkeley.EDU
>
>If you successfully use this linker on systems other than those listed
>above, please let me know.

Cheers,

Andrew McRae			inet:	andrew@megadata.mega.oz.au
Megadata Pty Ltd,		uucp:	..!uunet!megadata.mega.oz.au!andrew
North Ryde  2113		Phone:	+61 2 805 0899
NSW    AUSTRALIA		Fax:	+61 2 887 4847
Technical Details
Message-ID: <1992Jun4.044603.28630@megadata.mega.oz.au>
Path: arc1-ca.pugleaf.net!sparky!uunet!europa.asd.contel.com!darwin.sura.net!mips!mips!munnari.oz.au!metro!dmssyd.syd.dms.CSIRO.AU!megadata!andrew
References: <352@conan.UUCP>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,44f83b104d1108d4
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1992-06-03 20:54:38 PST
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!sparky!uunet!europa.asd.contel.com!darwin.sura.net!mips!mips!munnari.oz.au!metro!dmssyd.syd.dms.CSIRO.AU!megadata!andrew
From: andrew@megadata.mega.oz.au (Andrew McRae)
Subject: Re: cross compiling gcc-2.1 host=sparc, target=sun3/m68k
Message-ID: <1992Jun4.044603.28630@megadata.mega.oz.au>
Originator: andrew@noah
Sender: news@megadata.mega.oz.au
Organization: Megadata P/L, North Ryde, Sydney, Aust.
References: <352@conan.UUCP>
Date: Thu, 4 Jun 1992 04:46:03 GMT
Lines: 78