patches/gcc/3.4.2/gcc-3.4.0-arm-bigendian.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Feb 24 11:00:05 2007 +0000 (2007-02-24)
changeset 1 eeea35fbf182
permissions -rw-r--r--
Add the full crosstool-NG sources to the new repository of its own.
You might just say: 'Yeah! crosstool-NG's got its own repo!".
Unfortunately, that's because the previous repo got damaged beyond repair and I had no backup.
That means I'm putting backups in place in the afternoon.
That also means we've lost history... :-(
     1 By Lennert Buytenhek <buytenh@wantstofly.org>
     2 Adds support for arm*b-linux* big-endian ARM targets
     3 
     4 Fixes build error
     5 
     6 /opt/crosstool/armeb-unknown-linux-gnu/gcc-3.4.2-glibc-2.3.3/armeb-unknown-linux-gnu/bin/ld: unrecognised emulation mode: armelf_linux
     7 Supported emulations: armelfb_linux armelfb
     8 collect2: ld returned 1 exit status
     9 make[2]: *** [/home/dank/wk/crosstool-0.28-rc36/build/armeb-unknown-linux-gnu/gcc-3.4.2-glibc-2.3.3/build-glibc/csu/crt1.o] Error 1
    10 make[2]: Leaving directory `/home/dank/wk/crosstool-0.28-rc36/build/armeb-unknown-linux-gnu/gcc-3.4.2-glibc-2.3.3/glibc-2.3.3/csu'
    11 make[1]: *** [csu/subdir_lib] Error 2
    12 make[1]: Leaving directory `/home/dank/wk/crosstool-0.28-rc36/build/armeb-unknown-linux-gnu/gcc-3.4.2-glibc-2.3.3/glibc-2.3.3'
    13 make: *** [all] Error 2
    14 
    15 
    16 See http://gcc.gnu.org/PR16350
    17 
    18 diff -urN gcc-3.4.0.orig/gcc/config/arm/linux-elf.h gcc-3.4.0/gcc/config/arm/linux-elf.h
    19 --- gcc-3.4.0.orig/gcc/config/arm/linux-elf.h	2004-01-31 07:18:11.000000000 +0100
    20 +++ gcc-3.4.0/gcc/config/arm/linux-elf.h	2004-07-02 14:46:29.225443757 +0200
    21 @@ -30,17 +30,34 @@
    22  /* Do not assume anything about header files.  */
    23  #define NO_IMPLICIT_EXTERN_C
    24  
    25 +/*
    26 + * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
    27 + * (big endian) configurations.
    28 + */
    29 +#if TARGET_BIG_ENDIAN_DEFAULT
    30 +#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END
    31 +#define TARGET_ENDIAN_OPTION "mbig-endian"
    32 +#define TARGET_LINKER_EMULATION "armelfb_linux"
    33 +#else
    34 +#define TARGET_ENDIAN_DEFAULT 0
    35 +#define TARGET_ENDIAN_OPTION "mlittle-endian"
    36 +#define TARGET_LINKER_EMULATION "armelf_linux"
    37 +#endif
    38 +
    39  /* Default is to use APCS-32 mode.  */
    40  #undef  TARGET_DEFAULT
    41 -#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS)
    42 +#define TARGET_DEFAULT \
    43 +		( ARM_FLAG_APCS_32 | \
    44 +		  ARM_FLAG_MMU_TRAPS | \
    45 +		  TARGET_ENDIAN_DEFAULT )
    46  
    47  #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
    48  
    49 -#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
    50 +#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
    51  
    52  #undef  MULTILIB_DEFAULTS
    53  #define MULTILIB_DEFAULTS \
    54 -	{ "marm", "mlittle-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" }
    55 +	{ "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mapcs-32", "mno-thumb-interwork" }
    56  
    57  #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
    58  
    59 @@ -89,7 +106,7 @@
    60     %{rdynamic:-export-dynamic} \
    61     %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
    62     -X \
    63 -   %{mbig-endian:-EB}" \
    64 +   %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
    65     SUBTARGET_EXTRA_LINK_SPEC
    66  
    67  #define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS()
    68 diff -urN gcc-3.4.0.orig/gcc/config.gcc gcc-3.4.0/gcc/config.gcc
    69 --- gcc-3.4.0.orig/gcc/config.gcc	2004-04-17 04:28:24.000000000 +0200
    70 +++ gcc-3.4.0/gcc/config.gcc	2004-07-02 14:44:40.045822542 +0200
    71 @@ -666,6 +666,11 @@
    72  	;;
    73  arm*-*-linux*)			# ARM GNU/Linux with ELF
    74  	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"
    75 +	case $target in
    76 +	arm*b-*)
    77 +		tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines"
    78 +		;;
    79 +	esac
    80  	tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux"
    81  	extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
    82  	gnu_ld=yes