1 By Lennert Buytenhek <buytenh@wantstofly.org>
2 Adds support for arm*b-linux* big-endian ARM targets
4 See http://gcc.gnu.org/PR16350
6 Index: gcc-4.1.1/gcc/config/arm/linux-elf.h
7 ===================================================================
8 --- gcc-4.1.1.orig/gcc/config/arm/linux-elf.h
9 +++ gcc-4.1.1/gcc/config/arm/linux-elf.h
12 #define TARGET_VERSION fputs (" (ARM GNU/Linux with ELF)", stderr);
15 + * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
16 + * (big endian) configurations.
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"
23 +#define TARGET_ENDIAN_DEFAULT 0
24 +#define TARGET_ENDIAN_OPTION "mlittle-endian"
25 +#define TARGET_LINKER_EMULATION "armelf_linux"
28 #undef TARGET_DEFAULT_FLOAT_ABI
29 #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
32 -#define TARGET_DEFAULT (0)
33 +#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT)
35 #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
37 -#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
38 +#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
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" }
45 /* Now we define the strings used to build the spec file. */
48 %{rdynamic:-export-dynamic} \
49 %{!dynamic-linker:-dynamic-linker " LINUX_TARGET_INTERPRETER "} \
51 - %{mbig-endian:-EB}" \
52 + %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
53 SUBTARGET_EXTRA_LINK_SPEC
56 Index: gcc-4.1.1/gcc/config.gcc
57 ===================================================================
58 --- gcc-4.1.1.orig/gcc/config.gcc
59 +++ gcc-4.1.1/gcc/config.gcc
60 @@ -672,6 +672,11 @@ arm*-*-netbsd*)
62 arm*-*-linux*) # ARM GNU/Linux with ELF
63 tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
66 + tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
69 tmake_file="${tmake_file} t-linux arm/t-arm"
72 Index: gcc-4.1.1/gcc/config/arm/linux-eabi.h
73 ===================================================================
74 --- gcc-4.1.1.orig/gcc/config/arm/linux-eabi.h
75 +++ gcc-4.1.1/gcc/config/arm/linux-eabi.h
77 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
78 Boston, MA 02110-1301, USA. */
81 + * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
82 + * (big endian) configurations.
84 +#undef TARGET_LINKER_EMULATION
85 +#if TARGET_BIG_ENDIAN_DEFAULT
86 +#define TARGET_LINKER_EMULATION "armelfb_linux_eabi"
88 +#define TARGET_LINKER_EMULATION "armelf_linux_eabi"
91 /* On EABI GNU/Linux, we want both the BPABI builtins and the
92 GNU/Linux builtins. */
93 #undef TARGET_OS_CPP_BUILTINS
95 #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
97 #undef SUBTARGET_EXTRA_LINK_SPEC
98 -#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux_eabi"
99 +#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION
101 /* Use ld-linux.so.3 so that it will be possible to run "classic"
102 GNU/Linux binaries on an EABI system. */
103 Index: gcc-4.1.1/gcc/config/arm/bpabi.h
104 ===================================================================
105 --- gcc-4.1.1.orig/gcc/config/arm/bpabi.h
106 +++ gcc-4.1.1/gcc/config/arm/bpabi.h
108 #undef FPUTYPE_DEFAULT
109 #define FPUTYPE_DEFAULT FPUTYPE_VFP
112 + * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
113 + * (big endian) configurations.
115 +#if TARGET_BIG_ENDIAN_DEFAULT
116 +#define TARGET_ENDIAN_DEFAULT MASK_BIG_END
118 +#define TARGET_ENDIAN_DEFAULT 0
121 /* EABI targets should enable interworking by default. */
122 #undef TARGET_DEFAULT
123 -#define TARGET_DEFAULT MASK_INTERWORK
124 +#define TARGET_DEFAULT (MASK_INTERWORK | TARGET_ENDIAN_DEFAULT)
126 /* The ARM BPABI functions return a boolean; they use no special
127 calling convention. */