patches/gcc/4.2.4/240-arm-bigendian.patch
author "Benoît THÉBAUDEAU" <benoit.thebaudeau@advansee.com>
Thu Jul 28 22:09:31 2011 +0200 (2011-07-28)
changeset 2573 424fa2092ace
parent 687 b2b6b1d46aa1
permissions -rw-r--r--
scripts/libc: do not build add-ons by default

Currently, no --enable-add-ons option is passed to libc configure when
"$(do_libc_add_ons_list ,)" is empty, which makes configure automatically search
for present add-ons. In that case, all present add-ons are built, although
no add-on was selected by the user in the config. Moreover, this can make the
configure fail if some non-standard add-ons like eglibc-localedef are present.

This behavior also leads to an inconsistency from a user point of view between
the following cases:
- LIBC_ADDONS_LIST="", LIBC_GLIBC_USE_PORTS=n and THREADS="none" in the config,
which makes "$(do_libc_add_ons_list ,)" return "", so all present add-ons
are built.
- LIBC_ADDONS_LIST="", LIBC_GLIBC_USE_PORTS=n and THREADS!="none" in the
config, which makes "$(do_libc_add_ons_list ,)" return the add-on supporting
the chosen threading implementation, e.g. "nptl", so only this add-on is
built.

This patch disables the building of all add-ons in that case.

It is still possible to build all present add-ons by adding --enable-add-ons to
LIBC_GLIBC_EXTRA_CONFIG_ARRAY.

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