patches/gcc/4.1.2/200-arm-bigendian.patch
author Cody Schafer <dev@codyps.com>
Fri May 09 19:13:49 2014 -0700 (2014-05-09)
changeset 3312 4876ff97e039
parent 13 068dce39f687
permissions -rw-r--r--
cc/gcc: allow CC_EXTRA_CONFIG_ARRAY on baremetal

The final bare-metal compiler is built using the core backend.
Currently the core uses the CC_CORE_EXTRA_CONFIG_ARRAY variable.

While this works as supposed to, this can leave the user puzzled
in the menuconfig, since all he can see is the core options, not
the final options.

Only show the core options if any of the core passes are needed,
and use the final options in the core-backend if we're issuing
the bare-metal compiler.

Signed-off-by: Cody P Schafer <dev@codyps.com>
[yann.morin.1998@free.fr: hide core options if no core pass needed;
use final option in core backend if issuing the bare-metal compiler]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Message-Id: <22181e546ba746202489.1399688067@localhost>
Patchwork-Id: 347586
     1 --- gcc-4.1.2.orig/gcc/config/arm/linux-elf.h	2007-03-04 23:25:37.000000000 +0100
     2 +++ gcc-4.1.2/gcc/config/arm/linux-elf.h	2007-03-04 23:35:09.000000000 +0100
     3 @@ -28,19 +28,33 @@
     4  #undef  TARGET_VERSION
     5  #define TARGET_VERSION  fputs (" (ARM GNU/Linux with ELF)", stderr);
     6  
     7 +/*
     8 + * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
     9 + * (big endian) configurations.
    10 + */
    11 +#if TARGET_BIG_ENDIAN_DEFAULT
    12 +#define TARGET_ENDIAN_DEFAULT MASK_BIG_END
    13 +#define TARGET_ENDIAN_OPTION "mbig-endian"
    14 +#define TARGET_LINKER_EMULATION "armelfb_linux"
    15 +#else
    16 +#define TARGET_ENDIAN_DEFAULT 0
    17 +#define TARGET_ENDIAN_OPTION "mlittle-endian"
    18 +#define TARGET_LINKER_EMULATION "armelf_linux"
    19 +#endif
    20 +
    21  #undef  TARGET_DEFAULT_FLOAT_ABI
    22  #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
    23  
    24  #undef  TARGET_DEFAULT
    25 -#define TARGET_DEFAULT (0)
    26 +#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT)
    27  
    28  #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
    29  
    30 -#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
    31 +#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
    32  
    33  #undef  MULTILIB_DEFAULTS
    34  #define MULTILIB_DEFAULTS \
    35 -	{ "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
    36 +	{ "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" }
    37  
    38  /* Now we define the strings used to build the spec file.  */
    39  #undef  LIB_SPEC
    40 @@ -65,7 +79,7 @@
    41     %{rdynamic:-export-dynamic} \
    42     %{!dynamic-linker:-dynamic-linker " LINUX_TARGET_INTERPRETER "} \
    43     -X \
    44 -   %{mbig-endian:-EB}" \
    45 +   %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
    46     SUBTARGET_EXTRA_LINK_SPEC
    47  
    48  #undef  LINK_SPEC
    49 --- gcc-4.1.2.orig/gcc/config.gcc	2007-03-04 23:31:48.000000000 +0100
    50 +++ gcc-4.1.2/gcc/config.gcc	2007-03-04 23:35:09.000000000 +0100
    51 @@ -672,6 +672,11 @@
    52  	;;
    53  arm*-*-linux*)			# ARM GNU/Linux with ELF
    54  	tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h" 
    55 +	case $target in
    56 +	arm*b-*)
    57 +		tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
    58 +		;;
    59 +	esac
    60  	tmake_file="${tmake_file} t-linux arm/t-arm"
    61  	case ${target} in
    62  	arm*-*-linux-gnueabi | arm*-*-linux-uclibcgnueabi)
    63 --- gcc-4.1.2.orig/gcc/config/arm/linux-eabi.h	2007-03-04 23:31:48.000000000 +0100
    64 +++ gcc-4.1.2/gcc/config/arm/linux-eabi.h	2007-03-04 23:35:09.000000000 +0100
    65 @@ -20,6 +20,17 @@
    66     the Free Software Foundation, 51 Franklin Street, Fifth Floor,
    67     Boston, MA 02110-1301, USA.  */
    68  
    69 +/*
    70 + * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
    71 + * (big endian) configurations.
    72 + */
    73 +#undef TARGET_LINKER_EMULATION
    74 +#if TARGET_BIG_ENDIAN_DEFAULT
    75 +#define TARGET_LINKER_EMULATION "armelfb_linux_eabi"
    76 +#else
    77 +#define TARGET_LINKER_EMULATION "armelf_linux_eabi"
    78 +#endif
    79 +
    80  /* On EABI GNU/Linux, we want both the BPABI builtins and the
    81     GNU/Linux builtins.  */
    82  #undef TARGET_OS_CPP_BUILTINS
    83 @@ -48,7 +59,7 @@
    84  #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
    85  
    86  #undef SUBTARGET_EXTRA_LINK_SPEC
    87 -#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux_eabi"
    88 +#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION
    89  
    90  /* Use ld-linux.so.3 so that it will be possible to run "classic"
    91     GNU/Linux binaries on an EABI system.  */
    92 --- gcc-4.1.2.orig/gcc/config/arm/bpabi.h	2005-12-13 02:35:37.000000000 +0100
    93 +++ gcc-4.1.2/gcc/config/arm/bpabi.h	2007-03-04 23:35:09.000000000 +0100
    94 @@ -33,9 +33,19 @@
    95  #undef FPUTYPE_DEFAULT
    96  #define FPUTYPE_DEFAULT FPUTYPE_VFP
    97  
    98 +/*
    99 + * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
   100 + * (big endian) configurations.
   101 + */
   102 +#if TARGET_BIG_ENDIAN_DEFAULT
   103 +#define TARGET_ENDIAN_DEFAULT MASK_BIG_END
   104 +#else
   105 +#define TARGET_ENDIAN_DEFAULT 0
   106 +#endif
   107 +
   108  /* EABI targets should enable interworking by default.  */
   109  #undef TARGET_DEFAULT
   110 -#define TARGET_DEFAULT MASK_INTERWORK
   111 +#define TARGET_DEFAULT (MASK_INTERWORK | TARGET_ENDIAN_DEFAULT)
   112  
   113  /* The ARM BPABI functions return a boolean; they use no special
   114     calling convention.  */