Return to BSD News archive
Path: sserve!manuel!munnari.oz.au!spool.mu.edu!uunet!mcsun!uknet!axion!rtf.bt.co.uk!duplain
From: duplain@rtf.bt.co.uk (Andy Duplain)
Newsgroups: comp.unix.bsd
Subject: Re: Cross compiling for 386bsd using gcc 2.2.2
Message-ID: <1992Jul1.091811.10113@rtf.bt.co.uk>
Date: 1 Jul 92 09:18:11 GMT
Article-I.D.: rtf.1992Jul1.091811.10113
References: <1992Jun29.101909.25381@rtf.bt.co.uk>
Organization: BT Customer Systems, Brighton, UK
Lines: 84
In article <1992Jun29.101909.25381@rtf.bt.co.uk> duplain@rtf.bt.co.uk (Andy Duplain) writes:
> I would like to be able to set-up a cross development environment
> on one of our Sparcs to allow 386bsd executables to be spat out
> at an alarming rate :-) Can anyone post, email or otherwise
> inform me of the diffs to vanilla gcc 2.2.2 to allow a cross
> compiler to be built ?
It wasn't as difficult as I thought. I now have gcc 2.2.2, gas
1.92.3 and gld 1.94 working in the cross-development environment.
I used diffs from tesla.ee.cornell.edu (actually I got them from
doc.ic.ac.uk) to patch binutils 1.94 and gcc 2.2.2.
I had a problem with gld in that I asked it to search only in
"/home/nimrod/386bsd/xdev-lib" for library files, which confused
it's command file interpreter as it mistook the hyphen for an
minus sign... and tried to evaluate the pathname. So I had to
drop the hyphens in pathnames.
Getting libgcc to build needed a hack to libgcc.c to include the
BSD stddef.h file prior to gstddef.h file (BSD stddef.h needed to
be specified with an absolute pathname).
The specs files was totally inadequate, and I was unable to edit
the specs files after building (gcc complained of syntax
errors!!), so I hacked gcc.c to create the following default specs:
*asm:
%{pipe:--} %{v:-v} -f
*asm_final:
*cpp:
*cc1:
*cc1plus:
*endfile:
*link:
%{!nostdlib:%{!e*:-e start}} %{v:-v} -dc -dp
*lib:
%{g*:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}
*startfile:
%{pg:/home/nimrod/386bsd/xdevlib/gcrt0.o} \ (all on one line really -- ed)
%{!pg:%{p:/home/nimrod/386bsd/xdevlib/moncrt0.o} \
%{!p:/home/nimrod/386bsd/xdevlib/crt0.o}}
*switches_need_spaces:
*signed_char:
%{funsigned-char:-D__CHAR_UNSIGNED__}
*predefines:
-Dunix -Di386 -Di386b -D__NET2BSD__
*cross_compile:
1
This specs file invokes gas with `-f', ld with `-e start -dc -dp'
and specifies the absolute paths to the crt0.o files (note also
the name change from mcrt0.o to moncrt0.o... hope that's right ?).
I also hacked the link_command_spec in gcc.c (line 554ish) to
remove the %D spec, as the linker knows where the libraries are,
and it's told explicitly where the startfiles, but it means that
libgcc.a has to reside with the other system libraries (in my
case "/home/nimrod/386bsd/xdevlib" rather than ".../xdevlib/
gcc-lib/i386-bsd/2.2.2.".
Thanks to all those who directed me in the right direction
(specifically dxper@dtek.chalmers.se and eoahmad@ntu.ac.sg).
--
Andy Duplain, BT Customer Systems, Brighton, UK. duplain@rtf.bt.co.uk
#define DISCLAIMER My views and opinions are my own, and not my company's