patches/gcc/4.1.2/800-arm-bigendian.patch
changeset 1 eeea35fbf182
child 13 068dce39f687
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/gcc/4.1.2/800-arm-bigendian.patch	Sat Feb 24 11:00:05 2007 +0000
     1.3 @@ -0,0 +1,127 @@
     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 +Index: gcc-4.1.1/gcc/config/arm/linux-elf.h
    1.10 +===================================================================
    1.11 +--- gcc-4.1.1.orig/gcc/config/arm/linux-elf.h
    1.12 ++++ gcc-4.1.1/gcc/config/arm/linux-elf.h
    1.13 +@@ -28,19 +28,33 @@
    1.14 + #undef  TARGET_VERSION
    1.15 + #define TARGET_VERSION  fputs (" (ARM GNU/Linux with ELF)", stderr);
    1.16 + 
    1.17 ++/*
    1.18 ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
    1.19 ++ * (big endian) configurations.
    1.20 ++ */
    1.21 ++#if TARGET_BIG_ENDIAN_DEFAULT
    1.22 ++#define TARGET_ENDIAN_DEFAULT MASK_BIG_END
    1.23 ++#define TARGET_ENDIAN_OPTION "mbig-endian"
    1.24 ++#define TARGET_LINKER_EMULATION "armelfb_linux"
    1.25 ++#else
    1.26 ++#define TARGET_ENDIAN_DEFAULT 0
    1.27 ++#define TARGET_ENDIAN_OPTION "mlittle-endian"
    1.28 ++#define TARGET_LINKER_EMULATION "armelf_linux"
    1.29 ++#endif
    1.30 ++
    1.31 + #undef  TARGET_DEFAULT_FLOAT_ABI
    1.32 + #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
    1.33 + 
    1.34 + #undef  TARGET_DEFAULT
    1.35 +-#define TARGET_DEFAULT (0)
    1.36 ++#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT)
    1.37 + 
    1.38 + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
    1.39 + 
    1.40 +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
    1.41 ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
    1.42 + 
    1.43 + #undef  MULTILIB_DEFAULTS
    1.44 + #define MULTILIB_DEFAULTS \
    1.45 +-	{ "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
    1.46 ++	{ "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" }
    1.47 + 
    1.48 + /* Now we define the strings used to build the spec file.  */
    1.49 + #undef  LIB_SPEC
    1.50 +@@ -61,7 +75,7 @@
    1.51 +    %{rdynamic:-export-dynamic} \
    1.52 +    %{!dynamic-linker:-dynamic-linker " LINUX_TARGET_INTERPRETER "} \
    1.53 +    -X \
    1.54 +-   %{mbig-endian:-EB}" \
    1.55 ++   %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
    1.56 +    SUBTARGET_EXTRA_LINK_SPEC
    1.57 + 
    1.58 + #undef  LINK_SPEC
    1.59 +Index: gcc-4.1.1/gcc/config.gcc
    1.60 +===================================================================
    1.61 +--- gcc-4.1.1.orig/gcc/config.gcc
    1.62 ++++ gcc-4.1.1/gcc/config.gcc
    1.63 +@@ -672,6 +672,11 @@ arm*-*-netbsd*)
    1.64 + 	;;
    1.65 + arm*-*-linux*)			# ARM GNU/Linux with ELF
    1.66 + 	tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h" 
    1.67 ++	case $target in
    1.68 ++	arm*b-*)
    1.69 ++		tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
    1.70 ++		;;
    1.71 ++	esac
    1.72 + 	tmake_file="${tmake_file} t-linux arm/t-arm"
    1.73 + 	case ${target} in
    1.74 + 	arm*-*-linux-gnueabi)
    1.75 +Index: gcc-4.1.1/gcc/config/arm/linux-eabi.h
    1.76 +===================================================================
    1.77 +--- gcc-4.1.1.orig/gcc/config/arm/linux-eabi.h
    1.78 ++++ gcc-4.1.1/gcc/config/arm/linux-eabi.h
    1.79 +@@ -20,6 +20,17 @@
    1.80 +    the Free Software Foundation, 51 Franklin Street, Fifth Floor,
    1.81 +    Boston, MA 02110-1301, USA.  */
    1.82 + 
    1.83 ++/*
    1.84 ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
    1.85 ++ * (big endian) configurations.
    1.86 ++ */
    1.87 ++#undef TARGET_LINKER_EMULATION
    1.88 ++#if TARGET_BIG_ENDIAN_DEFAULT
    1.89 ++#define TARGET_LINKER_EMULATION "armelfb_linux_eabi"
    1.90 ++#else
    1.91 ++#define TARGET_LINKER_EMULATION "armelf_linux_eabi"
    1.92 ++#endif
    1.93 ++
    1.94 + /* On EABI GNU/Linux, we want both the BPABI builtins and the
    1.95 +    GNU/Linux builtins.  */
    1.96 + #undef TARGET_OS_CPP_BUILTINS
    1.97 +@@ -48,7 +59,7 @@
    1.98 + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
    1.99 + 
   1.100 + #undef SUBTARGET_EXTRA_LINK_SPEC
   1.101 +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux_eabi"
   1.102 ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION
   1.103 + 
   1.104 + /* Use ld-linux.so.3 so that it will be possible to run "classic"
   1.105 +    GNU/Linux binaries on an EABI system.  */
   1.106 +Index: gcc-4.1.1/gcc/config/arm/bpabi.h
   1.107 +===================================================================
   1.108 +--- gcc-4.1.1.orig/gcc/config/arm/bpabi.h
   1.109 ++++ gcc-4.1.1/gcc/config/arm/bpabi.h
   1.110 +@@ -33,9 +33,19 @@
   1.111 + #undef FPUTYPE_DEFAULT
   1.112 + #define FPUTYPE_DEFAULT FPUTYPE_VFP
   1.113 + 
   1.114 ++/*
   1.115 ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
   1.116 ++ * (big endian) configurations.
   1.117 ++ */
   1.118 ++#if TARGET_BIG_ENDIAN_DEFAULT
   1.119 ++#define TARGET_ENDIAN_DEFAULT MASK_BIG_END
   1.120 ++#else
   1.121 ++#define TARGET_ENDIAN_DEFAULT 0
   1.122 ++#endif
   1.123 ++
   1.124 + /* EABI targets should enable interworking by default.  */
   1.125 + #undef TARGET_DEFAULT
   1.126 +-#define TARGET_DEFAULT MASK_INTERWORK
   1.127 ++#define TARGET_DEFAULT (MASK_INTERWORK | TARGET_ENDIAN_DEFAULT)
   1.128 + 
   1.129 + /* The ARM BPABI functions return a boolean; they use no special
   1.130 +    calling convention.  */