Subject: Re: Cross compiling from i386 to m68k
To: Eric Delcamp <edelcamp@easynet.fr>
From: Jeremy Cooper <jeremy@broder.com>
List: tech-toolchain
Date: 11/13/1997 08:56:27
On Thu, 13 Nov 1997, Eric Delcamp wrote to current-users:

> I want to cross compile from a i386 box to amiga/m68k.
> My first goal is the compiler himself.

This is currently very difficult.  The biggest obstacle to making the
native GCC into a cross compiler is the way it uses header files in
/usr/include/machine to obtain target-specific settings.  This creates a
problem because ``machine'' is populated with header files
for the _host_ architecture and not the target.

A workaround is possible by creating a directory named 'target' during the
compiler build process.  Then a shell script populates this directory with
the target's machine files (/usr/src/sys/arch/TARGET/include).  Each of
these header files is then rewritten by sed or awk such that any line
which reads

  #include <machine/..>

becomes

  #include <target/..>

Then every line of code in the compiler which uses #include <machine/..>
to obtain target-specific information is rewritten to use
#include <target/.. > as well.

> [ somehow managed to produce a cross-compiler! ]
> cc produce correct m68k assembler code.
> as produce cat.o
> file cat.o -> PDP-11 executable - version 8
> instead of NetBSD/m68k object file not stripped.

I was the one who attempted to make GAS easy to configure as a
cross-assembler.  It could be that there is a memory-endian problem in the
code.  Can you post to me (privately) the first two lines of a hexdump of
the cat.o file?

-J