[backfire] toolchain: fix gcc 3.4.6 (brcm-2.4) after relocation from usr/, refresh...
[openwrt/svn-archive/archive.git] / toolchain / gcc / patches / 3.4.6 / 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 --- a/gcc/config/arm/linux-elf.h
7 +++ b/gcc/config/arm/linux-elf.h
8 @@ -30,17 +30,34 @@
9 /* Do not assume anything about header files. */
10 #define NO_IMPLICIT_EXTERN_C
11
12 +/*
13 + * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
14 + * (big endian) configurations.
15 + */
16 +#if TARGET_BIG_ENDIAN_DEFAULT
17 +#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END
18 +#define TARGET_ENDIAN_OPTION "mbig-endian"
19 +#define TARGET_LINKER_EMULATION "armelfb_linux"
20 +#else
21 +#define TARGET_ENDIAN_DEFAULT 0
22 +#define TARGET_ENDIAN_OPTION "mlittle-endian"
23 +#define TARGET_LINKER_EMULATION "armelf_linux"
24 +#endif
25 +
26 /* Default is to use APCS-32 mode. */
27 #undef TARGET_DEFAULT
28 -#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS)
29 +#define TARGET_DEFAULT \
30 + ( ARM_FLAG_APCS_32 | \
31 + ARM_FLAG_MMU_TRAPS | \
32 + TARGET_ENDIAN_DEFAULT )
33
34 #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
35
36 -#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
37 +#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
38
39 #undef MULTILIB_DEFAULTS
40 #define MULTILIB_DEFAULTS \
41 - { "marm", "mlittle-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" }
42 + { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mapcs-32", "mno-thumb-interwork" }
43
44 #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
45
46 @@ -101,7 +118,7 @@
47 %{rdynamic:-export-dynamic} \
48 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
49 -X \
50 - %{mbig-endian:-EB}" \
51 + %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
52 SUBTARGET_EXTRA_LINK_SPEC
53 #endif
54
55 --- a/gcc/config.gcc
56 +++ b/gcc/config.gcc
57 @@ -684,6 +684,11 @@ arm*-*-linux-uclibc*) # ARM GNU/Linux w
58 ;;
59 arm*-*-linux*) # ARM GNU/Linux with ELF
60 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"
61 + case $target in
62 + arm*b-*)
63 + tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines"
64 + ;;
65 + esac
66 tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux"
67 extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
68 gnu_ld=yes