Subject: Re: cross-compiling on i386 for m68k
To: Thomas J. Trebisky <>
From: Dale Rahn <>
List: m68k
Date: 11/15/1994 13:27:27
> 'Tom Trebisky'
> Hello,
> I have pretty much finished up getting NetBSD 1.0 installed on a
> i386 box I have recently acquired. Now I am getting down to
> business with what I really want to do, namely use this
> as a development system for a m68k port.  The target system is
> a motorola vm04 (a versabus monster, the heart of which is
> a 68030 running at 20Mhz, but I spare you all the details).
> At any rate, I am posting to ask for hints and help in getting
> a cross-development platform set up, expecting and hoping that
> some of you have covered this ground already and can help me and
> save me a lot of time and effort.  Here is what I see as the
> task before me, please correct me where you see me going astray.
> 1) Buid gcc as a cross compiler.  Apparently I have 2.4.5 on my
> system, and I can go into the source directory and config this as
> a cross-compiler.  But I noticed yesterday in the 2.6.1 announcement
> that NetBSD-m68k is a newly supported configuration, perhaps this
> is the way to go.  Either way, I expect this step to be easy.
> 2) Build the binutils for cross-compile use.  From prior experience
> I expect gas to be pretty easy.  gnu-ld may or may not be easy
> depending on progress made with the binutils since my experience
> with them a year or so ago when I was cross-compiling from a sparc.
I just used the NetBSD utilities in the NetBSD src, 
all but ar seems to not have too many problems(see below).

> Once I get to this point I should be off to the races, ... at least for now,
> any helpful comments or discussion will be appreciated!

I attempted to get this to work with host NetBSD-i386 and target
NetBSD-amiga. I had to make some changes to ld to make it produce correct
relocations.  I did all of this back in about May 94, some of the stuff
may have changed since then to fix stuff.

I was able to create objects and executables with what I had but I
did not have time to go about fixing ar to produce the correct libraries.

This is the list of things I did to get it almost working.
(from the top of my head).
	compilation (cc):
		add -nostdinc 
		add -idirafter /usr/m68kinclude
		add -b m68k
		to make:
		CC=/usr/bin/cc -nostdinc -idirafter /usr/m68kinclude -b m68k
		put gcc cross executables in /usr/libexec/m68k/2.4.5 (???)
		the swapin/swapout routines in ld/m68k/md.c
		did not seem to work correctly with i386 host.
		I rewrote them with structures of opposite order with
		correct padding.

Some directory build executables and then run them to generate files which
are used in the compilation. There is no distinction between a HOST_CC
and TARGET_CC. All just use CC.

Unfortunately, I stopped working on the problem once NetBSD-amiga 
got stable enough to nfs mount the source and then I just compiled on
the amiga. I then removed all of the changes with a later snapshot upgrade.

Dale Rahn