patches/gcc/4.0.4/190-arm-bigendian.patch
author "Benoît THÉBAUDEAU" <benoit.thebaudeau@advansee.com>
Wed Jun 08 15:47:43 2011 +0200 (2011-06-08)
changeset 2508 9e2761e59a75
parent 1 eeea35fbf182
permissions -rw-r--r--
debug/cross-gdb: check host dependencies

Cross-gdb depends on expat and python. If either is missing, cross-gdb will
build successfully, but lacking some features.

Especially, if expat is missing, cross-gdb will be unable to parse the target
description, which may lead to runtime malfunctions and the following GDB
warning:
"Can not parse XML target description; XML support was disabled at compile time"

Hence, expat should be considered mandatory.

On the other hand, the features missing without python are not critical, so
python should not be considered mandatory.

This patch does the following:
- At configure time, warn the user if either expat or python is missing.
- In menuconfig, disable the static build options regarding cross-gdb if no
static version of expat is available, and disable cross-gdb if expat is
missing.

Signed-off-by: "Benoît THÉBAUDEAU" <benoit.thebaudeau@advansee.com>
[yann.morin.1998@anciens.enib.fr: add comment for impossible static cross-gdb]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
yann@1
     1
diff -dur gcc-4.0.4.orig/gcc/config/arm/linux-elf.h gcc-4.0.4/gcc/config/arm/linux-elf.h
yann@1
     2
--- gcc-4.0.4.orig/gcc/config/arm/linux-elf.h	2007-02-02 19:24:50.000000000 +0100
yann@1
     3
+++ gcc-4.0.4/gcc/config/arm/linux-elf.h	2007-02-02 19:26:12.000000000 +0100
yann@1
     4
@@ -31,19 +31,33 @@
yann@1
     5
 /* Do not assume anything about header files.  */
yann@1
     6
 #define NO_IMPLICIT_EXTERN_C
yann@1
     7
 
yann@1
     8
+/*
yann@1
     9
+ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
yann@1
    10
+ * (big endian) configurations.
yann@1
    11
+ */
yann@1
    12
+#if TARGET_BIG_ENDIAN_DEFAULT
yann@1
    13
+#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END
yann@1
    14
+#define TARGET_ENDIAN_OPTION "mbig-endian"
yann@1
    15
+#define TARGET_LINKER_EMULATION "armelfb_linux"
yann@1
    16
+#else
yann@1
    17
+#define TARGET_ENDIAN_DEFAULT 0
yann@1
    18
+#define TARGET_ENDIAN_OPTION "mlittle-endian"
yann@1
    19
+#define TARGET_LINKER_EMULATION "armelf_linux"
yann@1
    20
+#endif
yann@1
    21
+
yann@1
    22
 #undef  TARGET_DEFAULT_FLOAT_ABI
yann@1
    23
 #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
yann@1
    24
 
yann@1
    25
 #undef  TARGET_DEFAULT
yann@1
    26
-#define TARGET_DEFAULT (0)
yann@1
    27
+#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT)
yann@1
    28
 
yann@1
    29
 #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
yann@1
    30
 
yann@1
    31
-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
yann@1
    32
+#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
yann@1
    33
 
yann@1
    34
 #undef  MULTILIB_DEFAULTS
yann@1
    35
 #define MULTILIB_DEFAULTS \
yann@1
    36
-	{ "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
yann@1
    37
+	{ "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" }
yann@1
    38
 
yann@1
    39
 /* The GNU C++ standard library requires that these macros be defined.  */
yann@1
    40
 #undef CPLUSPLUS_CPP_SPEC
yann@1
    41
@@ -95,7 +109,7 @@
yann@1
    42
    %{rdynamic:-export-dynamic} \
yann@1
    43
    %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "} \
yann@1
    44
    -X \
yann@1
    45
-   %{mbig-endian:-EB}" \
yann@1
    46
+   %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
yann@1
    47
    SUBTARGET_EXTRA_LINK_SPEC
yann@1
    48
 
yann@1
    49
 #define TARGET_OS_CPP_BUILTINS()		\
yann@1
    50
Only in gcc-4.0.4/gcc/config/arm: linux-elf.h.orig
yann@1
    51
diff -dur gcc-4.0.4.orig/gcc/config.gcc gcc-4.0.4/gcc/config.gcc
yann@1
    52
--- gcc-4.0.4.orig/gcc/config.gcc	2007-02-02 19:24:50.000000000 +0100
yann@1
    53
+++ gcc-4.0.4/gcc/config.gcc	2007-02-02 19:26:12.000000000 +0100
yann@1
    54
@@ -672,6 +672,11 @@
yann@1
    55
 	;;
yann@1
    56
 arm*-*-linux*)			# ARM GNU/Linux with ELF
yann@1
    57
 	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"
yann@1
    58
+	case $target in
yann@1
    59
+	arm*b-*)
yann@1
    60
+		tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines"
yann@1
    61
+		;;
yann@1
    62
+	esac
yann@1
    63
 	tmake_file="${tmake_file} arm/t-arm arm/t-linux"
yann@1
    64
 	extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
yann@1
    65
 	gnu_ld=yes