Subject: re: crosscompilers
To: Paolo Di Francesco <paipai@tin.it>
From: matthew green <mrg@eterna.com.au>
List: port-sparc
Date: 07/19/1999 20:32:53
Hi, has anyone tried to build the crosscompiler host=1386,
target=sparc64 ?
this should work if you enable this line in cross/binutils/Makefile:
#ENABLE_TARGETS+= sparc64-elf
and disable this line in cross/sparc64-netbsd/Makefile:
BROKEN= kills sparc-netbsdelf support
note the caveat ... and note that the 64bit compiler is not
entirely stable. (see port-sparc archives for messages from
eeh@ for details on this).
and you might find this `cross.sh' useful. it contains
documentation for it's use in a cross compile environment.
#! /bin/sh
#
# $eterna: cross.sh,v 1.2 1999/07/19 10:30:06 mrg Exp $
#
# Copyright (c) 1999 Matthew R. Green
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# This file has support for:
# WHICH: LINK NAME:
# NetBSD/alpha *alpha*
# NetBSD/i386 ELF *i386elf*
# NetBSD/macppc *macppc*
# NetBSD/ofppc *ofppc*
# NetBSD/bebox *bebox*
# NetBSD/powerpc *powerpc*
# NetBSD/sparc64 (64 bit) *sparc64*
# NetBSD/sparc64 (32 bit) *sparcelfv9*
# NetBSD/sparc ELF *sparcelf*
# other non NetBSD stuff...
LOCAL=/usr/pkg
BINDIR=$LOCAL/cross/bin
none=0
# set up some defaults
case $0 in
*alpha*) # NetBSD/alpha (ELF)
MACHINE_ARCH=alpha export MACHINE_ARCH
MACHINE=alpha export MACHINE
WHICH=alpha-netbsd
;;
*i386elf*) # NetBSD/i386 ELF
MACHINE_ARCH=i386 export MACHINE_ARCH
MACHINE=i386 export MACHINE
WHICH=i386-netbsdelf
;;
*macppc*) # NetBSD/ppc (ELF)
MACHINE_ARCH=powerpc export MACHINE_ARCH
MACHINE=macppc
WHICH=powerpc-netbsd
;;
*ofppc*) # NetBSD/ofppc (ELF)
MACHINE_ARCH=powerpc export MACHINE_ARCH
MACHINE=ofppc
WHICH=powerpc-netbsd
;;
*bebox*) # NetBSD/bebox (ELF)
MACHINE_ARCH=powerpc export MACHINE_ARCH
MACHINE=bebox
WHICH=powerpc-netbsd
;;
*powerpc*) # NetBSD/powerpc (ELF)
MACHINE_ARCH=powerpc export MACHINE_ARCH
MACHINE=powerpc
WHICH=powerpc-netbsd
;;
*sparc64*) # NetBSD/sparc64 64-bit ELF
MACHINE_ARCH=sparc64 export MACHINE_ARCH
MACHINE=sparc64 export MACHINE
WHICH=sparc64-netbsd
;;
*sparcelfv9*) # NetBSD/sparc64 32-bit ELF
MACHINE_ARCH=sparc export MACHINE_ARCH
MACHINE=sparc64 export MACHINE
WHICH=sparc-netbsdelf
;;
*sparcelf*) # NetBSD/sparc 32-bit ELF
MACHINE_ARCH=sparc export MACHINE_ARCH
MACHINE=sparc export MACHINE
WHICH=sparc-netbsdelf
;;
*i386-linux*) # Linux/i386 ELF?
WHICH=i386-linux
;;
*i386-linuxglibc1*) # NetBSD/i386 ELF
WHICH=i386-linuxglibc1
;;
*i386-msdosdjgpp*) # DOS
WHICH=i386-msdosdjgpp
;;
*) # bzzt!
none=1
;;
esac
while test $# -gt 0
do
case "$1" in
-n)
WHICH=$2
shift
shift
none=0
;;
-m)
MACHINE=$2
shift
shift
none=0
;;
-a)
MACHINE_ARCH=$2
shift
shift
none=0
;;
-h)
cat <<__eof_usage__
Usage: cross.sh -a machine_arch -m machine -n which
Choose from the following list for values of which:
NetBSD/alpha - netbsd-alpha
NetBSD/i386 ELF - i386-netbsdelf
NetBSD/powerpc - netbsd-powerpc
NetBSD/sparc{,64} ELF - netbsd-sparcelf
NetBSD/sparc64 (64 bit) - netbsd-sparc64
Choose from the following list for values of machine_arch:
NetBSD/alpha - alpha
NetBSD/i386 ELF - i386
NetBSD/macppc - macppc
NetBSD/ofppc - ofppc
NetBSD/bebox - bebox
NetBSD/powerpc - powerpc
NetBSD/sparc{,64} (32 bit) - sparc
NetBSD/sparc64 (64 bit) - sparc64
Choose from the following list for values of machine:
NetBSD/alpha - alpha
NetBSD/i386 ELF - i386
NetBSD/powerpc - powerpc
NetBSD/sparc ELF - sparc
NetBSD/sparc64 - sparc64
Or read the script and make a link to it for your machine.
__eof_usage__
exit 1
;;
*)
break
;;
esac
done
if [ $none = 1 ]; then
echo "$0: no such support yet. fix me."
exit 1
fi
PATH=$BINDIR:$LOCAL/cross/$WHICH/bin:$PATH:$LOCAL/cross/bin export PATH
GCC_EXEC_PREFIX=$WHICH
AR=$BINDIR/$WHICH-ar export AR
AS=$BINDIR/$WHICH-as export AS
CC=$BINDIR/$WHICH-gcc export CC
CPP=`$CC -print-prog-name=cpp` export CPP
CXX=$BINDIR/$WHICH-c++ export CXX
FC=$BINDIR/$WHICH-f77 export FC
LD=$BINDIR/$WHICH-ld export LD
NM=$BINDIR/$WHICH-nm export NM
RANLIB=$BINDIR/$WHICH-ranlib export RANLIB
SIZE=$BINDIR/$WHICH-size export SIZE
ADDR2LINE=$BINDIR/$WHICH-addr2line export ADDR2LINE
GASP=$BINDIR/$WHICH-gasp export GASP
OBJCOPY=$BINDIR/$WHICH-objcopy export OBJCOPY
OBJDUMP=$BINDIR/$WHICH-objdump export OBJDUMP
STRINGS=$BINDIR/$WHICH-strings export STRINGS
STRIP=$BINDIR/$WHICH-strip export STRIP
if [ $# -eq 0 ]; then
exec ${SHELL-/bin/sh}
else
exec "$@"
fi