[OpenBIOS] powerpc64-elf (was: starting)

Blue Swirl blauwirbel at gmail.com
Mon Oct 4 17:21:59 CEST 2010


On Sun, Oct 3, 2010 at 10:36 PM, Andreas Färber <andreas.faerber at web.de> wrote:
> Am 03.10.2010 um 16:07 schrieb Blue Swirl:
>
>> In theory, adding powerpc64-elf support to GCC should be a matter of
>> adding a target Makefile fragment (t-elf64) to gcc/config/rs6000,
>> maybe some other small changes.
>
> Here's what I tried so far based on the 4.4 branch and t-linux64:
>
> diff --git a/gcc/config.gcc b/gcc/config.gcc
> index 6f72224..794655a 100644
> --- a/gcc/config.gcc
> +++ b/gcc/config.gcc
> @@ -1816,6 +1816,14 @@ powerpc-*-elf*)
>        extra_options="${extra_options} rs6000/sysv4.opt"
>        tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas
> rs6000/t-ppccomm"
>        ;;
> +powerpc64-*-elf*)
> +       tm_file="${tm_file} dbxelf.h elfos.h usegas.h svr4.h freebsd-spec.h
> rs6000/sysv4.h"
> +       test x$with_cpu != x || cpu_is_64bit=yes
> +       test x$cpu_is_64bit != xyes || tm_file="${tm_file}
> rs6000/default64.h"
> +       tm_file="rs6000/biarch64.h ${tm_file}"
> +       extra_options="${extra_options} rs6000/sysv4.opt"
> +       tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas
> rs6000/t-ppccomm rs6000/t-elf64"
> +       ;;
>  powerpc-*-eabialtivec*)
>        tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h
> rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h rs6000/eabialtivec.h"
>        extra_options="${extra_options} rs6000/sysv4.opt"
> diff --git a/gcc/config/rs6000/t-elf64 b/gcc/config/rs6000/t-elf64
> new file mode 100644
> index 0000000..b95a291
> --- /dev/null
> +++ b/gcc/config/rs6000/t-elf64
> @@ -0,0 +1,26 @@
> +
> +#rs6000/t-elf64
> +
> +LIB2FUNCS_EXTRA += tramp.S $(srcdir)/config/rs6000/ppc64-fp.c \
> +       $(srcdir)/config/rs6000/darwin-ldouble.c
> +LIB2FUNCS_EXTRA := $(sort $(LIB2FUNCS_EXTRA))
> +
> +TARGET_LIBGCC2_CFLAGS += -mno-minimal-toc
> +
> +# On Debian, Ubuntu and other derivative distributions, the 32bit libraries
> +# are found in /lib32 and /usr/lib32, /lib64 and /usr/lib64 are symlinks to
> +# /lib and /usr/lib, while other distributions install libraries into
> /lib64
> +# and /usr/lib64.  The LSB does not enforce the use of /lib64 and
> /usr/lib64,
> +# it doesn't tell anything about the 32bit libraries on those systems.  Set
> +# MULTILIB_OSDIRNAMES according to what is found on the target.
> +
> +MULTILIB_OPTIONS        = m64/m32 msoft-float
> +MULTILIB_DIRNAMES       = 64 32 nof
> +MULTILIB_EXTRA_OPTS     = fPIC mstrict-align
> +MULTILIB_EXCEPTIONS     = m64/msoft-float
> +MULTILIB_EXCLUSIONS     = m64/!m32/msoft-float
> +MULTILIB_OSDIRNAMES    = ../lib64 ../lib nof
> +MULTILIB_MATCHES        = $(MULTILIB_MATCHES_FLOAT)
> +
> +softfp_wrap_start := '\#ifndef __powerpc64__'
> +softfp_wrap_end := '\#endif'
>
>
> Result:
>
> Configuring in powerpc64-elf/libgcc
> configure: creating cache ./config.cache
> checking for --enable-version-specific-runtime-libs... no
> checking for a BSD-compatible install... /usr/bin/install -c
> checking for gawk... no
> checking for mawk... no
> checking for nawk... no
> checking for awk... awk
> checking build system type... powerpc-apple-darwin9.8.0
> checking host system type... powerpc64-unknown-elf
> checking for powerpc64-elf-ar...
> /Users/andreas/QEMU/OpenBIOS/bin/powerpc64-elf/bin/ar
> checking for powerpc64-elf-lipo... powerpc64-elf-lipo
> checking for powerpc64-elf-nm...
> /Users/andreas/QEMU/OpenBIOS/gcc-ppc64/./gcc/nm
> checking for powerpc64-elf-ranlib...
> /Users/andreas/QEMU/OpenBIOS/bin/powerpc64-elf/bin/ranlib
> checking for powerpc64-elf-strip...
> /Users/andreas/QEMU/OpenBIOS/bin/powerpc64-elf/bin/strip
> checking whether ln -s works... yes
> checking for powerpc64-elf-gcc...
> /Users/andreas/QEMU/OpenBIOS/gcc-ppc64/./gcc/xgcc
> -B/Users/andreas/QEMU/OpenBIOS/gcc-ppc64/./gcc/
> -B/Users/andreas/QEMU/OpenBIOS/bin/powerpc64-elf/bin/
> -B/Users/andreas/QEMU/OpenBIOS/bin/powerpc64-elf/lib/ -isystem
> /Users/andreas/QEMU/OpenBIOS/bin/powerpc64-elf/include -isystem
> /Users/andreas/QEMU/OpenBIOS/bin/powerpc64-elf/sys-include
> checking for suffix of object files... configure: error: in
> `/Users/andreas/QEMU/OpenBIOS/gcc-ppc64/powerpc64-elf/libgcc':
> configure: error: cannot compute suffix of object files: cannot compile
> See `config.log' for more details.
> make[1]: *** [configure-target-libgcc] Error 1
> make: *** [all] Error 2

