gcc 4.2.4 support
[openwrt/staging/chunkeey.git] / toolchain / gcc / patches / 4.2.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 Index: gcc-4.2.3/gcc/config/arm/linux-elf.h
7 ===================================================================
8 --- gcc-4.2.3.orig/gcc/config/arm/linux-elf.h 2007-09-01 17:28:30.000000000 +0200
9 +++ gcc-4.2.3/gcc/config/arm/linux-elf.h 2008-05-21 13:45:53.349289241 +0200
10 @@ -27,19 +27,33 @@
11 #undef TARGET_VERSION
12 #define TARGET_VERSION fputs (" (ARM GNU/Linux with ELF)", stderr);
13
14 +/*
15 + * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
16 + * (big endian) configurations.
17 + */
18 +#if TARGET_BIG_ENDIAN_DEFAULT
19 +#define TARGET_ENDIAN_DEFAULT MASK_BIG_END
20 +#define TARGET_ENDIAN_OPTION "mbig-endian"
21 +#define TARGET_LINKER_EMULATION "armelfb_linux"
22 +#else
23 +#define TARGET_ENDIAN_DEFAULT 0
24 +#define TARGET_ENDIAN_OPTION "mlittle-endian"
25 +#define TARGET_LINKER_EMULATION "armelf_linux"
26 +#endif
27 +
28 #undef TARGET_DEFAULT_FLOAT_ABI
29 #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
30
31 #undef TARGET_DEFAULT
32 -#define TARGET_DEFAULT (0)
33 +#define TARGET_DEFAULT (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", "mno-thumb-interwork" }
43 + { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" }
44
45 /* Now we define the strings used to build the spec file. */
46 #undef LIB_SPEC
47 @@ -60,7 +74,7 @@
48 %{rdynamic:-export-dynamic} \
49 %{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "} \
50 -X \
51 - %{mbig-endian:-EB}" \
52 + %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
53 SUBTARGET_EXTRA_LINK_SPEC
54
55 #undef LINK_SPEC
56 Index: gcc-4.2.3/gcc/config.gcc
57 ===================================================================
58 --- gcc-4.2.3.orig/gcc/config.gcc 2008-05-21 13:45:43.333288320 +0200
59 +++ gcc-4.2.3/gcc/config.gcc 2008-05-21 13:45:53.353287795 +0200
60 @@ -708,6 +708,11 @@
61 tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
62 tmake_file="${tmake_file} t-linux arm/t-arm"
63 case ${target} in
64 + arm*b-*)
65 + tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
66 + ;;
67 + esac
68 + case ${target} in
69 arm*-*-linux-*eabi)
70 tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
71 tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"