Using GNU GCC as a cross compiler summary
esunix!sim.dnet!kpoppleton at cs.utah.edu
esunix!sim.dnet!kpoppleton at cs.utah.edu
Mon Oct 8 07:30:00 AEST 1990
Here is the responce I recieved an how to compile GCC as a cross compiler
from SPARC to create 680x0 code. I recieved several requests for this
information. Thanks for the information! It is exactly what we need.
Ken Poppleton
Evans & Sutherland Computer Corp.
Salt Lake City, Utah
***
X-From: wjj at SUN-VALLEY.STANFORD.EDU (Warren Jasper)
[Reposted from gnu.gcc.
Comments on this service to emv at math.lsa.umich.edu (Edward Vielmetti).]
I have received a few requests for making gcc into a cross compiler from
the Sun4 (Host) to a Motorola 680X0 (Target) single-board computer. We
use gcc to generate code that we compile on a SPARCStation to run on our
real time MVME 147 boards (68030 SBC). Here is a step by step procedure
for doing this.
Note: I am trying to finish up my PhD dissertation, and I don't have a lot
of time to help people with this. If you can not get this to work, please
do NOT ask me for help. Sorry, but I have to finish up.
1) You will need to get the latest copies of gcc (1.37.1), gas(1.35) and gld.
2) Make sure you have a working gcc compiler. Ours is in /local/bin.
3) Copy the scripts Makefile.cross and cross-config.gcc into
the main gcc directory. e.g. /usr/local/src/gcc/gcc.1.37.1.
4) type "cross-config.gcc sun4-os4 sun3-os4". This will set up the
correct symbolic links for you.
5) Edit Makefile.cross if you need to change directory paths.
6) Type make -f Makefile.cross
Note: If you get an error making gnulib{2}, don't worry about it.
There is no good way that I know of on how to make a cross compiled
version of this. Best to copy a version made on a Sun3 into
DESTDIR. Unless you use long long, you don't need gnulib2 anyway.
This should make the cross-compiler.
Now for the cross assembler and loader.
7) Copy Makefile.gas into the gas directory and type
make -f Makefile.gas
8) Copy Makefile.gld into the gld directory. Type
make -f Makefile.gld
Warning: There were some problems with earlier versions of gld. I think
that they were fixed. If not, get the latest ld from the g++ distribution.
I think our bug fixes were incorporated, but I'm not sure. If gld does not
cross load, send me mail and I'll see what I can do.
******Vicom Systems note: the linker used is a hacked copy of gld which is
******located in the binutils directory. GAW 6/11/90
9) Copy your version of gcc into /usr/local/lib/sun4. In this directory
should be:
gcc-as gcc-sun3-as
gcc gcc-sun3-gcc
gcc-cc1 gcc-sun3-cc1
gcc-cpp gcc-sun3-cpp
gcc-gnublib gcc-sun3-gnulib <-- you have to make this on a Sun3
gcc-sun3-ld
copy gcc and gld (scripts at the end of this file) into /usr/local/bin.
10) gld does not do dynamic loading. You don't want this anyway for
your target processor. Also, ld does not know how to get to the
C libraries such as libC.a. Don't worry about this either, since
you will be using the ld -r option anyway.
Also, don't forget to include the file math-68881.h if your
SBC has the math chip. This file goes into ./gcc-include.
11) To compile normally, just type
gcc foo.c
To cross compile:
gcc -sun3 -c cross_foo.c
gld -sun3 -r -o cross_foo cross_foo.o
Good Luck !!
Warren Jasper
Stanford University
[[Ed's Notes: Scripts placed in archives. -bdg]]
FTP: Hostname : titan.rice.edu (128.42.1.30)
Directory: sun-source
Filename : cross.script
Filesize : 9525 bytes
Archive Server Address: archive-server at rice.edu
Archive Server Command: send sun-source cross.script
More information about the Comp.sys.sun
mailing list