[OpenBIOS] [RFC 1/2] switch-arch: Prepare ppc64 support

Andreas Färber andreas.faerber at web.de
Sun Oct 3 15:20:36 CEST 2010


Detect ppc64 as Big Endian and 64-bit.
Reuse arch/ppc/ wherever possible.

Signed-off-by: Andreas Färber <andreas.faerber at web.de>
---
 The -m64 is not yet working in my gcc configuration. Using -mcpu=powerpc64 instead, the C files compiled
 but despite tweaking the linker script and adding -melf64ppc to LD there was a mismatch:
 
 powerpc-elf-ld: powerpc:common64 architecture of input file `target/arch/ppc/qemu/start.o' is incompatible with powerpc:common output
 [...]
 
 config/scripts/switch-arch |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/config/scripts/switch-arch b/config/scripts/switch-arch
index 60782e9..027632d 100755
--- a/config/scripts/switch-arch
+++ b/config/scripts/switch-arch
@@ -38,6 +38,7 @@ crosscflags()
     fi
 
     if test "$target" = "powerpc" -o "$target" = "ppc" \
+        -o "$target" = "powerpc64" -o "$target" = "ppc64" \
         -o "$target" = "mips" -o "$target" = "s390" \
         -o "$target" = "sparc32" -o "$target" = "sparc64" \
         -o "$target" = "m68k" -o "$target" = "armv4b"; then
@@ -49,6 +50,7 @@ crosscflags()
 # target long bits test
     if test "$target" = "sparc64" -o "$target" = "ia64" \
         -o "$target" = "amd64"  -o "$target" = "x86_64" \
+        -o "$target" = "powerpc64" -o "$target" = "ppc64" \
         -o "$target" = "alpha"; then
         targetlongbits="64"
     else
@@ -139,6 +141,12 @@ for RULES_ARCH in $*; do
         AS_FLAGS=
         ;;
 
+        ppc64)
+        select_prefix powerpc
+        CFLAGS="-Wa,-a64 -m64 -msoft-float -fno-builtin-bcopy -fno-builtin-log2"
+        AS_FLAGS="-Wa,-a64"
+        ;;
+
         sparc32)
         select_prefix sparc
         CFLAGS="-Wa,-xarch=v8 -Wa,-32 -m32 -mcpu=supersparc -fno-builtin"
@@ -192,9 +200,15 @@ for RULES_ARCH in $*; do
     mkdir -p $OBJDIR/host/include
     mkdir -p $OBJDIR/host/kernel
     mkdir -p $OBJDIR/forth
-    ln -s ../../../include/arch/$ARCH $OBJDIR/target/include/asm
+
+    INCLUDEARCH=$ARCH
+    if test "$ARCH" = "ppc64"; then
+        INCLUDEARCH=ppc
+    fi
+    ln -s ../../../include/arch/$INCLUDEARCH $OBJDIR/target/include/asm
     #compile the host binary with target settings instead
     #ln -s ../../../include/arch/$HOSTARCH $OBJDIR/host/include/asm
+
     echo "ok."
 
     cd $OBJDIR
-- 
1.7.3




More information about the OpenBIOS mailing list