patches/gcc/4.2.3/240-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 431 8bde4c6ea47a
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@313
     1
diff -durN gcc-4.2.1.orig/gcc/config/arm/linux-elf.h gcc-4.2.1/gcc/config/arm/linux-elf.h
yann@313
     2
--- gcc-4.2.1.orig/gcc/config/arm/linux-elf.h	2006-02-17 00:29:10.000000000 +0100
yann@313
     3
+++ gcc-4.2.1/gcc/config/arm/linux-elf.h	2007-08-03 20:36:43.000000000 +0200
yann@313
     4
@@ -28,19 +28,33 @@
yann@313
     5
 #undef  TARGET_VERSION
yann@313
     6
 #define TARGET_VERSION  fputs (" (ARM GNU/Linux with ELF)", stderr);
yann@313
     7
 
yann@313
     8
+/*
yann@313
     9
+ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
yann@313
    10
+ * (big endian) configurations.
yann@313
    11
+ */
yann@313
    12
+#if TARGET_BIG_ENDIAN_DEFAULT
yann@313
    13
+#define TARGET_ENDIAN_DEFAULT MASK_BIG_END
yann@313
    14
+#define TARGET_ENDIAN_OPTION "mbig-endian"
yann@313
    15
+#define TARGET_LINKER_EMULATION "armelfb_linux"
yann@313
    16
+#else
yann@313
    17
+#define TARGET_ENDIAN_DEFAULT 0
yann@313
    18
+#define TARGET_ENDIAN_OPTION "mlittle-endian"
yann@313
    19
+#define TARGET_LINKER_EMULATION "armelf_linux"
yann@313
    20
+#endif
yann@313
    21
+
yann@313
    22
 #undef  TARGET_DEFAULT_FLOAT_ABI
yann@313
    23
 #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
yann@313
    24
 
yann@313
    25
 #undef  TARGET_DEFAULT
yann@313
    26
-#define TARGET_DEFAULT (0)
yann@313
    27
+#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT)
yann@313
    28
 
yann@313
    29
 #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
yann@313
    30
 
yann@313
    31
-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
yann@313
    32
+#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
yann@313
    33
 
yann@313
    34
 #undef  MULTILIB_DEFAULTS
yann@313
    35
 #define MULTILIB_DEFAULTS \
yann@313
    36
-	{ "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
yann@313
    37
+	{ "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" }
yann@313
    38
 
yann@313
    39
 /* Now we define the strings used to build the spec file.  */
yann@313
    40
 #undef  LIB_SPEC
yann@313
    41
@@ -61,7 +75,7 @@
yann@313
    42
    %{rdynamic:-export-dynamic} \
yann@313
    43
    %{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "} \
yann@313
    44
    -X \
yann@313
    45
-   %{mbig-endian:-EB}" \
yann@313
    46
+   %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
yann@313
    47
    SUBTARGET_EXTRA_LINK_SPEC
yann@313
    48
 
yann@313
    49
 #undef  LINK_SPEC
yann@313
    50
diff -durN gcc-4.2.1.orig/gcc/config.gcc gcc-4.2.1/gcc/config.gcc
yann@313
    51
--- gcc-4.2.1.orig/gcc/config.gcc	2007-08-03 20:29:52.000000000 +0200
yann@313
    52
+++ gcc-4.2.1/gcc/config.gcc	2007-08-03 20:36:43.000000000 +0200
yann@313
    53
@@ -705,6 +705,11 @@
yann@313
    54
 	tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
yann@313
    55
 	tmake_file="${tmake_file} t-linux arm/t-arm"
yann@313
    56
 	case ${target} in
yann@313
    57
+	arm*b-*)
yann@313
    58
+		tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
yann@313
    59
+		;;
yann@313
    60
+	esac
yann@313
    61
+	case ${target} in
yann@313
    62
 	arm*-*-linux-*eabi)
yann@313
    63
 	    tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
yann@313
    64
 	    tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"