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