finally move buildroot-ng to trunk
[openwrt/staging/chunkeey.git] / toolchain / gcc / patches / 3.4.4 / 800-arm-bigendian.patch
1 By Lennert Buytenhek <buytenh@wantstofly.org>
2 Adds support for arm*b-linux* big-endian ARM targets
3
4 See http://gcc.gnu.org/PR16350
5
6 diff -urN gcc-3.4.1-dist/gcc/config/arm/linux-elf.h gcc-3.4.1/gcc/config/arm/linux-elf.h
7 --- gcc-3.4.1-dist/gcc/config/arm/linux-elf.h 2004-08-16 16:01:50.000000000 -0500
8 +++ gcc-3.4.1/gcc/config/arm/linux-elf.h 2004-08-16 15:43:40.000000000 -0500
9 @@ -30,17 +30,34 @@
10 /* Do not assume anything about header files. */
11 #define NO_IMPLICIT_EXTERN_C
12
13 +/*
14 + * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
15 + * (big endian) configurations.
16 + */
17 +#if TARGET_BIG_ENDIAN_DEFAULT
18 +#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END
19 +#define TARGET_ENDIAN_OPTION "mbig-endian"
20 +#define TARGET_LINKER_EMULATION "armelfb_linux"
21 +#else
22 +#define TARGET_ENDIAN_DEFAULT 0
23 +#define TARGET_ENDIAN_OPTION "mlittle-endian"
24 +#define TARGET_LINKER_EMULATION "armelf_linux"
25 +#endif
26 +
27 /* Default is to use APCS-32 mode. */
28 #undef TARGET_DEFAULT
29 -#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS)
30 +#define TARGET_DEFAULT \
31 + ( ARM_FLAG_APCS_32 | \
32 + ARM_FLAG_MMU_TRAPS | \
33 + TARGET_ENDIAN_DEFAULT )
34
35 #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
36
37 -#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
38 +#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
39
40 #undef MULTILIB_DEFAULTS
41 #define MULTILIB_DEFAULTS \
42 - { "marm", "mlittle-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" }
43 + { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mapcs-32", "mno-thumb-interwork" }
44
45 #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
46
47 @@ -101,7 +118,7 @@
48 %{rdynamic:-export-dynamic} \
49 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
50 -X \
51 - %{mbig-endian:-EB}" \
52 + %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
53 SUBTARGET_EXTRA_LINK_SPEC
54 #endif
55
56 diff -urN gcc-3.4.1-dist/gcc/config.gcc gcc-3.4.1/gcc/config.gcc
57 --- gcc-3.4.1-dist/gcc/config.gcc 2004-08-16 16:01:50.000000000 -0500
58 +++ gcc-3.4.1/gcc/config.gcc 2004-08-16 16:01:25.000000000 -0500
59 @@ -672,6 +672,11 @@
60 ;;
61 arm*-*-linux*) # ARM GNU/Linux with ELF
62 tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/aout.h arm/arm.h"
63 + case $target in
64 + arm*b-*)
65 + tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines"
66 + ;;
67 + esac
68 tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux"
69 extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
70 gnu_ld=yes