patches/gcc/4.0.0/gcc-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 following build error for big-endian ARM targets:
     5 
     6 armeb-unknown-linux-gnu/gcc-4.0.0-20050410-glibc-2.3.4/bin/../lib/gcc/armeb-unknown-linux-gnu/4.0.0/../../../../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]: *** [crosstool-0.32/build/armeb-unknown-linux-gnu/gcc-4.0.0-20050410-glibc-2.3.4/build-glibc/csu/crt1.o] Error 1
    10 make[2]: Leaving directory `crosstool-0.32/build/armeb-unknown-linux-gnu/gcc-4.0.0-20050410-glibc-2.3.4/glibc-2.3.4/csu'
    11 make[1]: *** [csu/subdir_lib] Error 2
    12 make[1]: Leaving directory `crosstool-0.32/build/armeb-unknown-linux-gnu/gcc-4.0.0-20050410-glibc-2.3.4/glibc-2.3.4'
    13 make: *** [lib] Error 2
    14 
    15 
    16 See http://gcc.gnu.org/PR16350
    17 
    18 --- gcc-4.0-20050305/gcc/config/arm/linux-elf.h.orig	2005-03-23 18:44:54.822707377 +0100
    19 +++ gcc-4.0-20050305/gcc/config/arm/linux-elf.h	2005-03-23 18:46:18.228560206 +0100
    20 @@ -31,19 +31,33 @@
    21  /* Do not assume anything about header files.  */
    22  #define NO_IMPLICIT_EXTERN_C
    23  
    24 +/*
    25 + * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for
    26 + * arm*b-*-linux* (big endian) configurations.
    27 + */
    28 +#if TARGET_BIG_ENDIAN_DEFAULT
    29 +#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END
    30 +#define TARGET_ENDIAN_OPTION "mbig-endian"
    31 +#define TARGET_LINKER_EMULATION "armelfb_linux"
    32 +#else
    33 +#define TARGET_ENDIAN_DEFAULT 0
    34 +#define TARGET_ENDIAN_OPTION "mlittle-endian"
    35 +#define TARGET_LINKER_EMULATION "armelf_linux"
    36 +#endif
    37 +
    38  #undef  TARGET_DEFAULT_FLOAT_ABI
    39  #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
    40  
    41  #undef  TARGET_DEFAULT
    42 -#define TARGET_DEFAULT (0)
    43 +#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT)
    44  
    45  #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
    46  
    47 -#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
    48 +#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
    49  
    50  #undef  MULTILIB_DEFAULTS
    51  #define MULTILIB_DEFAULTS \
    52 -	{ "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
    53 +	{ "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" }
    54  
    55  /* The GNU C++ standard library requires that these macros be defined.  */
    56  #undef CPLUSPLUS_CPP_SPEC
    57 @@ -90,7 +104,7 @@
    58     %{rdynamic:-export-dynamic} \
    59     %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
    60     -X \
    61 -   %{mbig-endian:-EB}" \
    62 +   %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
    63     SUBTARGET_EXTRA_LINK_SPEC
    64  
    65  #define TARGET_OS_CPP_BUILTINS()		\
    66 --- gcc-4.0-20050305/gcc/config.gcc.orig	2005-03-23 18:46:23.318105335 +0100
    67 +++ gcc-4.0-20050305/gcc/config.gcc	2005-03-23 18:47:41.592546386 +0100
    68 @@ -650,6 +650,11 @@
    69  	;;
    70  arm*-*-linux*)			# ARM GNU/Linux with ELF
    71  	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"
    72 +	case $target in
    73 +	arm*b-*-linux*)
    74 +		tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
    75 +		;;
    76 +	esac
    77  	tmake_file="${tmake_file} arm/t-arm arm/t-linux"
    78  	extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
    79  	gnu_ld=yes