patches/gcc/4.2.1/240-arm-bigendian.patch
author "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
Wed Dec 14 16:55:22 2011 +0100 (2011-12-14)
branch1.13
changeset 2848 1ff89596dab0
parent 313 2f223aafc7cb
permissions -rw-r--r--
libc/eglibc: fix localedef 2.14 build

The localedef of eglibc 2.14 requires NOT_IN_libc to be defined in order to
compile intl/l10nflist.c.

This is because localedef is built separately from eglibc and uses some parts of
eglibc that don't compile in standalone without this preprocessor definition.

This fixes the following error:

[ALL ] gcc -g -O2 -DNO_SYSCONF -DNO_UNCOMPRESS
-DLOCALE_PATH='"/usr/lib/locale:/usr/share/i18n"'
-DLOCALEDIR='"/usr/lib/locale"' -DLOCALE_ALIAS_PATH='"/usr/share/locale"'
-DCHARMAP_PATH='"/usr/share/i18n/charmaps"'
-DREPERTOIREMAP_PATH='"/usr/share/i18n/repertoiremaps"'
-DLOCSRCDIR='"/usr/share/i18n/locales"' -Iglibc/locale/programs -Iglibc/locale
-I/<snip>/.build/src/eglibc-localedef-2_14/include
-I/<snip>/.build/src/eglibc-localedef-2_14 -I.
-include /<snip>/.build/src/eglibc-localedef-2_14/include/always.h -Wall
-Wno-format -c -o locarchive.o glibc/locale/programs/locarchive.c
[ALL ] glibc/locale/programs/locarchive.c: In function 'enlarge_archive':
[ALL ] glibc/locale/programs/locarchive.c:303:21: warning: variable
'oldlocrectab' set but not used [-Wunused-but-set-variable]
[ALL ] In file included from glibc/locale/programs/locarchive.c:651:0:
[ALL ] glibc/locale/programs/../../intl/l10nflist.c: In function
'_nl_normalize_codeset':
[ERROR] glibc/locale/programs/../../intl/l10nflist.c:342:9: error:
'_nl_C_locobj_ptr' undeclared (first use in this function)
[ALL ] glibc/locale/programs/../../intl/l10nflist.c:342:9: note: each
undeclared identifier is reported only once for each function it appears in
[ALL ] glibc/locale/programs/locarchive.c: In function
'add_locales_to_archive':
[ALL ] glibc/locale/programs/locarchive.c:1450:7: warning: passing argument
1 of '__xpg_basename' discards 'const' qualifier from pointer target type
[enabled by default]
[ALL ] /usr/include/libgen.h:35:14: note: expected 'char *' but argument is
of type 'const char *'
[ERROR] make[1]: *** [locarchive.o] Error 1

Signed-off-by: "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
(transplanted from 4cd9134739b594451794cf61a6e1b137422cdafd)
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"