patches/gcc/4.0.0/110-arm-bigendian.patch
changeset 746 b150d6f590fc
parent 402 197e1b49586e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/gcc/4.0.0/110-arm-bigendian.patch	Mon Jul 28 21:08:01 2008 +0000
     1.3 @@ -0,0 +1,79 @@
     1.4 +By Lennert Buytenhek <buytenh@wantstofly.org>
     1.5 +Adds support for arm*b-linux* big-endian ARM targets
     1.6 +
     1.7 +Fixes following build error for big-endian ARM targets:
     1.8 +
     1.9 +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
    1.10 +Supported emulations: armelfb_linux armelfb
    1.11 +collect2: ld returned 1 exit status
    1.12 +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
    1.13 +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'
    1.14 +make[1]: *** [csu/subdir_lib] Error 2
    1.15 +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'
    1.16 +make: *** [lib] Error 2
    1.17 +
    1.18 +
    1.19 +See http://gcc.gnu.org/PR16350
    1.20 +
    1.21 +--- gcc-4.0-20050305/gcc/config/arm/linux-elf.h.orig	2005-03-23 18:44:54.822707377 +0100
    1.22 ++++ gcc-4.0-20050305/gcc/config/arm/linux-elf.h	2005-03-23 18:46:18.228560206 +0100
    1.23 +@@ -31,19 +31,33 @@
    1.24 + /* Do not assume anything about header files.  */
    1.25 + #define NO_IMPLICIT_EXTERN_C
    1.26 + 
    1.27 ++/*
    1.28 ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for
    1.29 ++ * arm*b-*-linux* (big endian) configurations.
    1.30 ++ */
    1.31 ++#if TARGET_BIG_ENDIAN_DEFAULT
    1.32 ++#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END
    1.33 ++#define TARGET_ENDIAN_OPTION "mbig-endian"
    1.34 ++#define TARGET_LINKER_EMULATION "armelfb_linux"
    1.35 ++#else
    1.36 ++#define TARGET_ENDIAN_DEFAULT 0
    1.37 ++#define TARGET_ENDIAN_OPTION "mlittle-endian"
    1.38 ++#define TARGET_LINKER_EMULATION "armelf_linux"
    1.39 ++#endif
    1.40 ++
    1.41 + #undef  TARGET_DEFAULT_FLOAT_ABI
    1.42 + #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
    1.43 + 
    1.44 + #undef  TARGET_DEFAULT
    1.45 +-#define TARGET_DEFAULT (0)
    1.46 ++#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT)
    1.47 + 
    1.48 + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
    1.49 + 
    1.50 +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
    1.51 ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
    1.52 + 
    1.53 + #undef  MULTILIB_DEFAULTS
    1.54 + #define MULTILIB_DEFAULTS \
    1.55 +-	{ "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
    1.56 ++	{ "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" }
    1.57 + 
    1.58 + /* The GNU C++ standard library requires that these macros be defined.  */
    1.59 + #undef CPLUSPLUS_CPP_SPEC
    1.60 +@@ -90,7 +104,7 @@
    1.61 +    %{rdynamic:-export-dynamic} \
    1.62 +    %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
    1.63 +    -X \
    1.64 +-   %{mbig-endian:-EB}" \
    1.65 ++   %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
    1.66 +    SUBTARGET_EXTRA_LINK_SPEC
    1.67 + 
    1.68 + #define TARGET_OS_CPP_BUILTINS()		\
    1.69 +--- gcc-4.0-20050305/gcc/config.gcc.orig	2005-03-23 18:46:23.318105335 +0100
    1.70 ++++ gcc-4.0-20050305/gcc/config.gcc	2005-03-23 18:47:41.592546386 +0100
    1.71 +@@ -650,6 +650,11 @@
    1.72 + 	;;
    1.73 + arm*-*-linux*)			# ARM GNU/Linux with ELF
    1.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"
    1.75 ++	case $target in
    1.76 ++	arm*b-*-linux*)
    1.77 ++		tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
    1.78 ++		;;
    1.79 ++	esac
    1.80 + 	tmake_file="${tmake_file} arm/t-arm arm/t-linux"
    1.81 + 	extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
    1.82 + 	gnu_ld=yes