This is because the assembly has duplicate labels. I think the other
one needs to be changed to a dot prefixed version.

I also needed a patch like this for libgcc:
--- libgcc/config.host.orig     2010-09-09 22:19:33.000000000 +0000
+++ libgcc/config.host  2010-10-03 20:59:13.000000000 +0000
@@ -480,6 +480,8 @@
 powerpc-*-linux* | powerpc64-*-linux*)
        tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-ldbl128 t-softfp"
        ;;
+powerpc64-*-elf*)
+       ;;
 powerpc64-*-gnu*)
        tmake_file="${tmake_file} rs6000/t-ldbl128 t-softfp"
        ;;

My version of config.gcc is like this:
--- gcc/config.gcc.orig 2010-09-24 08:46:36.000000000 +0000
+++ gcc/config.gcc      2010-10-03 21:21:04.000000000 +0000
@@ -2076,6 +2076,11 @@
                tm_file="rs6000/secureplt.h ${tm_file}"
        fi
        ;;
+powerpc64-*-elf*)
+       tm_file="${tm_file} rs6000/biarch64.h dbxelf.h elfos.h
usegas.h svr4.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h
rs6000/default64.h rs6000/elf64.h"
+       extra_options="${extra_options} rs6000/sysv4.opt"
+       tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit
rs6000/t-ppcgas rs6000/t-ppccomm"
+       ;;
 powerpc64-*-gnu*)
        tm_file="${tm_file} elfos.h svr4.h freebsd-spec.h gnu.h
rs6000/sysv4.h rs6000/default64.h rs6000/linux64.h rs6000/gnu.h
glibc-stdint.h"
        extra_options="${extra_options} rs6000/sysv4.opt rs6000/linux64.opt"

This file is referenced above:
--- /dev/null   2010-10-04 17:44:52.508000002 +0000
+++ gcc/config/rs6000/elf64.h   2010-10-03 21:45:01.000000000 +0000
@@ -0,0 +1,6 @@
+#define DOT_SYMBOLS 1
+#undef DEFAULT_ABI
+#define        DEFAULT_ABI ABI_AIX
+
+#undef TARGET_64BIT
+#define        TARGET_64BIT 1

libgcc compilation still fails:

/src/gcc/gcc-4.6-20100925/obj-amd64-powerpc64-elf/./gcc/xgcc
-B/src/gcc/gcc-4.6-20100925/obj-amd64-powerpc64-elf/./gcc/
-B/usr/local/powerpc64-elf/bin/ -B/usr/local/powerpc64-elf/lib/
-isystem /usr/local/powerpc64-elf/include -isystem
/usr/local/powerpc64-elf/sys-include    -g -O2 -O2  -g -O2 -DIN_GCC
-DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wwrite-strings -Wcast-qual
-Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition
-isystem ./include   -g  -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED
-Dinhibit_libc  -I. -I. -I../.././gcc -I../../../libgcc
-I../../../libgcc/. -I../../../libgcc/../gcc
-I../../../libgcc/../include -I../../../libgcc/../libdecnumber/no
-I../../../libgcc/../libdecnumber -DHAVE_CC_TLS  -o _negdi2.o -MT
_negdi2.o -MD -MP -MF _negdi2.dep -DL_negdi2 -c
../../../libgcc/../gcc/libgcc2.c \

/tmp/ccvqatNH.s: Assembler messages:
/tmp/ccvqatNH.s:22: Error: symbol `.__negdi2' is already defined

Looking at the assembler file, this is indeed the case:
        .file   "libgcc2.c"
        .section        ".got","aw"
        .section        ".text"
        .section        .debug_abbrev,"", at progbits
.Ldebug_abbrev0:
        .section        .debug_info,"", at progbits
.Ldebug_info0:
        .section        .debug_line,"", at progbits
.Ldebug_line0:
        .section        ".text"
.Ltext0:
        .align 2
        .globl .__negdi2
        .section        ".opd","aw"
        .align 3
.__negdi2:
        .quad   .__negdi2,.TOC. at tocbase,0
        .previous
        .size   .__negdi2,24
        .type   ..__negdi2, at function
        .globl  ..__negdi2
.__negdi2:



More information about the OpenBIOS mailing list