On Fri, Apr 29, 2011 at 1:26 AM, Nathan Kunkee nkunkee42@hotmail.com wrote:
I built that on opensolaris (so sparc64) with gcc 4.5.2. No cross-compiler needed, although the config script thinks I'm using one.
Ah that will probably be the problem - config/script/switch-arch contains the logic which detects how NATIVE_BITWIDTH_EQUALS_HOST_BITWIDTH and SWAP_ENDIANNESS should be set and adds them to CFLAGS in Makefile.target as appropriate.
OK. I'll start looking to see how to change that for by build environment.
What does 'uname -m' report on your machine? We only check for sun4u/sparc64 or sparc/sparc32.
nathan@valhalla:/export/home/nathan/$ uname -m sun4u nathan@valhalla:/export/home/nathan/$ uname -mpi sun4u sparc sun4u
From SVN, the switch-arch script thinks it has to use a cross-compiler:
nathan@valhalla:/export/home/nathan/openbios-devel$ env LANG=C sh -x ./config/scripts/switch-arch sparc32
- MOLPATH=/export/home/nathan//mol-0.9.71
- [ xsparc32 = x -o sparc32 = -help ]
- test -f utils/dist/debian/rules
- chmod 755 utils/dist/debian/rules
- chmod 755 config/scripts/switch-arch
- chmod 755 config/scripts/reldir
- test x = x
- archname
- head VERSION
VERSION=1.0
- echo Configuring OpenBIOS on sparc64 for sparc32
Configuring OpenBIOS on sparc64 for sparc32
- target_list=
- target_list= builtin-sparc32 unix-sparc32
- arch_list=
- echo builtin-sparc32
- sed s/.*-//g
arch=sparc32
- test -f config/examples/sparc32_config.xml
- grep -q sparc32
- echo
- arch_list= sparc32
- echo unix-sparc32
- sed s/.*-//g
arch=sparc32
- test -f config/examples/sparc32_config.xml
- grep -q sparc32
- echo sparc32
- unix=no
- builtin=no
- plain=no
- mol=no
- briq=no
- pearpc=no
- qemu=no
- xbox=no
- cross=no
- :
- builtin=yes
- :
- [ sparc32 != sparc64 ]
- continue
- BASEARCH=sparc32
- select_prefix sparc
ERROR: no sparc cross-compiler found !
I got around that by adding the suffix my build of gcc is using:
--- config/scripts/switch-arch Thu Apr 28 17:18:40 2011 +++ config/scripts/switch-arch-works Sat Apr 23 20:21:29 2011 @@ -97,7 +101,7 @@
select_prefix() { - for TARGET in ${1}-linux-gnu- ${1}-linux- ${1}-elf- ${1}-eabi- + for TARGET in ${1}-linux-gnu- ${1}-linux- ${1}-elf- ${1}-eabi- ${1}-sun-solaris2.11- do if type ${TARGET}gcc > /dev/null 2>&1 then
I'm not sure if that is the best way to get it to use the native compiler. I can't think of a reason my sparc64 build tools couldn't build the sparc32 image.
This actually happens with OpenBSD/sparc64, the compiler can't produce 32 bit binaries at all: $ gcc -v Reading specs from /usr/lib/gcc-lib/sparc64-unknown-openbsd4.8/4.2.1/specs Target: sparc64-unknown-openbsd4.8 Configured with: OpenBSD/sparc64 system compiler Thread model: posix gcc version 4.2.1 20070719 $ touch empty.c $ gcc -m32 -c empty.c empty.c:1: error: -m32 is not supported by this configuration
But I think that this is not so common setup. So we should add logic for trying -m32 or -m64 if the host has a compatible CPU except for word size, or a cross compiler for wrong word size is found.