patches/gcc/4.0.3/800-arm-bigendian.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Feb 17 22:08:06 2008 +0000 (2008-02-17)
changeset 431 8bde4c6ea47a
permissions -rw-r--r--
Robert P. J. DAY says:

apparently, the patchset for gcc 4.2.1 applies properly to the
source for gcc 4.2.2 and gcc 4.2.3. so, if you want, you can simply
add support for those last two just by augmenting menuconfig and
adding a couple symlinks for those two directories. seems like a
cheap way to add a couple new versions.
     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 --- gcc-4.0.3/gcc/config/arm/linux-elf.h
     7 +++ gcc-4.0.3/gcc/config/arm/linux-elf.h
     8 @@ -31,19 +31,33 @@
     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  #undef  TARGET_DEFAULT_FLOAT_ABI
    27  #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
    28  
    29  #undef  TARGET_DEFAULT
    30 -#define TARGET_DEFAULT (0)
    31 +#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT)
    32  
    33  #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
    34  
    35 -#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
    36 +#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
    37  
    38  #undef  MULTILIB_DEFAULTS
    39  #define MULTILIB_DEFAULTS \
    40 -	{ "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
    41 +	{ "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" }
    42  
    43  /* The GNU C++ standard library requires that these macros be defined.  */
    44  #undef CPLUSPLUS_CPP_SPEC
    45 @@ -90,7 +104,7 @@
    46     %{rdynamic:-export-dynamic} \
    47     %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
    48     -X \
    49 -   %{mbig-endian:-EB}" \
    50 +   %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
    51     SUBTARGET_EXTRA_LINK_SPEC
    52  
    53  #define TARGET_OS_CPP_BUILTINS()		\
    54 --- gcc-4.0.3/gcc/config.gcc
    55 +++ gcc-4.0.3/gcc/config.gcc
    56 @@ -672,6 +672,11 @@
    57  	;;
    58  arm*-*-linux*)			# ARM GNU/Linux with ELF
    59  	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"
    60 +	case $target in
    61 +	arm*b-*)
    62 +		tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines"
    63 +		;;
    64 +	esac
    65  	tmake_file="${tmake_file} arm/t-arm arm/t-linux"
    66  	extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
    67  	gnu_ld=yes