On 06/07/15 13:09, Laurent Vivier wrote:
On Fedora, powerpc64 cross-compiler is part of the distro, not the powerpc32 compiler.
As I'm lazy and powerpc64 cross-compiler is able to generate 32bit binaries, this patch modifies switch-arch to allow to use cross-compiler from a list of architectures instead of only the target architecture.
I've modified only the powerpc32 target, as I'm not able to test the other architectures (and Fedora provides only cross-compiler for powerpc).
Signed-off-by: Laurent Vivier laurent@vivier.eu
config/scripts/switch-arch | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/config/scripts/switch-arch b/config/scripts/switch-arch index d5e2f77..7b8b457 100755 --- a/config/scripts/switch-arch +++ b/config/scripts/switch-arch @@ -99,23 +99,25 @@ archname()
select_prefix() {
- TARGETS="${1}-unknown-linux-gnu- ${1}-linux-gnu- ${1}-linux- ${1}-elf- ${1}-eabi-"
- for target_arch ; do
TARGETS="${target_arch}-unknown-linux-gnu- ${target_arch}-linux-gnu- ${target_arch}-linux- ${target_arch}-elf- ${target_arch}-eabi-"
- if [ x"$CROSS_COMPILE" != "x" ]; then
TARGETS=$CROSS_COMPILE
- fi
if [ x"$CROSS_COMPILE" != "x" ]; then
TARGETS=$CROSS_COMPILE
fi
- for TARGET in $TARGETS
- do
if type ${TARGET}gcc > /dev/null 2>&1
then
for TARGET in $TARGETS
do
if type ${TARGET}gcc > /dev/null 2>&1
then
return
fi
done
doneif [ "$ARCH" = "$HOSTARCH" ]; then return fi
- if [ "$ARCH" = "$HOSTARCH" ]; then
return
- fi
- echo "ERROR: no ${1} cross-compiler found !" 1>&2
- echo "ERROR: no $* cross-compiler found !" 1>&2 exit 1
}
@@ -251,7 +253,7 @@ for ARCH in $arch_list; do ;;
ppc)
select_prefix powerpc
select_prefix powerpc powerpc64 if [ "$unix" = "no" ]; then CFLAGS="-m32 -msoft-float -fno-builtin-bcopy -fno-builtin-log2" AS_FLAGS="-m32"
Thanks for the patch - a brief test here shows that I can build my existing OpenBIOS images without any issues. I'll aim to commit this over the weekend if no-one else objects.
Incidentally I did try applying the same change to SPARC, however that seems not to work:
toke: wrote 850 bytes to bytecode file 'QEMU,cgthree.bin' GEN openbios-sparc32.dict GEN target/include/static-dict.h CC target/arch/sparc32/builtin.o /home/build/src/openbios/openbios-git/openbios-devel/arch/sparc32/builtin.c:1:0: error: -m32 is not supported by this configuration /* tag: openbios forth starter for builtin dictionary for sparc32 ^ make[1]: *** [target/arch/sparc32/builtin.o] Error 1 make[1]: Leaving directory `/home/build/src/openbios/openbios-git/openbios-devel/obj-sparc32' make: *** [build] Error 1 build@kentang:~/src/openbios/openbios-git/openbios-devel$
Is there a way of building a SPARC64 compiler that emits 32-bit code with -m32 in a similar way?
ATB,
Mark.