patches/gcc/3.4.5/gcc-3.4.0-arm-bigendian.patch
changeset 1 eeea35fbf182
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/gcc/3.4.5/gcc-3.4.0-arm-bigendian.patch	Sat Feb 24 11:00:05 2007 +0000
     1.3 @@ -0,0 +1,82 @@
     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 build error
     1.8 +
     1.9 +/opt/crosstool/armeb-unknown-linux-gnu/gcc-3.4.2-glibc-2.3.3/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]: *** [/home/dank/wk/crosstool-0.28-rc36/build/armeb-unknown-linux-gnu/gcc-3.4.2-glibc-2.3.3/build-glibc/csu/crt1.o] Error 1
    1.13 +make[2]: Leaving directory `/home/dank/wk/crosstool-0.28-rc36/build/armeb-unknown-linux-gnu/gcc-3.4.2-glibc-2.3.3/glibc-2.3.3/csu'
    1.14 +make[1]: *** [csu/subdir_lib] Error 2
    1.15 +make[1]: Leaving directory `/home/dank/wk/crosstool-0.28-rc36/build/armeb-unknown-linux-gnu/gcc-3.4.2-glibc-2.3.3/glibc-2.3.3'
    1.16 +make: *** [all] Error 2
    1.17 +
    1.18 +
    1.19 +See http://gcc.gnu.org/PR16350
    1.20 +
    1.21 +diff -urN gcc-3.4.0.orig/gcc/config/arm/linux-elf.h gcc-3.4.0/gcc/config/arm/linux-elf.h
    1.22 +--- gcc-3.4.0.orig/gcc/config/arm/linux-elf.h	2004-01-31 07:18:11.000000000 +0100
    1.23 ++++ gcc-3.4.0/gcc/config/arm/linux-elf.h	2004-07-02 14:46:29.225443757 +0200
    1.24 +@@ -30,17 +30,34 @@
    1.25 + /* Do not assume anything about header files.  */
    1.26 + #define NO_IMPLICIT_EXTERN_C
    1.27 + 
    1.28 ++/*
    1.29 ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
    1.30 ++ * (big endian) configurations.
    1.31 ++ */
    1.32 ++#if TARGET_BIG_ENDIAN_DEFAULT
    1.33 ++#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END
    1.34 ++#define TARGET_ENDIAN_OPTION "mbig-endian"
    1.35 ++#define TARGET_LINKER_EMULATION "armelfb_linux"
    1.36 ++#else
    1.37 ++#define TARGET_ENDIAN_DEFAULT 0
    1.38 ++#define TARGET_ENDIAN_OPTION "mlittle-endian"
    1.39 ++#define TARGET_LINKER_EMULATION "armelf_linux"
    1.40 ++#endif
    1.41 ++
    1.42 + /* Default is to use APCS-32 mode.  */
    1.43 + #undef  TARGET_DEFAULT
    1.44 +-#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS)
    1.45 ++#define TARGET_DEFAULT \
    1.46 ++		( ARM_FLAG_APCS_32 | \
    1.47 ++		  ARM_FLAG_MMU_TRAPS | \
    1.48 ++		  TARGET_ENDIAN_DEFAULT )
    1.49 + 
    1.50 + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
    1.51 + 
    1.52 +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
    1.53 ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
    1.54 + 
    1.55 + #undef  MULTILIB_DEFAULTS
    1.56 + #define MULTILIB_DEFAULTS \
    1.57 +-	{ "marm", "mlittle-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" }
    1.58 ++	{ "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mapcs-32", "mno-thumb-interwork" }
    1.59 + 
    1.60 + #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
    1.61 + 
    1.62 +@@ -89,7 +106,7 @@
    1.63 +    %{rdynamic:-export-dynamic} \
    1.64 +    %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
    1.65 +    -X \
    1.66 +-   %{mbig-endian:-EB}" \
    1.67 ++   %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
    1.68 +    SUBTARGET_EXTRA_LINK_SPEC
    1.69 + 
    1.70 + #define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS()
    1.71 +diff -urN gcc-3.4.0.orig/gcc/config.gcc gcc-3.4.0/gcc/config.gcc
    1.72 +--- gcc-3.4.0.orig/gcc/config.gcc	2004-04-17 04:28:24.000000000 +0200
    1.73 ++++ gcc-3.4.0/gcc/config.gcc	2004-07-02 14:44:40.045822542 +0200
    1.74 +@@ -666,6 +666,11 @@
    1.75 + 	;;
    1.76 + arm*-*-linux*)			# ARM GNU/Linux with ELF
    1.77 + 	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.78 ++	case $target in
    1.79 ++	arm*b-*)
    1.80 ++		tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines"
    1.81 ++		;;
    1.82 ++	esac
    1.83 + 	tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux"
    1.84 + 	extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
    1.85 + 	gnu_ld=yes