Subject: Re: Bi-endian platforms and build.sh
To: Jason R Thorpe <thorpej@wasabisystems.com>
From: Simon Burge <simonb@wasabisystems.com>
List: tech-toolchain
Date: 12/11/2002 15:22:56
Jason R Thorpe wrote:

> On Wed, Dec 11, 2002 at 02:13:18PM +1100, Simon Burge wrote:
> 
>  > +
>  > +# Check that MACHINE_ARCH is set correctly for bi-endian machines.
>  > +if $bi_endian; then
>  > +	case $MACHINE_ARCH in
>  > +		mips)
>  > +			echo "MACHINE_ARCH must be set, or -a must be used, for $MACHINE."
>  > +			echo ""; usage
>  > +			;;
> 
> Why check for "mips" here?  You should just display this message
> unconditionally for bi-endian platforms which do not have a machine_arch
> set.  I think that if a bi-endian platform (really, if you think about
> it, it's "multi-machine_arch platform") doesn't get -a specified, then
> MACHINE_ARCH should default to an empty string... see more below...

I originally had a check for $opt_a, but this doesn't work for the case
where we inherit MACHINE_ARCH from the environment so we want to test
for non-valid values of MACHINE_ARCH.  The idea was to have:

	mips|sh3|sh5)
		blah blah blah

"arm" (that you mention below) does sort of throw a spanner into that
idea though.  How can we better handle this?

>  > +	esac
>  > +
>  > +	# If BUILDID is already set we assume that the user knows what
>  > +	# they are doing and don't override that when an endianness
>  > +	# qualifier.
>  > +	if [ -z "$BUILDID" ]; then
>  > +		case $MACHINE_ARCH in
>  > +			*el)
>  > +				BUILDID=el;;
>  > +			*eb)
>  > +				BUILDID=eb;;
>  > +		esac
>  > +	fi
> 
> ...because this is going to be handled on a per-cpu basis.  I.e. for
> mips and sh3/sh5 this is right, but for ARM it is not, because ARM
> is "arm" and "armeb", and the little-endian one won't have a default
> build ID, in all likelihood (because it is, by far, the common case).
> 
> ...eventually, this will be extended to handle e.g. "mipsn32el", etc.
> as well, so the buildid might be "n32el"... follow where I'm going with
> this? :-)

`Feh'.  Ok, I'll break it out to

	mipseb)	BUILDID=eb;;
	mipsel)	BUILDID=el;;

Simon.
--
Simon Burge                            <simonb@wasabisystems.com>
NetBSD Support and Service:         http://www.wasabisystems.com/