patches/gcc/4.2.0/240-arm-bigendian.patch
changeset 747 d3e603e7c17c
parent 111 2e16b9fc302d
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/gcc/4.2.0/240-arm-bigendian.patch	Mon Jul 28 21:32:33 2008 +0000
     1.3 @@ -0,0 +1,67 @@
     1.4 +By Lennert Buytenhek <buytenh@wantstofly.org>
     1.5 +Adds support for arm*b-linux* big-endian ARM targets
     1.6 +
     1.7 +See http://gcc.gnu.org/PR16350
     1.8 +
     1.9 +--- gcc-4.2.0/gcc/config/arm/linux-elf.h
    1.10 ++++ gcc-4.2.0/gcc/config/arm/linux-elf.h
    1.11 +@@ -28,19 +28,33 @@
    1.12 + #undef  TARGET_VERSION
    1.13 + #define TARGET_VERSION  fputs (" (ARM GNU/Linux with ELF)", stderr);
    1.14 + 
    1.15 ++/*
    1.16 ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
    1.17 ++ * (big endian) configurations.
    1.18 ++ */
    1.19 ++#if TARGET_BIG_ENDIAN_DEFAULT
    1.20 ++#define TARGET_ENDIAN_DEFAULT MASK_BIG_END
    1.21 ++#define TARGET_ENDIAN_OPTION "mbig-endian"
    1.22 ++#define TARGET_LINKER_EMULATION "armelfb_linux"
    1.23 ++#else
    1.24 ++#define TARGET_ENDIAN_DEFAULT 0
    1.25 ++#define TARGET_ENDIAN_OPTION "mlittle-endian"
    1.26 ++#define TARGET_LINKER_EMULATION "armelf_linux"
    1.27 ++#endif
    1.28 ++
    1.29 + #undef  TARGET_DEFAULT_FLOAT_ABI
    1.30 + #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
    1.31 + 
    1.32 + #undef  TARGET_DEFAULT
    1.33 +-#define TARGET_DEFAULT (0)
    1.34 ++#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT)
    1.35 + 
    1.36 + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
    1.37 + 
    1.38 +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
    1.39 ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
    1.40 + 
    1.41 + #undef  MULTILIB_DEFAULTS
    1.42 + #define MULTILIB_DEFAULTS \
    1.43 +-	{ "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
    1.44 ++	{ "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" }
    1.45 + 
    1.46 + /* Now we define the strings used to build the spec file.  */
    1.47 + #undef  LIB_SPEC
    1.48 +@@ -61,7 +75,7 @@
    1.49 +    %{rdynamic:-export-dynamic} \
    1.50 +    %{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "} \
    1.51 +    -X \
    1.52 +-   %{mbig-endian:-EB}" \
    1.53 ++   %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
    1.54 +    SUBTARGET_EXTRA_LINK_SPEC
    1.55 + 
    1.56 + #undef  LINK_SPEC
    1.57 +--- gcc-4.2.0/gcc/config.gcc.orig	2006-09-22 14:53:41.000000000 +0200
    1.58 ++++ gcc-4.2.0/gcc/config.gcc	2006-09-25 10:45:21.000000000 +0200
    1.59 +@@ -696,6 +696,11 @@
    1.60 + 	tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
    1.61 + 	tmake_file="${tmake_file} t-linux arm/t-arm"
    1.62 + 	case ${target} in
    1.63 ++	arm*b-*)
    1.64 ++		tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
    1.65 ++		;;
    1.66 ++	esac
    1.67 ++	case ${target} in
    1.68 + 	arm*-*-linux-*eabi)
    1.69 + 	    tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
    1.70 + 	    tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"