This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Crosstool 0.43 for the ppc8540 (e500)


Hi Alan,

gcc should be configured and built with a target of
"powerpc-linux-gnuspe" for e500 CPUs.

>From my understanding gcc-4.1.x has known problems for e500 so it is
probably best to build the toolchain using gcc-4.0.x,

Best regards,

Steve

On Wed, 2007-05-02 at 15:29 +0100, Alan Dennis wrote:
> As requested in the crosstool howto, I'm posting my experience of using crosstool for an unsupported CPU type.
> 
> I've managed to get the current (0.43) crosstool to compile a powerPC 8540 (e500) target toolchain using Glibc 2.3.6 and GCC 4.1.1. To do this I used this patch:
> 
> Index: powerpc-8540-gcc-4.1.1-glibc-2.3.6.dat
> ===================================================================
> --- powerpc-8540-gcc-4.1.1-glibc-2.3.6.dat
> +++ powerpc-8540-gcc-4.1.1-glibc-2.3.6.dat
> @@ -0,0 +1,9 @@
> +TARGET=powerpc-8540-linux-gnu
> +TARGET_CFLAGS="-O -mcpu=8540"
> +GCC_EXTRA_CONFIG="--with-cpu=8540 --with-float=soft --enable-cxx-flags=-mcpu=8540 --enable-cxx-flags=-msoft-float --disable-multilib"
> +GLIBC_EXTRA_CONFIG="$GLIBC_EXTRA_CONFIG --without-fp"
> +BINUTILS_DIR=binutils-2.16.1
> +GCC_DIR=gcc-4.1.1
> +GLIBC_DIR=glibc-2.3.6
> +LINUX_SANITIZED_HEADER_DIR=linux-libc-headers-2.6.12.0
> +GLIBCTHREADS_FILENAME=glibc-linuxthreads-2.3.6
> Index: patches/glibc-2.3.6/glibc-2.3.6-allow-gcc-4.1-powerpc32-initfini.s.patch
> ===================================================================
> --- patches/glibc-2.3.6/glibc-2.3.6-allow-gcc-4.1-powerpc32-initfini.s.patch
> +++ patches/glibc-2.3.6/glibc-2.3.6-allow-gcc-4.1-powerpc32-initfini.s.patch
> @@ -0,0 +1,28 @@
> +fixes
> +
> +{BUILD_DIR}/build-glibc/csu/crtn.o: In function "dummy":
> +{BUILD_DIR}/build-glibc/csu/crtn.S:14: multiple definition of "dummy"
> +{BUILD_DIR}/build-glibc/csu/crti.o:{BUILD_DIR}/build-glibc/csu/crti.S:33: first defined here
> +{BUILD_DIR}/build-glibc/csu/crtn.o: In function "_init":
> +{BUILD_DIR}/build-glibc/csu/crtn.S:30: multiple definition of "_init"
> +{BUILD_DIR}/build-glibc/csu/crti.o:{BUILD_DIR}/build-glibc/csu/crti.S:65: first defined here
> +{BUILD_DIR}/build-glibc/csu/crtn.o: In function "_fini":
> +{BUILD_DIR}/build-glibc/csu/crtn.S:25: multiple definition of "_fini"
> +{BUILD_DIR}/build-glibc/csu/crti.o:{BUILD_DIR}/build-glibc/csu/crti.S:38: first defined here
> +{BUILD_DIR}/build-glibc/csu/crti.o: In function "_fini":
> +{BUILD_DIR}/build-glibc/csu/crti.S:(.init+0x20): undefined reference to "i_am_not_a_leaf"
> +{BUILD_DIR}/build-glibc/csu/crtn.o: In function "_fini":
> +{BUILD_DIR}/build-glibc/csu/crtn.S:(.init+0x40): undefined reference to "i_am_not_a_leaf"
> +{BUILD_DIR}/build-glibc/csu/crtn.S:(.init+0x44): undefined reference to "i_am_not_a_leaf"
> +
> +--- glibc-2.3.6/sysdeps/powerpc/powerpc32/Makefile.org  2006-08-21 19:03:01.000000000 -0700
> ++++ glibc-2.3.6/sysdeps/powerpc/powerpc32/Makefile      2006-08-21 19:03:19.000000000 -0700
> +@@ -21,7 +21,7 @@
> + ifneq ($(elf),no)
> + # The initfini generation code doesn't work in the presence of -fPIC, so
> + # we use -fpic instead which is much better.
> +-CFLAGS-initfini.s = -g0 -fpic -O1
> ++CFLAGS-initfini.s = -g0 -fpic -O1 $(fno-unit-at-a-time)
> +
> + # There is no benefit to using sdata for these objects, and the user
> + # of the library should be able to control what goes into sdata.
> Index: patches/glibc-linuxthreads-2.3.6/glibc-2.3.6-allow-gcc-4.1-powerpc32-initfini.s.patch
> ===================================================================
> --- patches/glibc-linuxthreads-2.3.6/glibc-2.3.6-allow-gcc-4.1-powerpc32-initfini.s.patch
> +++ patches/glibc-linuxthreads-2.3.6/glibc-2.3.6-allow-gcc-4.1-powerpc32-initfini.s.patch
> @@ -0,0 +1,28 @@
> +fixes
> +
> +{BUILD_DIR}/build-glibc/linuxthreads/crtn.o: In function "dummy":
> +{BUILD_DIR}/build-glibc/linuxthreads/crtn.S:14: multiple definition of "dummy"
> +{BUILD_DIR}/build-glibc/linuxthreads/crti.o:{BUILD_DIR}/build-glibc/linuxthreads/crti.S:33: first defined here
> +{BUILD_DIR}/build-glibc/linuxthreads/crtn.o: In function "_fini":
> +{BUILD_DIR}/build-glibc/linuxthreads/crtn.S:30: multiple definition of "_fini"
> +{BUILD_DIR}/build-glibc/linuxthreads/crti.o:{BUILD_DIR}/build-glibc/linuxthreads/crti.S:65: first defined here
> +{BUILD_DIR}/build-glibc/linuxthreads/crtn.o: In function "_init":
> +{BUILD_DIR}/build-glibc/linuxthreads/crtn.S:23: multiple definition of "_init"
> +{BUILD_DIR}/build-glibc/linuxthreads/crti.o:{BUILD_DIR}/build-glibc/linuxthreads/crti.S:37: first defined here
> +{BUILD_DIR}/build-glibc/linuxthreads/crti.o: In function "_fini":
> +{BUILD_DIR}/build-glibc/linuxthreads/crti.S:(.text+0x70): undefined reference to "i_am_not_a_leaf"
> +{BUILD_DIR}/build-glibc/linuxthreads/crtn.o: In function "_fini":
> +{BUILD_DIR}/build-glibc/linuxthreads/crtn.S:(.text+0x38): undefined reference to "i_am_not_a_leaf"
> +collect2: ld returned 1 exit status
> +
> +--- glibc-2.3.6/linuxthreads/sysdeps/powerpc/Makefile.org      2003-02-17 20:33:17.000000000 +0000
> ++++ glibc-2.3.6/linuxthreads/sysdeps/powerpc/Makefile  2007-04-04 16:26:01.969067632 +0100
> +@@ -1,6 +1,6 @@
> + ifeq ($(subdir):$(elf),linuxthreads:yes)
> + # See CFLAGS-initfini.s above; this is the same code.
> +-CFLAGS-pt-initfini.s = -g0 -fpic -O1
> ++CFLAGS-pt-initfini.s = -g0 -fpic -O1 $(fno-unit-at-a-time)
> + endif
> + ifeq ($(subdir),csu)
> + gen-as-const-headers += tcb-offsets.sym
> +
> 
> I didn't set GCC_CORE_DIR so that it uses gcc 4.1.1 as the core/bootstrap gcc rather than 3.3.6. This was because the 3.3.6 configuration is broken for the 8540 as follows:
> 
> Unknown cpu used with --with-cpu=8540
> Configure in {BUILD_DIR}/build-gcc-core/gcc failed, exiting.
> 
> Although 3.3.6 appears to have support for the 8540, it seems that it's not possible to configure for it! I couldn't work out why it was necessary to use 3.3.6 as the core gcc (gcc-4.1.1-glibc-2.3.6.dat), but 4.1.1 seemed to do the trick so far... Maybe it would be better to fix 3.3.6 config for the 8540 and use that as the core gcc, rather than use 4.1.1?
> 
> I've used the toolchain to build a linux kernel (2.6.18) and busybox for an MPC8560ADS target, where I've also been able to run most of the crosstest regression tests, although with plenty of hassle from the root-jail! glibctest.sh required some serious hacking to get it to run, and I relented and ran the gcc tests as plain root on the target. I couldn't get the libstdc++ test to work at all. Otherwise here's my (snipped) results:
> 
> ===================================================================
> powerpc-8540-linux-gnu-gcc-4.1.1-glibc-2.3.6.gcc.sum
> ===================================================================
> LAST_UPDATED: Obtained from SVN: tags/gcc_4_1_1_release revision 114100
> 
> Target is powerpc-8540-linux-gnu
> Host   is i686-host_pc-linux-gnu
> 
>   === gcc tests ===
> 
> 
> Running target powerpc-8540-linux-gnu
> FAIL: gcc.dg/20020103-1.c scan-assembler-not LC[0-9]
> FAIL: gcc.dg/cleanup-10.c execution test
> FAIL: gcc.dg/cleanup-11.c execution test
> FAIL: gcc.dg/cleanup-5.c execution test
> FAIL: gcc.dg/cleanup-8.c execution test
> FAIL: gcc.dg/cleanup-9.c execution test
> FAIL: gcc.dg/tree-ssa/stdarg-2.c scan-tree-dump f3: va_list escapes 0, needs to save 0 GPR units and [1-9][0-9]* FPR units
> FAIL: gcc.dg/tree-ssa/stdarg-2.c scan-tree-dump f12: va_list escapes 0, needs to save 0 GPR units and [1-9][0-9]* FPR units
> FAIL: gcc.dg/tree-ssa/stdarg-2.c scan-tree-dump f13: va_list escapes 0, needs to save 0 GPR units and [1-9][0-9]* FPR units
> FAIL: gcc.dg/tree-ssa/stdarg-2.c scan-tree-dump f14: va_list escapes 0, needs to save [148] GPR units and [1-9][0-9]* FPR units
> FAIL: gcc.dg/tree-ssa/stdarg-2.c scan-tree-dump f15: va_list escapes 0, needs to save [148] GPR units and [1-9][0-9]* FPR units
> FAIL: gcc.dg/tree-ssa/stdarg-4.c scan-tree-dump f2: va_list escapes 0, needs to save 0 GPR units and all FPR units
> FAIL: gcc.dg/tree-ssa/stdarg-4.c scan-tree-dump f4: va_list escapes 0, needs to save 0 GPR units and [1-9][0-9]* FPR units
> FAIL: gcc.target/powerpc/20040622-1.c (test for excess errors)
> FAIL: gcc.target/powerpc/980827-1.c (test for excess errors)
> WARNING: gcc.target/powerpc/980827-1.c compilation failed to produce executable
> FAIL: gcc.target/powerpc/compress-float-ppc-pic.c scan-assembler lfs
> FAIL: gcc.target/powerpc/compress-float-ppc.c scan-assembler lfs
> FAIL: gcc.target/powerpc/ppc-ldstruct.c (test for excess errors)
> FAIL: gcc.target/powerpc/pr18096-1.c stack frame too large (test for warnings, line 11)
> FAIL: gcc.target/powerpc/pr18096-1.c (test for excess errors)
> FAIL: gcc.target/powerpc/pr25960.c (test for excess errors)
> WARNING: gcc.target/powerpc/pr25960.c compilation failed to produce executable
> 
>   === gcc Summary ===
> 
> # of expected passes  40013
> # of unexpected failures 21
> # of expected failures  99
> # of untested testcases  28
> # of unsupported tests  343
> /home/adennis/projects/tppc_linux/tppc/crosstool-0.43/build/powerpc-8540-linux-gnu/gcc-4.1.1-glibc-2.3.6/build-gcc/gcc/xgcc  version 4.1.1
> 
> Host   is i686-host_pc-linux-gnu
> 
>   === libstdc++ tests ===
> 
> 
> Running target powerpc-8540-linux-gnu
> 
>   === libstdc++ Summary ===
> 
> Host   is i686-host_pc-linux-gnu
> 
>   === g++ tests ===
> 
> 
> Running target powerpc-8540-linux-gnu
> XPASS: g++.dg/tree-ssa/pr14814.C scan-tree-dump-times &this 0
> FAIL: g++.old-deja/g++.other/comdat5.C (test for excess errors)
> 
>   === g++ Summary ===
> 
> # of expected passes  12118
> # of unexpected failures 1
> # of unexpected successes 1
> # of expected failures  66
> # of unsupported tests  117
> /home/adennis/projects/tppc_linux/tppc/crosstool-0.43/build/powerpc-8540-linux-gnu/gcc-4.1.1-glibc-2.3.6/build-gcc/gcc/testsuite/g++/../../g++  version 4.1.1
> 
> Host   is i686-host_pc-linux-gnu
> 
>   === libstdc++ tests ===
> 
> 
> Running target powerpc-8540-linux-gnu
> 
>   === libstdc++ Summary ===
> 
> Host   is powerpc-8540-linux-gnu
> 
>   === libstdc++ tests ===
> 
> 
> Running target powerpc-8540-linux-gnu
> ERROR: tcl error sourcing /home/adennis/projects/tppc_linux/tppc/crosstool-0.43/build/powerpc-8540-linux-gnu/gcc-4.1.1-glibc-2.3.6/gcc-4.1.1/libstdc++-v3/testsuite/libstdc++-abi/abi.exp.
> ERROR: could not compile testsuite_character.cc
> ERROR: tcl error sourcing /home/adennis/projects/tppc_linux/tppc/crosstool-0.43/build/powerpc-8540-linux-gnu/gcc-4.1.1-glibc-2.3.6/gcc-4.1.1/libstdc++-v3/testsuite/libstdc++-dg/normal.exp.
> ERROR: could not compile testsuite_character.cc
> 
>   === libstdc++ Summary ===
> 
> 
> Compiler version: 4.1.1 
> Platform: powerpc-8540-linux-gnu
> configure flags: --target=powerpc-8540-linux-gnu --host=i686-host_pc-linux-gnu --prefix=/home/adennis/projects/tppc_linux/tools --with-cpu=8540 --with-float=soft --enable-cxx-flags=-mcpu=8540 --enable-cxx-flags=-msoft-float --disable-multilib --with-headers=/home/adennis/projects/tppc_linux/tools/powerpc-8540-linux-gnu/include --with-local-prefix=/home/adennis/projects/tppc_linux/tools/powerpc-8540-linux-gnu --disable-nls --enable-threads=posix --enable-symvers=gnu --enable-__cxa_atexit --enable-shared --enable-c99 --enable-long-long --enable-languages=c,c++
> ===================================================================
> powerpc-8540-linux-gnu-gcc-4.1.1-glibc-2.3.6.binutils.sum
> ===================================================================
> [---------------------------- binutils/binutils.sum ---------------------------]
> Test Run By adennis on Tue May  1 14:41:02 2007
> Target is powerpc-8540-linux-gnu
> Host   is i686-host_pc-linux-gnu
> 
>   === binutils tests ===
> 
> Schedule of variations:
>     powerpc-8540-linux-gnu
> 
> Running target powerpc-8540-linux-gnu
> <...snip...>
>   === binutils Summary ===
> 
> # of expected passes  33
> 
> [---------------------------- gas/testsuite/gas.sum ---------------------------]
> Test Run By adennis on Tue May  1 14:41:10 2007
> Target is powerpc-8540-linux-gnu
> Host   is i686-host_pc-linux-gnu
> 
>   === gas tests ===
> 
> Schedule of variations:
>     powerpc-8540-linux-gnu
> 
> Running target powerpc-8540-linux-gnu
> <...snip...>
>   === gas Summary ===
> 
> # of expected passes  77
> ../as-new 2.16.1
> 
> 
> [---------------------------- ld/ld.sum ---------------------------]
> Test Run By adennis on Tue May  1 14:41:13 2007
> Target is powerpc-8540-linux-gnu
> Host   is i686-host_pc-linux-gnu
> 
>   === ld tests ===
> 
> Schedule of variations:
>     powerpc-8540-linux-gnu
> 
> Running target powerpc-8540-linux-gnu
> <...snip...>
> Running /home/adennis/projects/tppc_linux/tppc/crosstool-0.43/build/powerpc-8540-linux-gnu/gcc-4.1.1-glibc-2.3.6/binutils-2.16.1/ld/testsuite/ld-elf/elf.exp ...
> FAIL: ld-elf/group1
> PASS: ld-elf/merge
> PASS: ld-elf/merge2
> PASS: ld-elf/warn1
> <...snip...>
> Running /home/adennis/projects/tppc_linux/tppc/crosstool-0.43/build/powerpc-8540-linux-gnu/gcc-4.1.1-glibc-2.3.6/binutils-2.16.1/ld/testsuite/ld-powerpc/powerpc.exp ...
> PASS: Reloc section order
> PASS: APUinfo section processing
> PASS: TLS32 static exec
> PASS: TLS32 helper shared library
> FAIL: TLS32 dynamic exec
> FAIL: TLS32 shared
> <...snip...>
> Running /home/adennis/projects/tppc_linux/tppc/crosstool-0.43/build/powerpc-8540-linux-gnu/gcc-4.1.1-glibc-2.3.6/binutils-2.16.1/ld/testsuite/ld-scripts/provide.exp ...
> PASS: ld-scripts/provide-1
> PASS: ld-scripts/provide-2
> XFAIL: ld-scripts/provide-3
> <...snip...>
> Running /home/adennis/projects/tppc_linux/tppc/crosstool-0.43/build/powerpc-8540-linux-gnu/gcc-4.1.1-glibc-2.3.6/binutils-2.16.1/ld/testsuite/ld-selective/selective.exp ...
> PASS: selective1
> PASS: selective2
> PASS: selective3
> XFAIL: selective4
> XFAIL: selective5
> XFAIL: selective6
> <...snip...>
>   === ld Summary ===
> 
> # of expected passes  88
> # of unexpected failures 3
> # of expected failures  4
> /home/adennis/projects/tppc_linux/tppc/crosstool-0.43/build/powerpc-8540-linux-gnu/gcc-4.1.1-glibc-2.3.6/build-binutils/ld/ld-new 2.16.1
> 
> ===================================================================
> glibc test
> ===================================================================
> <...only failures were...>
> cat /home/root-jail/build-glibc/stdio-common/tst-fseek.out
> 343: st_ctime not updated
> 348: st_mtime not updated
> 439: SEEK_END works
> 471: SEEK_END works
> cat /home/root-jail/build-glibc/io/test-utime.out
> modtime 1177948667 <262631 >262633
> ===================================================================
> 
> I might need to have a look at some of those gcc failures...
> 
> Any comments?
> Cheers,
> Alan Dennis
> 
> 
> NOTICE & DISCLAIMER 
> This email including attachments (this "Document") is confidential and may contain legally privileged information.  If you have received this Document in error please notify the sender immediately and delete this Document from your system without using, copying, disclosing or disseminating it or placing any reliance upon its contents.  We cannot accept liability for any breaches of confidence arising through use of this Document.
> 
> The information contained in this Document is provided solely for information purposes on an "as is" basis without warranty of any kind, either express or implied, including without limitation any implied warranty of satisfactory or merchantable quality, fitness for a particular purpose or freedom from error or infringement.  The user relies on the information contained herein, and its accuracy or otherwise, entirely at their own risk.
> 
> Any opinions expressed in this Document are those of the author and do not necessarily reflect the opinions of Telsis.  We will not accept responsibility for any commitments made by our employees outside the scope of our business.
> 
> 
> 
> 
> --
> For unsubscribe information see http://sourceware.org/lists.html#faq
> 



--
For unsubscribe information see http://sourceware.org/lists.html#faq


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]