Warner Losh wrote:
> 
> OK.  Per many requests from the community, I've committed my cross
> compilation changes.

Thanks.

> To build you just say 
>       make buildworld TARGET=hpcmips TARGET_ARCH=mipsel
> or
>       make buildworld TARGET=m68k TARGET_ARCH=m68k
> Right now you must specify both TARGET and TARGET_ARCH.  You will want
> to do this with a clean /usr/obj.  Please send comments to me.
> 
> The one time I tried it, I was unable to build alpha binaries on i386
> due to bugs in the gnu tools.  That was before egcs, however.
> Building i386 binaries on the alpha may work, but I don't have access
> to my Alpha lately to try.

binutils on i386 won't build 64-bit stuff due to bit shift code that
wants to shift more than 32 bits. At runtime the code strikes asserts
due to BFD64 not being defined at compile time. The sources hint at
using "long long" if using gcc, but it appears to require some hacking.

There is a Cygnus doc for configuring gcc 2.8.1 as a cross compiler which
says that building 32-bit code on a 64-bit machine doesn't quite
work. egcs might work though.

> This is a work in progress.  Since I've been using this on MIPS, whose
> kernel includes aren't yet complete enough for make world, I don't
> know if it will work completely or not.  The goal is to have a
> buildworld complete and then do an installworld in the native
> environment, or with a DESTDIR=xxxx to put the files in, say, an NFS
> mounted root partition.
> 
> I did try to make this work with by redefining BINFORMAT, but I found
> too many problems with doing this because cc1 isn't dependent on
> BINFORMAT.  It was easier to build explicit cross tools to make this
> happen.

I was aiming to build a set of cross tools as (an optional) part of the
i386 build like binutils. When building the cross-compiler, defining
CROSS_COMPILE and setting the execution path will avoid the native
compiler. Then in the mk files, set CC etc to be the cross compiler
based on the TARGET definition. The current install directory for the
extra gas versions should change to be the execution path that egcs is
configured for. I agree that BINFORMAT is inadequate. Since ld can be
shared between target formats, I guess a link to the host ld is all
that is required.

We can't rely on the setting of MACHINE_ARCH to twiddle the different
egcs build because that is a host setting, not a target one.  We need
to set aside different directories and build the egcs code as many times
as the targets we want (like we do for gas). I've been using
/usr/libexec/${TARGET} where TARGET is a name quite close to that which
binutils knows. Using the environment variable "TARGET" is a little
problematic for me because it is easily confused (at least by my
brain 8-) with .TARGET.

> I've been using the cross binaries for a variety of purposes, so I
> have good confidence in at least that part of the commit.

-- 
John Birrell - [EMAIL PROTECTED]; [EMAIL PROTECTED] http://www.cimlogic.com.au/
CIMlogic Pty Ltd, GPO Box 117A, Melbourne Vic 3001, Australia +61 418 353 137


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to