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: [PATCH] add basic SPARC support


On Sat, Apr 2, 2011 at 11:25 PM, Sam Ravnborg <sam@ravnborg.org> wrote:
> add basic SPARC support
>
> Add support for building SPARC targeted toolchain.
> With this patch I have built a working sparc V8 (32 toolchain).
>
> Testing shows that not all gcc versions works well:
> 4.4.1 ? ? ? ? ? ?OK ?(kernel builds and the final kernel can boot)
> 4.4.2 ? ? ? ? ? ?Not tested
> 4.4.3 ? ? ? ? ? ?Not tested
> 4.4.4 ? ? ? ? ? ?BAD (Kernel can build but fails during boot)
> 4.4.5 ? ? ? ? ? ?BAD (Kernel can build but fails during boot)
> 4.5.1 ? ? ? ? ? ?BAD (Build fails with a spill related ICE - http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35664)
> 4.5.2 ? ? ? ? ? ?OK ?(kernel builds and boots)
>
> I have successfully been using the 4.5.2 version for a few months.
>
I used the patch and built the cross compiler for sparc, using
gcc-4.4.1, with bare-metal OS and newlib, without C++.
The build was successful. However when I tried to compile a simple
test program, the following error shows up:

/research/tools/ct-ng/build-ct-ng-1.10.1/x-tools/sparc-unknown-elf/sysroot/lib/crt0.o:
In function `start':
(.text+0x0): undefined reference to `__stack'
/research/tools/ct-ng/build-ct-ng-1.10.1/x-tools/sparc-unknown-elf/sysroot/lib/crt0.o:
In function `start':
(.text+0x4): undefined reference to `__stack'
/research/tools/ct-ng/build-ct-ng-1.10.1/x-tools/sparc-unknown-elf/sysroot/lib/crt0.o:
In function `init':
(.text+0xbc): undefined reference to `hardware_init_hook'
/research/tools/ct-ng/build-ct-ng-1.10.1/x-tools/sparc-unknown-elf/sysroot/lib/crt0.o:
In function `init':
(.text+0xc0): undefined reference to `hardware_init_hook'
/research/tools/ct-ng/build-ct-ng-1.10.1/x-tools/sparc-unknown-elf/sysroot/lib/crt0.o:
In function `init':
(.text+0xd0): undefined reference to `hardware_init_hook'
/research/tools/ct-ng/build-ct-ng-1.10.1/x-tools/sparc-unknown-elf/sysroot/lib/crt0.o:
In function `init':
(.text+0xd8): undefined reference to `software_init_hook'
/research/tools/ct-ng/build-ct-ng-1.10.1/x-tools/sparc-unknown-elf/sysroot/lib/crt0.o:
In function `init':
(.text+0xdc): undefined reference to `software_init_hook'
/research/tools/ct-ng/build-ct-ng-1.10.1/x-tools/sparc-unknown-elf/sysroot/lib/crt0.o:
In function `init':
(.text+0xec): undefined reference to `software_init_hook'
/research/tools/ct-ng/build-ct-ng-1.10.1/x-tools/sparc-unknown-elf/sysroot/lib/crt0.o:
In function `init':
(.text+0xfc): undefined reference to `exit'
/research/tools/ct-ng/build-ct-ng-1.10.1/x-tools/sparc-unknown-elf/sysroot/lib/crt0.o:
In function `win_ovf_trap':
(.text+0x110): undefined reference to `win_ovf'
/research/tools/ct-ng/build-ct-ng-1.10.1/x-tools/sparc-unknown-elf/sysroot/lib/crt0.o:
In function `win_ovf_trap':
(.text+0x114): undefined reference to `win_ovf'
/research/tools/ct-ng/build-ct-ng-1.10.1/x-tools/sparc-unknown-elf/sysroot/lib/crt0.o:
In function `win_unf_trap':
(.text+0x120): undefined reference to `win_unf'
/research/tools/ct-ng/build-ct-ng-1.10.1/x-tools/sparc-unknown-elf/sysroot/lib/crt0.o:
In function `win_unf_trap':
(.text+0x124): undefined reference to `win_unf'

Any clues?

> This patch does not add support for the LEON variant.
> That may come later.
>
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> ---
>
> The patch was made ~3 months ago and I have not tried to apply it to
> recent crosstool-ng.
> My spare time has since been occupied by some kernel stuff, and when I get
> spare time again I need to go back and finish this first.
> Later I still plan to revisit how to add LEON support - allthough
> I hope Gaisler will beat me on that...
>
> ? ? ? ?Sam
>
>
> diff -r cb0f625b3f9f config/arch/sparc.in
> --- /dev/null ? Thu Jan 01 00:00:00 1970 +0000
> +++ b/config/arch/sparc.in ? ? ?Sun Apr 03 08:09:50 2011 +0200
> @@ -0,0 +1,13 @@
> +# SPARC specific config options
> +
> +config ARCH_sparc
> + ? ?select ARCH_SUPPORTS_32
> + ? ?select ARCH_SUPPORTS_64
> + ? ?select ARCH_DEFAULT_32
> + ? ?select ARCH_USE_MMU
> + ? ?select ARCH_SUPPORT_CPU
> + ? ?select ARCH_SUPPORT_TUNE
> + ? ?help
> + ? ? ?The SUN SPARC architecture, as defined by:
> + ? ? ? ?32 bit: http://www.sparc.org/standards/V8.pdf
> + ? ? ? ?64 bit: http://www.sparc.org/standards/SPARCV9.pdf
> diff -r cb0f625b3f9f scripts/build/arch/sparc.sh
> --- /dev/null ? Thu Jan 01 00:00:00 1970 +0000
> +++ b/scripts/build/arch/sparc.sh ? ? ? Sun Apr 03 08:09:50 2011 +0200
> @@ -0,0 +1,10 @@
> +# Compute sparc-specific values
> +CT_DoArchTupleValues() {
> + ? ?# That's the only thing to override
> + ? ?if [ "${CT_ARCH_64}" = "y" ]; then
> + ? ? ? ?CT_TARGET_ARCH="${CT_ARCH}64"
> + ? ?else
> + ? ? ? ?CT_TARGET_ARCH="${CT_ARCH}"
> + ? ?fi
> +
> +}
>



-- 
Xun Li
Computer Architecture Lab
Department of Computer Science
University of California, Santa Barbara

--
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]