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