patches/gcc/3.3.6/110-gcc-3.3.4-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 diff -urN gcc-3.3.4.orig/gcc/config/arm/linux-elf.h gcc-3.3.4/gcc/config/arm/linux-elf.h
     2 --- gcc-3.3.4.orig/gcc/config/arm/linux-elf.h	2004-03-30 22:43:45.000000000 +0200
     3 +++ gcc-3.3.4/gcc/config/arm/linux-elf.h	2004-08-20 02:13:02.969084177 +0200
     4 @@ -30,17 +30,31 @@
     5  /* Do not assume anything about header files.  */
     6  #define NO_IMPLICIT_EXTERN_C
     7  
     8 +/*
     9 + * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
    10 + * (big endian) configurations.
    11 + */
    12 +#if TARGET_BIG_ENDIAN_DEFAULT
    13 +#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END
    14 +#define TARGET_ENDIAN_OPTION "mbig-endian"
    15 +#define TARGET_LINKER_EMULATION "armelfb_linux"
    16 +#else
    17 +#define TARGET_ENDIAN_DEFAULT 0
    18 +#define TARGET_ENDIAN_OPTION "mlittle-endian"
    19 +#define TARGET_LINKER_EMULATION "armelf_linux"
    20 +#endif
    21 +
    22  /* Default is to use APCS-32 mode.  */
    23  #undef  TARGET_DEFAULT
    24 -#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS)
    25 +#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS | TARGET_ENDIAN_DEFAULT)
    26  
    27  #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
    28  
    29 -#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
    30 +#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
    31  
    32  #undef  MULTILIB_DEFAULTS
    33  #define MULTILIB_DEFAULTS \
    34 -	{ "marm", "mlittle-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" }
    35 +	{ "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mapcs-32", "mno-thumb-interwork" }
    36  
    37  #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
    38  
    39 @@ -88,7 +102,7 @@
    40     %{rdynamic:-export-dynamic} \
    41     %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
    42     -X \
    43 -   %{mbig-endian:-EB}" \
    44 +   %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
    45     SUBTARGET_EXTRA_LINK_SPEC
    46  
    47  #define TARGET_OS_CPP_BUILTINS()		\
    48 diff -urN gcc-3.3.4.orig/gcc/config.gcc gcc-3.3.4/gcc/config.gcc
    49 --- gcc-3.3.4.orig/gcc/config.gcc	2004-04-29 06:42:47.000000000 +0200
    50 +++ gcc-3.3.4/gcc/config.gcc	2004-08-20 02:11:04.326143343 +0200
    51 @@ -699,6 +699,11 @@
    52  	;;
    53  arm*-*-linux*)			# ARM GNU/Linux with ELF
    54  	tm_file="dbxelf.h elfos.h arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/aout.h arm/arm.h"
    55 +	case $machine in
    56 +	arm*b-*)
    57 +		tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines"
    58 +		;;
    59 +	esac
    60  	tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux"
    61  	extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
    62  	gnu_ld=yes