Bulding a virgin egcs cross-compiler

Kai Ruottu karuottu@freenet.hut.fi
Sun Sep 27 17:13:00 GMT 1998

 Hi John, you wrote:

> Last winter, I built a gcc- based cross compiler with newlib for 
> m68k-elf under Linux.  Other than having to get patches to allow elf 
> with m68k, it all went fairly smoothly (I used the separate-tree 
> process, not the single-tree).

 Are the patches somewhere available?
> Now I'm trying to build an egcs-1.1a based cross compiler for the same 
> target, under HPUX-10.20.  The headers for m68k-elf are somewhat 
> experimental, but everything else is stock.  I've run into a few 
> oddities.

 You mean the 'gcc/config/m68k/m68kelf.h', 't-m68kelf' etc. config files
with the 'headers' ?

> First, egcs requires certain system headers during the build.  I copied 
> those over from newlib, but it strikes me odd that egcs needed them when 
> gcc-2.7.x didn't.

 Building 'libgcc.a', 'libobjc.a' and 'libg2c.a' would need some target
headers, not 'system' = 'native' headers... This is a 'chicken-and-egg'
problem and the easy way is to just copy the 'newlib/libc/include' to
the aimed install directory (e.g. '/usr/local/m68k-elf/include') where
the cross-compiler to be built will find them...  Perhaps there is some
'clean' way to solve this, but the 'quick-and-dirty' is usually the most
easy and you too seem to think this way...

> Then, when it got to libf2c (which I don't even want, but can't figure 
> out how to get rid of), it decided that it needed crt0.o.

 This is the last job to do when building egcs-1.1a...

 When the job is over and everything you need is ready, why to worry
about things you don't even need?  I would prefer to take a beer and
just be happy...  And forget the damned libg2c.a...

 Your real problems lay in how well you managed to fix the 'gcc/config/m68k'
config files... I took mine from the Cygnus gcc-2.7.2-970404 (Cygwin b18)
distribution and had to fix some definitions there... Ok, I used the same
fixing logic for 'i386-elf' target, and could then 'simulate' the code
under Linux with ibcs2, using a SVR4-glue library (using the available
'newlib/libc/sys/sysvi386' routines as the base for my 'libsvr4.a')... Runs
just fine...  I have no simulator and no HW for the 'm68k-elf', just wanted
to see that these two 'unsupported' targets (in egcs-1.1) could be done...

 It could be useful to compare our 'fixed' config files for 'm68k-elf'...

 Regards, Kai
To get command help for the crossgcc list, including help
on adding/removing yourself to/from the list, send e-mail
to majordomo@cygnus.com with the text 'help' (without the
quotes) in the body of the message.

More information about the crossgcc mailing list