[OpenWrt-Devel] [PATCH 1/3] toolchain: add support of ARC architecture

John Crispin blogic at openwrt.org
Thu Aug 27 07:59:25 EDT 2015


Hi Alexey,

have you already sent these patches upstream to the gcc people ?

	John

On 27/08/2015 13:03, Alexey Brodkin wrote:
> This includes binutils, gcc, gdb and uClibc-ng.
> 
> Latest release of ARC gcc (as of today it is "arc-2015.06")
> is based on upstream gcc 4.8.4.
> 
> Sources are available on GitHub, see:
> https://github.com/foss-for-synopsys-dwc-arc-processors/gcc
> 
> Latest release of ARC binutils (as of today it is "arc-2015.06")
> is based on upstream binutils 2.23.
> 
> Sources are available on GitHub, see:
> https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/releases/tag/arc-2015.06
> 
> Latest release of ARC GDB (as of today this is "arc-2015.06-gdb")
> is based on upstream gdb 7.9.1.
> 
> Sources are available on GitHub, see:
> https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/releases/tag/arc-2015.06-gdb
> 
> Note that for binutils and gdb that come from unified git repository
> (which is the case for upstream binutils/gdb today) we need to disable
> building of gdb in binutils and binutils in gdb hence in binutils:
> ------>8------
> --disable-sim
> --disable-gdb
> ------>8------
> 
> and in gdb:
> ------>8------
> --disable-binutils
> --disable-ld
> --disable-gas
> ------>8------
> 
> Also in gdb we disable sim because if the following breakage while
> building with it:
> ------------>8------------
> /usr/bin/env bash ./../common/genmloop.sh -shell /usr/bin/env bash \
>         -mono -fast -pbb -switch sem5-switch.c \
>         -cpu a5f -infile ./mloop5.in \
>         -outfile-suffix 5
> unknown option: bash
> Makefile:699: recipe for target 'stamp-5mloop' failed
> make[7]: *** [stamp-5mloop] Error 1
> ------------>8------------
> 
> Prerequisites are:
>  [1] http://patchwork.ozlabs.org/patch/510985 which adds uClibc-ng support.
>  [2] http://patchwork.ozlabs.org/patch/502022 which updates config.guess
>  and config.sub
> 
> Cc: Felix Fietkau <nbd at openwrt.org>
> Cc: John Crispin <blogic at openwrt.org>
> Signed-off-by: Alexey Brodkin <abrodkin at synopsys.com>
> ---
>  include/site/arc                                   |  30 +++
>  include/target.mk                                  |   4 +
>  toolchain/Config.in                                |   9 +-
>  toolchain/binutils/Config.in                       |  12 +-
>  toolchain/binutils/Makefile                        |  27 ++-
>  toolchain/gcc/Config.in                            |   5 +
>  toolchain/gcc/Config.version                       |   9 +-
>  toolchain/gcc/common.mk                            |  34 ++-
>  .../001-revert_register_mode_search.patch          |  65 ++++++
>  .../patches/arc-2015.06/002-weak_data_fix.patch    |  42 ++++
>  .../arc-2015.06/003-universal_initializer.patch    |  94 ++++++++
>  .../patches/arc-2015.06/004-case_insensitive.patch |  14 ++
>  .../patches/arc-2015.06/010-documentation.patch    |  23 ++
>  .../patches/arc-2015.06/020-no-plt-backport.patch  |  28 +++
>  .../gcc/patches/arc-2015.06/100-uclibc-conf.patch  |  33 +++
>  .../210-disable_libsanitizer_off_t_check.patch     |  11 +
>  .../arc-2015.06/800-arc-disablelibgmon.patch       |  18 ++
>  .../gcc/patches/arc-2015.06/820-libgcc_pic.patch   |  36 +++
>  .../arc-2015.06/850-use_shared_libgcc.patch        |  47 ++++
>  .../patches/arc-2015.06/851-libgcc_no_compat.patch |  12 +
>  .../gcc/patches/arc-2015.06/860-use_eh_frame.patch |  42 ++++
>  .../patches/arc-2015.06/870-ppc_no_crtsavres.patch |  11 +
>  .../patches/arc-2015.06/880-no_java_section.patch  |  11 +
>  .../gcc/patches/arc-2015.06/910-mbsd_multi.patch   | 253 +++++++++++++++++++++
>  .../arc-2015.06/920-specs_nonfatal_getenv.patch    |  14 ++
>  .../arc-2015.06/940-no-clobber-stamp-bits.patch    |  11 +
>  toolchain/gdb/Makefile                             |  19 +-
>  toolchain/uClibc/Config.in                         |   2 +
>  toolchain/uClibc/Config.version                    |   3 +-
>  toolchain/uClibc/common.mk                         |   1 +
>  toolchain/uClibc/config-ng-1.0.6/arc               |  12 +
>  31 files changed, 904 insertions(+), 28 deletions(-)
>  create mode 100644 include/site/arc
>  create mode 100644 toolchain/gcc/patches/arc-2015.06/001-revert_register_mode_search.patch
>  create mode 100644 toolchain/gcc/patches/arc-2015.06/002-weak_data_fix.patch
>  create mode 100644 toolchain/gcc/patches/arc-2015.06/003-universal_initializer.patch
>  create mode 100644 toolchain/gcc/patches/arc-2015.06/004-case_insensitive.patch
>  create mode 100644 toolchain/gcc/patches/arc-2015.06/010-documentation.patch
>  create mode 100644 toolchain/gcc/patches/arc-2015.06/020-no-plt-backport.patch
>  create mode 100644 toolchain/gcc/patches/arc-2015.06/100-uclibc-conf.patch
>  create mode 100644 toolchain/gcc/patches/arc-2015.06/210-disable_libsanitizer_off_t_check.patch
>  create mode 100644 toolchain/gcc/patches/arc-2015.06/800-arc-disablelibgmon.patch
>  create mode 100644 toolchain/gcc/patches/arc-2015.06/820-libgcc_pic.patch
>  create mode 100644 toolchain/gcc/patches/arc-2015.06/850-use_shared_libgcc.patch
>  create mode 100644 toolchain/gcc/patches/arc-2015.06/851-libgcc_no_compat.patch
>  create mode 100644 toolchain/gcc/patches/arc-2015.06/860-use_eh_frame.patch
>  create mode 100644 toolchain/gcc/patches/arc-2015.06/870-ppc_no_crtsavres.patch
>  create mode 100644 toolchain/gcc/patches/arc-2015.06/880-no_java_section.patch
>  create mode 100644 toolchain/gcc/patches/arc-2015.06/910-mbsd_multi.patch
>  create mode 100644 toolchain/gcc/patches/arc-2015.06/920-specs_nonfatal_getenv.patch
>  create mode 100644 toolchain/gcc/patches/arc-2015.06/940-no-clobber-stamp-bits.patch
>  create mode 100644 toolchain/uClibc/config-ng-1.0.6/arc
> 
> diff --git a/include/site/arc b/include/site/arc
> new file mode 100644
> index 0000000..72a3805
> --- /dev/null
> +++ b/include/site/arc
> @@ -0,0 +1,30 @@
> +#!/bin/sh
> +. $TOPDIR/include/site/linux
> +ac_cv_c_littleendian=${ac_cv_c_littleendian=yes}
> +ac_cv_c_bigendian=${ac_cv_c_bigendian=no}
> +
> +ac_cv_sizeof___int64=0
> +ac_cv_sizeof_char=1
> +ac_cv_sizeof_int=4
> +ac_cv_sizeof_int16_t=2
> +ac_cv_sizeof_int32_t=4
> +ac_cv_sizeof_int64_t=8
> +ac_cv_sizeof_long_int=4
> +ac_cv_sizeof_long_long=8
> +ac_cv_sizeof_long=4
> +ac_cv_sizeof_off_t=8
> +ac_cv_sizeof_short_int=2
> +ac_cv_sizeof_short=2
> +ac_cv_sizeof_size_t=4
> +ac_cv_sizeof_ssize_t=4
> +ac_cv_sizeof_u_int16_t=2
> +ac_cv_sizeof_u_int32_t=4
> +ac_cv_sizeof_u_int64_t=8
> +ac_cv_sizeof_uint16_t=2
> +ac_cv_sizeof_uint32_t=4
> +ac_cv_sizeof_uint64_t=8
> +ac_cv_sizeof_unsigned_int=4
> +ac_cv_sizeof_unsigned_long=4
> +ac_cv_sizeof_unsigned_long_long=8
> +ac_cv_sizeof_unsigned_short=2
> +ac_cv_sizeof_void_p=4
> diff --git a/include/target.mk b/include/target.mk
> index 3e7f17d..fdf6370 100644
> --- a/include/target.mk
> +++ b/include/target.mk
> @@ -259,6 +259,10 @@ ifeq ($(DUMP),1)
>      CPU_TYPE ?= armv8-a
>      CPU_CFLAGS_armv8-a = -mcpu=armv8-a
>    endif
> +  ifeq ($(ARCH),arc)
> +    CPU_TYPE ?= arc700
> +    CPU_CFLAGS_arc700 = -marc700
> +  endif
>    DEFAULT_CFLAGS=$(strip $(CPU_CFLAGS) $(CPU_CFLAGS_$(CPU_TYPE)) $(CPU_CFLAGS_$(CPU_SUBTYPE)))
>  endif
>  
> diff --git a/toolchain/Config.in b/toolchain/Config.in
> index 1e94602..2b3ade1 100644
> --- a/toolchain/Config.in
> +++ b/toolchain/Config.in
> @@ -211,7 +211,7 @@ comment "C Library"
>  
>  choice
>  	prompt "C Library implementation" if TOOLCHAINOPTS
> -	default LIBC_USE_UCLIBC if mips64 || mips64el
> +	default LIBC_USE_UCLIBC if arc || mips64 || mips64el
>  	default LIBC_USE_MUSL
>  	help
>  	  Select the C library implementation.
> @@ -219,6 +219,7 @@ choice
>  	config LIBC_USE_GLIBC
>  		bool "Use (e)glibc"
>  		select USE_GLIBC
> +		depends on !arc
>  
>  	config LIBC_USE_UCLIBC
>  		select USE_UCLIBC
> @@ -228,7 +229,7 @@ choice
>  	config LIBC_USE_MUSL
>  		select USE_MUSL
>  		bool "Use musl"
> -		depends on !(mips64 || mips64el)
> +		depends on !(arc || mips64 || mips64el)
>  
>  endchoice
>  
> @@ -259,11 +260,11 @@ config USE_GLIBC
>  	bool
>  
>  config USE_UCLIBC
> -	default y if !TOOLCHAINOPTS && !EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN && (mips64 || mips64el)
> +	default y if !TOOLCHAINOPTS && !EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN && (arc || mips64 || mips64el)
>  	bool
>  
>  config USE_MUSL
> -	default y if !TOOLCHAINOPTS && !EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN && !(mips64 || mips64el)
> +	default y if !TOOLCHAINOPTS && !EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN && !(arc || mips64 || mips64el)
>  	bool
>  
>  config USE_EXTERNAL_LIBC
> diff --git a/toolchain/binutils/Config.in b/toolchain/binutils/Config.in
> index 8d91223..0f670f1 100644
> --- a/toolchain/binutils/Config.in
> +++ b/toolchain/binutils/Config.in
> @@ -2,13 +2,19 @@
>  
>  choice
>  	prompt "Binutils Version" if TOOLCHAINOPTS
> -	default BINUTILS_VERSION_LINARO
> +	default BINUTILS_VERSION_ARC if arc
> +	default BINUTILS_VERSION_LINARO if !arc
>  	help
>  	  Select the version of binutils you wish to use.
>  
>  	config BINUTILS_VERSION_LINARO
> +		depends on !arc
>  		bool "Linaro binutils 2.24"
>  
> +	config BINUTILS_VERSION_ARC
> +		depends on arc
> +		bool "ARC binutils 2015.06"
> +
>  endchoice
>  
>  config EXTRA_BINUTILS_CONFIG_OPTIONS
> @@ -21,5 +27,5 @@ config EXTRA_BINUTILS_CONFIG_OPTIONS
>  config BINUTILS_VERSION
>  	string
>  	prompt "Binutils Version" if (TOOLCHAINOPTS && NULL)
> -	default "linaro"          if BINUTILS_VERSION_LINARO
> -	default "linaro"
> +	default "linaro"          if BINUTILS_VERSION_LINARO || (!TOOLCHAINOPTS && !arc)
> +	default "arc"             if BINUTILS_VERSION_ARC || (!TOOLCHAINOPTS && arc)
> diff --git a/toolchain/binutils/Makefile b/toolchain/binutils/Makefile
> index 0276512..d420802 100644
> --- a/toolchain/binutils/Makefile
> +++ b/toolchain/binutils/Makefile
> @@ -10,11 +10,20 @@ PKG_NAME:=binutils
>  PKG_VERSION:=$(call qstrip,$(CONFIG_BINUTILS_VERSION))
>  BIN_VERSION:=$(PKG_VERSION)
>  
> -PKG_SOURCE_URL:=https://releases.linaro.org/14.09/components/toolchain/binutils-linaro/
> -PKG_REV:=2.24.0-2014.09
> -PKG_SOURCE:=$(PKG_NAME)-linaro-$(PKG_REV).tar.xz
> -PKG_MD5SUM:=8f9b2b2e049d59b1b86ce9657802a353
> -BINUTILS_DIR:=$(PKG_NAME)-linaro-$(PKG_REV)
> +ifeq ($(findstring arc, $(CONFIG_BINUTILS_VERSION)),arc)
> +	PKG_SOURCE_URL:=https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/archive/arc-2015.06/
> +	PKG_REV:=2015.06
> +	PKG_SOURCE:=$(PKG_NAME)-arc-$(PKG_REV).tar.gz
> +	PKG_MD5SUM:=961a3564de857238c255c381f8e4360b
> +	BINUTILS_DIR:=$(PKG_NAME)-gdb-arc-$(PKG_REV)
> +else
> +	PKG_SOURCE_URL:=https://releases.linaro.org/14.09/components/toolchain/binutils-linaro/
> +	PKG_REV:=2.24.0-2014.09
> +	PKG_SOURCE:=$(PKG_NAME)-linaro-$(PKG_REV).tar.xz
> +	PKG_MD5SUM:=8f9b2b2e049d59b1b86ce9657802a353
> +	BINUTILS_DIR:=$(PKG_NAME)-linaro-$(PKG_REV)
> +endif
> +
>  HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(BINUTILS_DIR)
>  
>  HOST_BUILD_PARALLEL:=1
> @@ -37,6 +46,8 @@ BINUTILS_CONFIGURE:= \
>  		--disable-multilib \
>  		--disable-werror \
>  		--disable-nls \
> +		--disable-sim \
> +		--disable-gdb \
>  		$(GRAPHITE_CONFIGURE) \
>  		$(SOFT_FLOAT_CONFIG_OPTION) \
>  		$(call qstrip,$(CONFIG_EXTRA_BINUTILS_CONFIG_OPTIONS)) 
> @@ -82,6 +93,12 @@ define Host/Install
>  	$(call FixupLibdir,$(TOOLCHAIN_DIR)/initial)
>  	$(RM) $(TOOLCHAIN_DIR)/initial/lib/libiberty.a
>  	$(CP) $(TOOLCHAIN_DIR)/bin/$(REAL_GNU_TARGET_NAME)-readelf $(REAL_STAGING_DIR_HOST)/bin/readelf
> +	# ARC gcc requires extlib.
> +	# If extlib is not available in "initial" folder
> +	# initial gcc will fail to build libc.
> +	if [ -d $(TOOLCHAIN_DIR)/extlib ]; then \
> +		$(CP) -r $(TOOLCHAIN_DIR)/extlib $(TOOLCHAIN_DIR)/initial/; \
> +	fi
>  endef
>  
>  define Host/Clean
> diff --git a/toolchain/gcc/Config.in b/toolchain/gcc/Config.in
> index f5de52d..b0d47db 100644
> --- a/toolchain/gcc/Config.in
> +++ b/toolchain/gcc/Config.in
> @@ -3,6 +3,7 @@
>  choice
>  	prompt "GCC compiler Version" if TOOLCHAINOPTS
>  	default GCC_USE_VERSION_4_6_LINARO if TARGET_octeon
> +	default GCC_USE_VERSION_4_8_ARC if arc
>  	default GCC_USE_VERSION_4_8_LINARO
>  	help
>  	  Select the version of gcc you wish to use.
> @@ -14,6 +15,10 @@ choice
>  	config GCC_USE_VERSION_4_8_LINARO
>  		select GCC_VERSION_4_8_LINARO
>  		bool "gcc 4.8.x with Linaro enhancements"
> +		
> +	config GCC_USE_VERSION_4_8_ARC
> +		select GCC_VERSION_4_8_ARC
> +		bool "gcc 4.8.x with support of ARC cores"
>  
>  	config GCC_USE_VERSION_4_9_LINARO
>  		select GCC_VERSION_4_9_LINARO
> diff --git a/toolchain/gcc/Config.version b/toolchain/gcc/Config.version
> index c5cf232..e94b631 100644
> --- a/toolchain/gcc/Config.version
> +++ b/toolchain/gcc/Config.version
> @@ -3,12 +3,16 @@ config GCC_VERSION_4_6_LINARO
>  	bool
>  
>  config GCC_VERSION_4_8_LINARO
> -	default y if (!TOOLCHAINOPTS && !TARGET_octeon)
> +	default y if (!TOOLCHAINOPTS && !(TARGET_octeon || arc))
>  	bool
>  
>  config GCC_VERSION_4_9_LINARO
>  	bool
>  
> +config GCC_VERSION_4_8_ARC
> +	default y if (!TOOLCHAINOPTS && arc)
> +	bool
> +
>  config GCC_VERSION
>  	string
>  	default "4.6.3"	    if GCC_VERSION_4_6_3
> @@ -16,6 +20,7 @@ config GCC_VERSION
>  	default "4.6-linaro"    if GCC_VERSION_4_6_LINARO
>  	default "4.8-linaro"    if GCC_VERSION_4_8_LINARO
>  	default "4.9-linaro"    if GCC_VERSION_4_9_LINARO
> +	default "arc-2015.06"   if GCC_VERSION_4_8_ARC
>  	default "4.6-linaro"
>  
>  config GCC_VERSION_4_6
> @@ -24,7 +29,7 @@ config GCC_VERSION_4_6
>  
>  config GCC_VERSION_4_8
>  	bool
> -	default y	if GCC_VERSION_4_8_LINARO
> +	default y	if (GCC_VERSION_4_8_LINARO || GCC_VERSION_4_8_ARC)
>  
>  config GCC_VERSION_4_9
>  	bool
> diff --git a/toolchain/gcc/common.mk b/toolchain/gcc/common.mk
> index bc5a732..bbffa5b 100644
> --- a/toolchain/gcc/common.mk
> +++ b/toolchain/gcc/common.mk
> @@ -25,6 +25,19 @@ GCC_VERSION:=$(call qstrip,$(CONFIG_GCC_VERSION))
>  PKG_VERSION:=$(firstword $(subst +, ,$(GCC_VERSION)))
>  GCC_DIR:=$(PKG_NAME)-$(PKG_VERSION)
>  
> +PKG_SOURCE_URL:=@GNU/gcc/gcc-$(PKG_VERSION)
> +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
> +
> +ifeq ($(PKG_VERSION),4.6.3)
> +  PKG_MD5SUM:=773092fe5194353b02bb0110052a972e
> +endif
> +ifeq ($(PKG_VERSION),4.8.0)
> +  PKG_MD5SUM:=e6040024eb9e761c3bea348d1fa5abb0
> +endif
> +ifeq ($(PKG_VERSION),5.2.0)
> +  PKG_MD5SUM:=a51bcfeb3da7dd4c623e27207ed43467
> +endif
> +
>  ifeq ($(findstring linaro, $(CONFIG_GCC_VERSION)),linaro)
>      LINARO_RELEASE:=
>      ifeq ($(CONFIG_GCC_VERSION),"4.6-linaro")
> @@ -57,19 +70,16 @@ ifeq ($(findstring linaro, $(CONFIG_GCC_VERSION)),linaro)
>      PKG_SOURCE:=$(PKG_NAME)-linaro-$(PKG_REV).tar.$(PKG_COMP)
>      GCC_DIR:=gcc-linaro-$(PKG_REV)
>      HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(GCC_DIR)
> -else
> -  PKG_SOURCE_URL:=@GNU/gcc/gcc-$(PKG_VERSION)
> -  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
> +endif
>  
> -  ifeq ($(PKG_VERSION),4.6.3)
> -    PKG_MD5SUM:=773092fe5194353b02bb0110052a972e
> -  endif
> -  ifeq ($(PKG_VERSION),4.8.0)
> -    PKG_MD5SUM:=e6040024eb9e761c3bea348d1fa5abb0
> -  endif
> -  ifeq ($(PKG_VERSION),5.2.0)
> -    PKG_MD5SUM:=a51bcfeb3da7dd4c623e27207ed43467
> -  endif
> +ifneq ($(CONFIG_GCC_VERSION_4_8_ARC),)
> +    PKG_VERSION:=4.8.4
> +    PKG_SOURCE_URL:=https://github.com/foss-for-synopsys-dwc-arc-processors/gcc/archive/arc-2015.06
> +    PKG_SOURCE:=$(PKG_NAME)-$(GCC_VERSION).tar.gz
> +    PKG_MD5SUM:=25007ebb02a5f6c32532b103bb5984a0
> +    PKG_REV:=2015.06
> +    GCC_DIR:=gcc-arc-$(PKG_REV)
> +    HOST_BUILD_DIR = $(BUILD_DIR_HOST)/$(PKG_NAME)-$(GCC_VERSION)
>  endif
>  
>  PATCH_DIR=../patches/$(GCC_VERSION)
> diff --git a/toolchain/gcc/patches/arc-2015.06/001-revert_register_mode_search.patch b/toolchain/gcc/patches/arc-2015.06/001-revert_register_mode_search.patch
> new file mode 100644
> index 0000000..162d651
> --- /dev/null
> +++ b/toolchain/gcc/patches/arc-2015.06/001-revert_register_mode_search.patch
> @@ -0,0 +1,65 @@
> +Revert of:
> +
> +commit 275035b56823b26d5fb7e90fad945b998648edf2
> +Author: bergner <bergner at 138bc75d-0d04-0410-961f-82ee72b054a4>
> +Date:   Thu Sep 5 14:09:07 2013 +0000
> +
> +        PR target/58139
> +        * reginfo.c (choose_hard_reg_mode): Scan through all mode classes
> +        looking for widest mode.
> +
> +
> +    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202286 138bc75d-0d04-0410-961f-82ee72b054a4
> +
> +
> +--- a/gcc/reginfo.c
> ++++ b/gcc/reginfo.c
> +@@ -620,35 +620,40 @@ choose_hard_reg_mode (unsigned int regno
> +        mode = GET_MODE_WIDER_MODE (mode))
> +     if ((unsigned) hard_regno_nregs[regno][mode] == nregs
> + 	&& HARD_REGNO_MODE_OK (regno, mode)
> +-	&& (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
> +-	&& GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
> ++	&& (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
> +       found_mode = mode;
> + 
> ++  if (found_mode != VOIDmode)
> ++    return found_mode;
> ++
> +   for (mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT);
> +        mode != VOIDmode;
> +        mode = GET_MODE_WIDER_MODE (mode))
> +     if ((unsigned) hard_regno_nregs[regno][mode] == nregs
> + 	&& HARD_REGNO_MODE_OK (regno, mode)
> +-	&& (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
> +-	&& GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
> ++	&& (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
> +       found_mode = mode;
> + 
> ++  if (found_mode != VOIDmode)
> ++    return found_mode;
> ++
> +   for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_FLOAT);
> +        mode != VOIDmode;
> +        mode = GET_MODE_WIDER_MODE (mode))
> +     if ((unsigned) hard_regno_nregs[regno][mode] == nregs
> + 	&& HARD_REGNO_MODE_OK (regno, mode)
> +-	&& (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
> +-	&& GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
> ++	&& (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
> +       found_mode = mode;
> + 
> ++  if (found_mode != VOIDmode)
> ++    return found_mode;
> ++
> +   for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_INT);
> +        mode != VOIDmode;
> +        mode = GET_MODE_WIDER_MODE (mode))
> +     if ((unsigned) hard_regno_nregs[regno][mode] == nregs
> + 	&& HARD_REGNO_MODE_OK (regno, mode)
> +-	&& (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
> +-	&& GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
> ++	&& (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
> +       found_mode = mode;
> + 
> +   if (found_mode != VOIDmode)
> diff --git a/toolchain/gcc/patches/arc-2015.06/002-weak_data_fix.patch b/toolchain/gcc/patches/arc-2015.06/002-weak_data_fix.patch
> new file mode 100644
> index 0000000..a740b4c
> --- /dev/null
> +++ b/toolchain/gcc/patches/arc-2015.06/002-weak_data_fix.patch
> @@ -0,0 +1,42 @@
> +--- /dev/null
> ++++ b/gcc/testsuite/gcc.dg/visibility-21.c
> +@@ -0,0 +1,14 @@
> ++/* PR target/32219 */
> ++/* { dg-do run } */
> ++/* { dg-require-visibility "" } */
> ++/* { dg-options "-fPIC" { target fpic } } */
> ++
> ++extern void f() __attribute__((weak,visibility("hidden")));
> ++extern int puts( char const* );
> ++int main()
> ++{
> ++	if (f)
> ++		f();
> ++	return 0;
> ++}
> ++
> +--- a/gcc/varasm.c
> ++++ b/gcc/varasm.c
> +@@ -6677,6 +6677,10 @@ default_binds_local_p_1 (const_tree exp,
> +   /* Static variables are always local.  */
> +   else if (! TREE_PUBLIC (exp))
> +     local_p = true;
> ++  /* hidden weak can't be overridden by something non-local, all
> ++     that is possible is that it is not defined at all. */
> ++  else if (DECL_WEAK (exp))
> ++    local_p = false;
> +   /* A variable is local if the user has said explicitly that it will
> +      be.  */
> +   else if ((DECL_VISIBILITY_SPECIFIED (exp)
> +@@ -6690,11 +6694,6 @@ default_binds_local_p_1 (const_tree exp,
> +      local.  */
> +   else if (DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT)
> +     local_p = true;
> +-  /* Default visibility weak data can be overridden by a strong symbol
> +-     in another module and so are not local.  */
> +-  else if (DECL_WEAK (exp)
> +-	   && !resolved_locally)
> +-    local_p = false;
> +   /* If PIC, then assume that any global name can be overridden by
> +      symbols resolved from other modules.  */
> +   else if (shlib)
> diff --git a/toolchain/gcc/patches/arc-2015.06/003-universal_initializer.patch b/toolchain/gcc/patches/arc-2015.06/003-universal_initializer.patch
> new file mode 100644
> index 0000000..1b9a5b3
> --- /dev/null
> +++ b/toolchain/gcc/patches/arc-2015.06/003-universal_initializer.patch
> @@ -0,0 +1,94 @@
> +--- a/gcc/c/c-typeck.c
> ++++ b/gcc/c/c-typeck.c
> +@@ -62,9 +62,9 @@ int in_typeof;
> +    if expr.original_code == SIZEOF_EXPR.  */
> + tree c_last_sizeof_arg;
> + 
> +-/* Nonzero if we've already printed a "missing braces around initializer"
> +-   message within this initializer.  */
> +-static int missing_braces_mentioned;
> ++/* Nonzero if we might need to print a "missing braces around
> ++   initializer" message within this initializer.  */
> ++static int found_missing_braces;
> + 
> + static int require_constant_value;
> + static int require_constant_elements;
> +@@ -6363,6 +6363,9 @@ static int constructor_nonconst;
> + /* 1 if this constructor is erroneous so far.  */
> + static int constructor_erroneous;
> + 
> ++/* 1 if this constructor is the universal zero initializer { 0 }.  */
> ++static int constructor_zeroinit;
> ++
> + /* Structure for managing pending initializer elements, organized as an
> +    AVL tree.  */
> + 
> +@@ -6524,7 +6527,7 @@ start_init (tree decl, tree asmspec_tree
> +   constructor_stack = 0;
> +   constructor_range_stack = 0;
> + 
> +-  missing_braces_mentioned = 0;
> ++  found_missing_braces = 0;
> + 
> +   spelling_base = 0;
> +   spelling_size = 0;
> +@@ -6619,6 +6622,7 @@ really_start_incremental_init (tree type
> +   constructor_type = type;
> +   constructor_incremental = 1;
> +   constructor_designated = 0;
> ++  constructor_zeroinit = 1;
> +   designator_depth = 0;
> +   designator_erroneous = 0;
> + 
> +@@ -6816,11 +6820,8 @@ push_init_level (int implicit, struct ob
> + 	set_nonincremental_init (braced_init_obstack);
> +     }
> + 
> +-  if (implicit == 1 && warn_missing_braces && !missing_braces_mentioned)
> +-    {
> +-      missing_braces_mentioned = 1;
> +-      warning_init (OPT_Wmissing_braces, "missing braces around initializer");
> +-    }
> ++  if (implicit == 1)
> ++    found_missing_braces = 1;
> + 
> +   if (TREE_CODE (constructor_type) == RECORD_TYPE
> + 	   || TREE_CODE (constructor_type) == UNION_TYPE)
> +@@ -6953,16 +6954,23 @@ pop_init_level (int implicit, struct obs
> + 	}
> +     }
> + 
> ++  if (vec_safe_length (constructor_elements) != 1)
> ++    constructor_zeroinit = 0;
> ++
> ++  /* Warn when some structs are initialized with direct aggregation.  */
> ++  if (!implicit && found_missing_braces && warn_missing_braces
> ++      && !constructor_zeroinit)
> ++    {
> ++      warning_init (OPT_Wmissing_braces,
> ++		    "missing braces around initializer");
> ++    }
> ++
> +   /* Warn when some struct elements are implicitly initialized to zero.  */
> +   if (warn_missing_field_initializers
> +       && constructor_type
> +       && TREE_CODE (constructor_type) == RECORD_TYPE
> +       && constructor_unfilled_fields)
> +     {
> +-	bool constructor_zeroinit =
> +-	 (vec_safe_length (constructor_elements) == 1
> +-	  && integer_zerop ((*constructor_elements)[0].value));
> +-
> + 	/* Do not warn for flexible array members or zero-length arrays.  */
> + 	while (constructor_unfilled_fields
> + 	       && (!DECL_SIZE (constructor_unfilled_fields)
> +@@ -8077,6 +8085,9 @@ process_init_element (struct c_expr valu
> +   designator_depth = 0;
> +   designator_erroneous = 0;
> + 
> ++  if (!implicit && value.value && !integer_zerop (value.value))
> ++    constructor_zeroinit = 0;
> ++
> +   /* Handle superfluous braces around string cst as in
> +      char x[] = {"foo"}; */
> +   if (string_flag
> diff --git a/toolchain/gcc/patches/arc-2015.06/004-case_insensitive.patch b/toolchain/gcc/patches/arc-2015.06/004-case_insensitive.patch
> new file mode 100644
> index 0000000..b3d2dbe
> --- /dev/null
> +++ b/toolchain/gcc/patches/arc-2015.06/004-case_insensitive.patch
> @@ -0,0 +1,14 @@
> +--- a/include/filenames.h
> ++++ b/include/filenames.h
> +@@ -43,11 +43,6 @@ extern "C" {
> + #  define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c)
> + #  define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f)
> + #else /* not DOSish */
> +-#  if defined(__APPLE__)
> +-#    ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM
> +-#      define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1
> +-#    endif
> +-#  endif /* __APPLE__ */
> + #  define HAS_DRIVE_SPEC(f) (0)
> + #  define IS_DIR_SEPARATOR(c) IS_UNIX_DIR_SEPARATOR (c)
> + #  define IS_ABSOLUTE_PATH(f) IS_UNIX_ABSOLUTE_PATH (f)
> diff --git a/toolchain/gcc/patches/arc-2015.06/010-documentation.patch b/toolchain/gcc/patches/arc-2015.06/010-documentation.patch
> new file mode 100644
> index 0000000..5548069
> --- /dev/null
> +++ b/toolchain/gcc/patches/arc-2015.06/010-documentation.patch
> @@ -0,0 +1,23 @@
> +--- a/gcc/Makefile.in
> ++++ b/gcc/Makefile.in
> +@@ -4327,18 +4327,10 @@ doc/gcc.info: $(TEXI_GCC_FILES)
> + doc/gccint.info: $(TEXI_GCCINT_FILES)
> + doc/cppinternals.info: $(TEXI_CPPINT_FILES)
> + 
> +-doc/%.info: %.texi
> +-	if [ x$(BUILD_INFO) = xinfo ]; then \
> +-		$(MAKEINFO) $(MAKEINFOFLAGS) -I . -I $(gcc_docdir) \
> +-			-I $(gcc_docdir)/include -o $@ $<; \
> +-	fi
> ++doc/%.info:
> + 
> + # Duplicate entry to handle renaming of gccinstall.info
> +-doc/gccinstall.info: $(TEXI_GCCINSTALL_FILES)
> +-	if [ x$(BUILD_INFO) = xinfo ]; then \
> +-		$(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
> +-			-I $(gcc_docdir)/include -o $@ $<; \
> +-	fi
> ++doc/gccinstall.info:
> + 
> + doc/cpp.dvi: $(TEXI_CPP_FILES)
> + doc/gcc.dvi: $(TEXI_GCC_FILES)
> diff --git a/toolchain/gcc/patches/arc-2015.06/020-no-plt-backport.patch b/toolchain/gcc/patches/arc-2015.06/020-no-plt-backport.patch
> new file mode 100644
> index 0000000..b225376
> --- /dev/null
> +++ b/toolchain/gcc/patches/arc-2015.06/020-no-plt-backport.patch
> @@ -0,0 +1,28 @@
> +--- a/gcc/calls.c
> ++++ b/gcc/calls.c
> +@@ -176,6 +176,12 @@ prepare_call_address (tree fndecl, rtx f
> + 	       && targetm.small_register_classes_for_mode_p (FUNCTION_MODE))
> + 	      ? force_not_mem (memory_address (FUNCTION_MODE, funexp))
> + 	      : memory_address (FUNCTION_MODE, funexp));
> ++  else if (flag_pic && !flag_plt && fndecl
> ++	   && TREE_CODE (fndecl) == FUNCTION_DECL
> ++	   && !targetm.binds_local_p (fndecl))
> ++    {
> ++      funexp = force_reg (Pmode, funexp);
> ++    }
> +   else if (! sibcallp)
> +     {
> + #ifndef NO_FUNCTION_CSE
> +--- a/gcc/common.opt
> ++++ b/gcc/common.opt
> +@@ -1617,6 +1617,10 @@ fpie
> + Common Report Var(flag_pie,1) Negative(fPIC)
> + Generate position-independent code for executables if possible (small mode)
> + 
> ++fplt
> ++Common Report Var(flag_plt) Init(1)
> ++Use PLT for PIC calls (-fno-plt: load the address from GOT at call site)
> ++
> + fplugin=
> + Common Joined RejectNegative Var(common_deferred_options) Defer
> + Specify a plugin to load
> diff --git a/toolchain/gcc/patches/arc-2015.06/100-uclibc-conf.patch b/toolchain/gcc/patches/arc-2015.06/100-uclibc-conf.patch
> new file mode 100644
> index 0000000..ff9ad94
> --- /dev/null
> +++ b/toolchain/gcc/patches/arc-2015.06/100-uclibc-conf.patch
> @@ -0,0 +1,33 @@
> +--- a/contrib/regression/objs-gcc.sh
> ++++ b/contrib/regression/objs-gcc.sh
> +@@ -106,6 +106,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H
> +  then
> +   make all-gdb all-dejagnu all-ld || exit 1
> +   make install-gdb install-dejagnu install-ld || exit 1
> ++elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
> ++ then
> ++  make all-gdb all-dejagnu all-ld || exit 1
> ++  make install-gdb install-dejagnu install-ld || exit 1
> + elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
> +   make bootstrap || exit 1
> +   make install || exit 1
> +--- a/libjava/classpath/ltconfig
> ++++ b/libjava/classpath/ltconfig
> +@@ -603,7 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-
> + 
> + # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
> + case $host_os in
> +-linux-gnu*) ;;
> ++linux-gnu*|linux-uclibc*) ;;
> + linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
> + esac
> + 
> +@@ -1247,7 +1247,7 @@ linux-gnuoldld* | linux-gnuaout* | linux
> +   ;;
> + 
> + # This must be Linux ELF.
> +-linux-gnu*)
> ++linux*)
> +   version_type=linux
> +   need_lib_prefix=no
> +   need_version=no
> diff --git a/toolchain/gcc/patches/arc-2015.06/210-disable_libsanitizer_off_t_check.patch b/toolchain/gcc/patches/arc-2015.06/210-disable_libsanitizer_off_t_check.patch
> new file mode 100644
> index 0000000..5608469
> --- /dev/null
> +++ b/toolchain/gcc/patches/arc-2015.06/210-disable_libsanitizer_off_t_check.patch
> @@ -0,0 +1,11 @@
> +--- a/libsanitizer/interception/interception_type_test.cc
> ++++ b/libsanitizer/interception/interception_type_test.cc
> +@@ -31,7 +31,7 @@ COMPILER_CHECK(sizeof(OFF64_T) == sizeof
> + // rest (they depend on _FILE_OFFSET_BITS setting when building an application).
> + # if defined(__ANDROID__) || !defined _FILE_OFFSET_BITS || \
> +   _FILE_OFFSET_BITS != 64
> +-COMPILER_CHECK(sizeof(OFF_T) == sizeof(off_t));
> ++// COMPILER_CHECK(sizeof(OFF_T) == sizeof(off_t));
> + # endif
> + 
> + #endif
> diff --git a/toolchain/gcc/patches/arc-2015.06/800-arc-disablelibgmon.patch b/toolchain/gcc/patches/arc-2015.06/800-arc-disablelibgmon.patch
> new file mode 100644
> index 0000000..612883c
> --- /dev/null
> +++ b/toolchain/gcc/patches/arc-2015.06/800-arc-disablelibgmon.patch
> @@ -0,0 +1,18 @@
> +diff --git a/libgcc/config.host b/libgcc/config.host
> +index e768389..aec10c7 100644
> +--- a/libgcc/config.host
> ++++ b/libgcc/config.host
> +@@ -320,11 +320,11 @@ alpha*-dec-*vms*)
> + 	;;
> + arc*-*-elf*)
> + 	tmake_file="arc/t-arc-newlib arc/t-arc"
> +-	extra_parts="crti.o crtn.o crtend.o crtbegin.o crtendS.o crtbeginS.o libgmon.a crtg.o crtgend.o crttls_r25.o crttls_r30.o"
> ++	extra_parts="crti.o crtn.o crtend.o crtbegin.o crtendS.o crtbeginS.o crtg.o crtgend.o crttls_r25.o crttls_r30.o"
> + 	;;
> + arc*-*-linux-uclibc*)
> + 	tmake_file="${tmake_file} t-slibgcc-libgcc t-slibgcc-nolc-override arc/t-arc700-uClibc arc/t-arc"
> +-	extra_parts="crti.o crtn.o crtend.o crtbegin.o crtendS.o crtbeginS.o libgmon.a crtg.o crtgend.o"
> ++	extra_parts="crti.o crtn.o crtend.o crtbegin.o crtendS.o crtbeginS.o crtg.o crtgend.o"
> + 	;;
> + arm-wrs-vxworks)
> + 	tmake_file="$tmake_file arm/t-arm arm/t-vxworks t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp"
> diff --git a/toolchain/gcc/patches/arc-2015.06/820-libgcc_pic.patch b/toolchain/gcc/patches/arc-2015.06/820-libgcc_pic.patch
> new file mode 100644
> index 0000000..7a0ac73
> --- /dev/null
> +++ b/toolchain/gcc/patches/arc-2015.06/820-libgcc_pic.patch
> @@ -0,0 +1,36 @@
> +--- a/libgcc/Makefile.in
> ++++ b/libgcc/Makefile.in
> +@@ -865,11 +865,12 @@ $(libgcov-objects): %$(objext): $(srcdir
> + 
> + # Static libraries.
> + libgcc.a: $(libgcc-objects)
> ++libgcc_pic.a: $(libgcc-s-objects)
> + libgcov.a: $(libgcov-objects)
> + libunwind.a: $(libunwind-objects)
> + libgcc_eh.a: $(libgcc-eh-objects)
> + 
> +-libgcc.a libgcov.a libunwind.a libgcc_eh.a:
> ++libgcc.a libgcov.a libunwind.a libgcc_eh.a libgcc_pic.a:
> + 	-rm -f $@
> + 
> + 	objects="$(objects)";					\
> +@@ -891,7 +892,7 @@ libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_E
> + endif
> + 
> + ifeq ($(enable_shared),yes)
> +-all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
> ++all: libgcc_eh.a libgcc_pic.a libgcc_s$(SHLIB_EXT)
> + ifneq ($(LIBUNWIND),)
> + all: libunwind$(SHLIB_EXT)
> + endif
> +@@ -1058,6 +1059,10 @@ install-shared:
> + 	chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
> + 	$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
> + 
> ++	$(INSTALL_DATA) libgcc_pic.a $(mapfile) $(DESTDIR)$(inst_libdir)/
> ++	chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_pic.a
> ++	$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_pic.a
> ++
> + 	$(subst @multilib_dir@,$(MULTIDIR),$(subst \
> + 		@shlib_base_name@,libgcc_s,$(subst \
> + 		@shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
> diff --git a/toolchain/gcc/patches/arc-2015.06/850-use_shared_libgcc.patch b/toolchain/gcc/patches/arc-2015.06/850-use_shared_libgcc.patch
> new file mode 100644
> index 0000000..6934bc9
> --- /dev/null
> +++ b/toolchain/gcc/patches/arc-2015.06/850-use_shared_libgcc.patch
> @@ -0,0 +1,47 @@
> +--- a/gcc/config/arm/linux-eabi.h
> ++++ b/gcc/config/arm/linux-eabi.h
> +@@ -131,10 +131,6 @@
> + #define ENDFILE_SPEC \
> +   LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC)
> + 
> +-/* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we
> +-   do not use -lfloat.  */
> +-#undef LIBGCC_SPEC
> +-
> + /* Clear the instruction cache from `beg' to `end'.  This is
> +    implemented in lib1funcs.S, so ensure an error if this definition
> +    is used.  */
> +--- a/gcc/config/linux.h
> ++++ b/gcc/config/linux.h
> +@@ -51,6 +51,10 @@ see the files COPYING3 and COPYING.RUNTI
> + 	builtin_assert ("system=posix");			\
> +     } while (0)
> + 
> ++#ifndef LIBGCC_SPEC
> ++#define LIBGCC_SPEC "%{static|static-libgcc:-lgcc}%{!static:%{!static-libgcc:-lgcc_s}}"
> ++#endif
> ++
> + /* Determine which dynamic linker to use depending on whether GLIBC or
> +    uClibc or Bionic is the default C library and whether
> +    -muclibc or -mglibc or -mbionic has been passed to change the default.  */
> +--- a/libgcc/mkmap-symver.awk
> ++++ b/libgcc/mkmap-symver.awk
> +@@ -132,5 +132,5 @@ function output(lib) {
> +   else if (inherit[lib])
> +     printf("} %s;\n", inherit[lib]);
> +   else
> +-    printf ("\n  local:\n\t*;\n};\n");
> ++    printf ("\n\t*;\n};\n");
> + }
> +--- a/gcc/config/rs6000/linux.h
> ++++ b/gcc/config/rs6000/linux.h
> +@@ -61,6 +61,9 @@
> + #undef  CPLUSPLUS_CPP_SPEC
> + #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
> + 
> ++#undef LIBGCC_SPEC
> ++#define LIBGCC_SPEC "%{!static:%{!static-libgcc:-lgcc_s}} -lgcc"
> ++
> + #undef  LINK_SHLIB_SPEC
> + #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
> + 
> diff --git a/toolchain/gcc/patches/arc-2015.06/851-libgcc_no_compat.patch b/toolchain/gcc/patches/arc-2015.06/851-libgcc_no_compat.patch
> new file mode 100644
> index 0000000..80c3476
> --- /dev/null
> +++ b/toolchain/gcc/patches/arc-2015.06/851-libgcc_no_compat.patch
> @@ -0,0 +1,12 @@
> +--- a/libgcc/config/t-libunwind
> ++++ b/libgcc/config/t-libunwind
> +@@ -2,8 +2,7 @@
> + 
> + HOST_LIBGCC2_CFLAGS += -DUSE_GAS_SYMVER
> + 
> +-LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \
> +-  $(srcdir)/unwind-compat.c $(srcdir)/unwind-dw2-fde-compat.c
> ++LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
> + LIB2ADDEHSTATIC = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
> + 
> + # Override the default value from t-slibgcc-elf-ver and mention -lunwind
> diff --git a/toolchain/gcc/patches/arc-2015.06/860-use_eh_frame.patch b/toolchain/gcc/patches/arc-2015.06/860-use_eh_frame.patch
> new file mode 100644
> index 0000000..1ac83fe
> --- /dev/null
> +++ b/toolchain/gcc/patches/arc-2015.06/860-use_eh_frame.patch
> @@ -0,0 +1,42 @@
> +--- a/libgcc/unwind-dw2-fde-dip.c
> ++++ b/libgcc/unwind-dw2-fde-dip.c
> +@@ -46,33 +46,13 @@
> + #include "unwind-compat.h"
> + #include "gthr.h"
> + 
> +-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
> +-    && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
> +-	|| (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
> +-# define USE_PT_GNU_EH_FRAME
> +-#endif
> +-
> +-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
> +-    && defined(__BIONIC__)
> +-# define USE_PT_GNU_EH_FRAME
> +-#endif
> +-
> +-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
> +-    && defined(__FreeBSD__) && __FreeBSD__ >= 7
> +-# define ElfW __ElfN
> +-# define USE_PT_GNU_EH_FRAME
> +-#endif
> +-
> +-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
> +-    && defined(__OpenBSD__)
> +-# define ElfW(type) Elf_##type
> +-# define USE_PT_GNU_EH_FRAME
> +-#endif
> +-
> +-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
> +-    && defined(TARGET_DL_ITERATE_PHDR) \
> +-    && defined(__sun__) && defined(__svr4__)
> ++#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR)
> + # define USE_PT_GNU_EH_FRAME
> ++# ifdef __OpenBSD__
> ++#  define ElfW(type) Elf_##type
> ++# elif defined(__FreeBSD__) && __FreeBSD__ >= 7
> ++#  define ElfW __ElfN
> ++# endif
> + #endif
> + 
> + #if defined(USE_PT_GNU_EH_FRAME)
> diff --git a/toolchain/gcc/patches/arc-2015.06/870-ppc_no_crtsavres.patch b/toolchain/gcc/patches/arc-2015.06/870-ppc_no_crtsavres.patch
> new file mode 100644
> index 0000000..4b7fcbd
> --- /dev/null
> +++ b/toolchain/gcc/patches/arc-2015.06/870-ppc_no_crtsavres.patch
> @@ -0,0 +1,11 @@
> +--- a/gcc/config/rs6000/rs6000.c
> ++++ b/gcc/config/rs6000/rs6000.c
> +@@ -17662,7 +17662,7 @@ rs6000_savres_strategy (rs6000_stack_t *
> +   /* Define cutoff for using out-of-line functions to save registers.  */
> +   if (DEFAULT_ABI == ABI_V4 || TARGET_ELF)
> +     {
> +-      if (!optimize_size)
> ++      if (1)
> + 	{
> + 	  strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS;
> + 	  strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;
> diff --git a/toolchain/gcc/patches/arc-2015.06/880-no_java_section.patch b/toolchain/gcc/patches/arc-2015.06/880-no_java_section.patch
> new file mode 100644
> index 0000000..def6c9f
> --- /dev/null
> +++ b/toolchain/gcc/patches/arc-2015.06/880-no_java_section.patch
> @@ -0,0 +1,11 @@
> +--- a/gcc/defaults.h
> ++++ b/gcc/defaults.h
> +@@ -380,7 +380,7 @@ see the files COPYING3 and COPYING.RUNTI
> + /* If we have named section and we support weak symbols, then use the
> +    .jcr section for recording java classes which need to be registered
> +    at program start-up time.  */
> +-#if defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
> ++#if 0 && defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
> + #ifndef JCR_SECTION_NAME
> + #define JCR_SECTION_NAME ".jcr"
> + #endif
> diff --git a/toolchain/gcc/patches/arc-2015.06/910-mbsd_multi.patch b/toolchain/gcc/patches/arc-2015.06/910-mbsd_multi.patch
> new file mode 100644
> index 0000000..5387f8e
> --- /dev/null
> +++ b/toolchain/gcc/patches/arc-2015.06/910-mbsd_multi.patch
> @@ -0,0 +1,253 @@
> +
> +	This patch brings over a few features from MirBSD:
> +	* -fhonour-copts
> +	  If this option is not given, it's warned (depending
> +	  on environment variables). This is to catch errors
> +	  of misbuilt packages which override CFLAGS themselves.
> +	* -Werror-maybe-reset
> +	  Has the effect of -Wno-error if GCC_NO_WERROR is
> +	  set and not '0', a no-operation otherwise. This is
> +	  to be able to use -Werror in "make" but prevent
> +	  GNU autoconf generated configure scripts from
> +	  freaking out.
> +	* Make -fno-strict-aliasing and -fno-delete-null-pointer-checks
> +	  the default for -O2/-Os, because they trigger gcc bugs
> +	  and can delete code with security implications.
> +
> +	This patch was authored by Thorsten Glaser <tg at mirbsd.de>
> +	with copyright assignment to the FSF in effect.
> +
> +--- a/gcc/c-family/c-opts.c
> ++++ b/gcc/c-family/c-opts.c
> +@@ -104,6 +104,9 @@ static size_t include_cursor;
> + /* Whether any standard preincluded header has been preincluded.  */
> + static bool done_preinclude;
> + 
> ++/* Check if a port honours COPTS.  */
> ++static int honour_copts = 0;
> ++
> + static void handle_OPT_d (const char *);
> + static void set_std_cxx98 (int);
> + static void set_std_cxx11 (int);
> +@@ -383,6 +386,9 @@ c_common_handle_option (size_t scode, co
> +       cpp_opts->warn_endif_labels = value;
> +       break;
> + 
> ++    case OPT_Werror_maybe_reset:
> ++      break;
> ++
> +     case OPT_Winvalid_pch:
> +       cpp_opts->warn_invalid_pch = value;
> +       break;
> +@@ -491,6 +497,12 @@ c_common_handle_option (size_t scode, co
> +       flag_no_builtin = !value;
> +       break;
> + 
> ++    case OPT_fhonour_copts:
> ++      if (c_language == clk_c) {
> ++        honour_copts++;
> ++      }
> ++      break;
> ++
> +     case OPT_fconstant_string_class_:
> +       constant_string_class_name = arg;
> +       break;
> +@@ -1027,6 +1039,47 @@ c_common_init (void)
> +       return false;
> +     }
> + 
> ++  if (c_language == clk_c) {
> ++    char *ev = getenv ("GCC_HONOUR_COPTS");
> ++    int evv;
> ++    if (ev == NULL)
> ++      evv = -1;
> ++    else if ((*ev == '0') || (*ev == '\0'))
> ++      evv = 0;
> ++    else if (*ev == '1')
> ++      evv = 1;
> ++    else if (*ev == '2')
> ++      evv = 2;
> ++    else if (*ev == 's')
> ++      evv = -1;
> ++    else {
> ++      warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1");
> ++      evv = 1; /* maybe depend this on something like MIRBSD_NATIVE?  */
> ++    }
> ++    if (evv == 1) {
> ++      if (honour_copts == 0) {
> ++        error ("someone does not honour COPTS at all in lenient mode");
> ++        return false;
> ++      } else if (honour_copts != 1) {
> ++        warning (0, "someone does not honour COPTS correctly, passed %d times",
> ++         honour_copts);
> ++      }
> ++    } else if (evv == 2) {
> ++      if (honour_copts == 0) {
> ++        error ("someone does not honour COPTS at all in strict mode");
> ++        return false;
> ++      } else if (honour_copts != 1) {
> ++        error ("someone does not honour COPTS correctly, passed %d times",
> ++         honour_copts);
> ++        return false;
> ++      }
> ++    } else if (evv == 0) {
> ++      if (honour_copts != 1)
> ++        inform (0, "someone does not honour COPTS correctly, passed %d times",
> ++         honour_copts);
> ++    }
> ++  }
> ++
> +   return true;
> + }
> + 
> +--- a/gcc/c-family/c.opt
> ++++ b/gcc/c-family/c.opt
> +@@ -379,6 +379,10 @@ Werror-implicit-function-declaration
> + C ObjC RejectNegative Warning Alias(Werror=, implicit-function-declaration)
> + This switch is deprecated; use -Werror=implicit-function-declaration instead
> + 
> ++Werror-maybe-reset
> ++C ObjC C++ ObjC++
> ++; Documented in common.opt
> ++
> + Wfloat-equal
> + C ObjC C++ ObjC++ Var(warn_float_equal) Warning
> + Warn if testing floating point numbers for equality
> +@@ -949,6 +953,9 @@ C++ ObjC++ Optimization Alias(fexception
> + fhonor-std
> + C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
> + 
> ++fhonour-copts
> ++C ObjC C++ ObjC++ RejectNegative
> ++
> + fhosted
> + C ObjC
> + Assume normal C execution environment
> +--- a/gcc/common.opt
> ++++ b/gcc/common.opt
> +@@ -541,6 +541,10 @@ Werror=
> + Common Joined
> + Treat specified warning as error
> + 
> ++Werror-maybe-reset
> ++Common
> ++If environment variable GCC_NO_WERROR is set, act as -Wno-error
> ++
> + Wextra
> + Common Var(extra_warnings) Warning
> + Print extra (possibly unwanted) warnings
> +@@ -1242,6 +1246,9 @@ fguess-branch-probability
> + Common Report Var(flag_guess_branch_prob) Optimization
> + Enable guessing of branch probabilities
> + 
> ++fhonour-copts
> ++Common RejectNegative
> ++
> + ; Nonzero means ignore `#ident' directives.  0 means handle them.
> + ; Generate position-independent code for executables if possible
> + ; On SVR4 targets, it also controls whether or not to emit a
> +--- a/gcc/opts.c
> ++++ b/gcc/opts.c
> +@@ -468,8 +468,6 @@ static const struct default_options defa
> +     { OPT_LEVELS_2_PLUS, OPT_fschedule_insns2, NULL, 1 },
> + #endif
> +     { OPT_LEVELS_2_PLUS, OPT_fregmove, NULL, 1 },
> +-    { OPT_LEVELS_2_PLUS, OPT_fstrict_aliasing, NULL, 1 },
> +-    { OPT_LEVELS_2_PLUS, OPT_fstrict_overflow, NULL, 1 },
> +     { OPT_LEVELS_2_PLUS, OPT_freorder_blocks, NULL, 1 },
> +     { OPT_LEVELS_2_PLUS, OPT_freorder_functions, NULL, 1 },
> +     { OPT_LEVELS_2_PLUS, OPT_ftree_vrp, NULL, 1 },
> +@@ -489,6 +487,8 @@ static const struct default_options defa
> +     { OPT_LEVELS_2_PLUS, OPT_fhoist_adjacent_loads, NULL, 1 },
> + 
> +     /* -O3 optimizations.  */
> ++    { OPT_LEVELS_3_PLUS, OPT_fstrict_aliasing, NULL, 1 },
> ++    { OPT_LEVELS_3_PLUS, OPT_fstrict_overflow, NULL, 1 },
> +     { OPT_LEVELS_3_PLUS, OPT_ftree_loop_distribute_patterns, NULL, 1 },
> +     { OPT_LEVELS_3_PLUS, OPT_fpredictive_commoning, NULL, 1 },
> +     /* Inlining of functions reducing size is a good idea with -Os
> +@@ -1435,6 +1435,17 @@ common_handle_option (struct gcc_options
> + 			       opts, opts_set, loc, dc);
> +       break;
> + 
> ++    case OPT_Werror_maybe_reset:
> ++      {
> ++        char *ev = getenv ("GCC_NO_WERROR");
> ++        if ((ev != NULL) && (*ev != '0'))
> ++          warnings_are_errors = 0;
> ++      }
> ++      break;
> ++
> ++    case OPT_fhonour_copts:
> ++      break;
> ++
> +     case OPT_Wlarger_than_:
> +       opts->x_larger_than_size = value;
> +       opts->x_warn_larger_than = value != -1;
> +--- a/gcc/doc/cppopts.texi
> ++++ b/gcc/doc/cppopts.texi
> +@@ -163,6 +163,11 @@ in older programs.  This warning is on b
> + Make all warnings into hard errors.  Source code which triggers warnings
> + will be rejected.
> + 
> ++ at item -Werror-maybe-reset
> ++ at opindex Werror-maybe-reset
> ++Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
> ++variable is set to anything other than 0 or empty.
> ++
> + @item -Wsystem-headers
> + @opindex Wsystem-headers
> + Issue warnings for code in system headers.  These are normally unhelpful
> +--- a/gcc/doc/invoke.texi
> ++++ b/gcc/doc/invoke.texi
> +@@ -240,7 +240,7 @@ Objective-C and Objective-C++ Dialects}.
> + -Wconversion  -Wcoverage-mismatch  -Wno-cpp  -Wno-deprecated  @gol
> + -Wno-deprecated-declarations -Wdisabled-optimization  @gol
> + -Wno-div-by-zero -Wdouble-promotion -Wempty-body  -Wenum-compare @gol
> +--Wno-endif-labels -Werror  -Werror=* @gol
> ++-Wno-endif-labels -Werror  -Werror=* -Werror-maybe-reset @gol
> + -Wfatal-errors  -Wfloat-equal  -Wformat  -Wformat=2 @gol
> + -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
> + -Wformat-security  -Wformat-y2k @gol
> +@@ -4817,6 +4817,22 @@ This option is only supported for C and 
> + @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
> + @option{-Wno-pointer-sign}.
> + 
> ++ at item -Werror-maybe-reset
> ++ at opindex Werror-maybe-reset
> ++Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
> ++variable is set to anything other than 0 or empty.
> ++
> ++ at item -fhonour-copts
> ++ at opindex fhonour-copts
> ++If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not
> ++given at least once, and warn if it is given more than once.
> ++If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not
> ++given exactly once.
> ++If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option
> ++is not given exactly once.
> ++The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}.
> ++This flag and environment variable only affect the C language.
> ++
> + @item -Wstack-protector
> + @opindex Wstack-protector
> + @opindex Wno-stack-protector
> +@@ -6928,7 +6944,7 @@ so, the first branch is redirected to ei
> + second branch or a point immediately following it, depending on whether
> + the condition is known to be true or false.
> + 
> +-Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
> ++Enabled at levels @option{-O3}.
> + 
> + @item -fsplit-wide-types
> + @opindex fsplit-wide-types
> +--- a/gcc/java/jvspec.c
> ++++ b/gcc/java/jvspec.c
> +@@ -626,6 +626,7 @@ lang_specific_pre_link (void)
> +      class name.  Append dummy `.c' that can be stripped by set_input so %b
> +      is correct.  */ 
> +   set_input (concat (main_class_name, "main.c", NULL));
> ++  putenv ("GCC_HONOUR_COPTS=s"); /* XXX hack!  */
> +   err = do_spec (jvgenmain_spec);
> +   if (err == 0)
> +     {
> diff --git a/toolchain/gcc/patches/arc-2015.06/920-specs_nonfatal_getenv.patch b/toolchain/gcc/patches/arc-2015.06/920-specs_nonfatal_getenv.patch
> new file mode 100644
> index 0000000..09768f5
> --- /dev/null
> +++ b/toolchain/gcc/patches/arc-2015.06/920-specs_nonfatal_getenv.patch
> @@ -0,0 +1,14 @@
> +--- a/gcc/gcc.c
> ++++ b/gcc/gcc.c
> +@@ -8029,7 +8029,10 @@ getenv_spec_function (int argc, const ch
> + 
> +   value = getenv (argv[0]);
> +   if (!value)
> +-    fatal_error ("environment variable %qs not defined", argv[0]);
> ++    {
> ++      warning (0, "environment variable %qs not defined", argv[0]);
> ++      value = "";
> ++    }
> + 
> +   /* We have to escape every character of the environment variable so
> +      they are not interpreted as active spec characters.  A
> diff --git a/toolchain/gcc/patches/arc-2015.06/940-no-clobber-stamp-bits.patch b/toolchain/gcc/patches/arc-2015.06/940-no-clobber-stamp-bits.patch
> new file mode 100644
> index 0000000..dbecef2
> --- /dev/null
> +++ b/toolchain/gcc/patches/arc-2015.06/940-no-clobber-stamp-bits.patch
> @@ -0,0 +1,11 @@
> +--- a/libstdc++-v3/include/Makefile.in
> ++++ b/libstdc++-v3/include/Makefile.in
> +@@ -1342,7 +1342,7 @@
> + 	@$(STAMP) stamp-bits
> + 
> + stamp-bits-sup: stamp-bits ${bits_sup_headers}
> +-	@-cd ${bits_builddir} && $(LN_S) $? . 2>/dev/null
> ++	@-cd ${bits_builddir} && $(LN_S) $(filter-out stamp-bits,$?) . 2>/dev/null
> + 	@$(STAMP) stamp-bits-sup
> + 
> + stamp-c_base: ${c_base_headers}
> diff --git a/toolchain/gdb/Makefile b/toolchain/gdb/Makefile
> index fa5179a..8b848c2 100644
> --- a/toolchain/gdb/Makefile
> +++ b/toolchain/gdb/Makefile
> @@ -7,11 +7,24 @@
>  include $(TOPDIR)/rules.mk
>  
>  PKG_NAME:=gdb
> +
> +ifeq ($(CONFIG_arc),y)
> +PKG_VERSION:=arc-2015.06-gdb
> +
> +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
> +PKG_SOURCE_URL:=https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/archive/arc-2015.06-gdb/
> +PKG_MD5SUM:=d318829bfd2ed62714817f0d25706825
> +GDB_DIR:=binutils-$(PKG_NAME)-$(PKG_VERSION)
> +else
>  PKG_VERSION:=7.8
>  
>  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
>  PKG_SOURCE_URL:=@GNU/gdb
>  PKG_MD5SUM:=bd958fe9019d7c7896f29f6724a764ed
> +GDB_DIR:=$(PKG_NAME)-$(PKG_VERSION)
> +endif
> +
> +HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(GDB_DIR)
>  
>  HOST_BUILD_PARALLEL:=1
>  
> @@ -30,7 +43,11 @@ HOST_CONFIGURE_ARGS = \
>  	--disable-tui --disable-gdbtk --without-x \
>  	--without-included-gettext \
>  	--enable-threads \
> -	--with-expat
> +	--with-expat \
> +	--disable-binutils \
> +	--disable-ld \
> +	--disable-gas \
> +	--disable-sim
>  
>  define Host/Install
>  	mkdir -p $(TOOLCHAIN_DIR)/bin
> diff --git a/toolchain/uClibc/Config.in b/toolchain/uClibc/Config.in
> index c923bc0..27215b6 100644
> --- a/toolchain/uClibc/Config.in
> +++ b/toolchain/uClibc/Config.in
> @@ -3,6 +3,7 @@
>  choice
>  	prompt "uClibc Version"
>  	depends on TOOLCHAINOPTS && USE_UCLIBC
> +	default UCLIBC_USE_VERSION_NG if arc
>  	default UCLIBC_USE_VERSION_0_9_33
>  	help
>  	  Select the version of uClibc you wish to use.
> @@ -10,6 +11,7 @@ choice
>  	config UCLIBC_USE_VERSION_0_9_33
>  		select UCLIBC_VERSION_0_9_33
>  		bool "uClibc 0.9.33.2"
> +		depends on !arc
>  
>  	config UCLIBC_USE_VERSION_NG
>  		select UCLIBC_VERSION_NG
> diff --git a/toolchain/uClibc/Config.version b/toolchain/uClibc/Config.version
> index b6aa471..3ecd584 100644
> --- a/toolchain/uClibc/Config.version
> +++ b/toolchain/uClibc/Config.version
> @@ -6,8 +6,9 @@ config UCLIBC_VERSION
>  	default "0.9.33.2"
>  
>  config UCLIBC_VERSION_0_9_33
> -	default y if !TOOLCHAINOPTS && USE_UCLIBC
> +	default y if !TOOLCHAINOPTS && USE_UCLIBC && !arc
>  	bool
>  
>  config UCLIBC_VERSION_NG
> +	default y if !TOOLCHAINOPTS && USE_UCLIBC && arc
>  	bool
> diff --git a/toolchain/uClibc/common.mk b/toolchain/uClibc/common.mk
> index 026d69d..273e477 100644
> --- a/toolchain/uClibc/common.mk
> +++ b/toolchain/uClibc/common.mk
> @@ -32,6 +32,7 @@ HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)-$(PKG_VERSION)
>  include $(INCLUDE_DIR)/toolchain-build.mk
>  
>  UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \
> +		-e 's/arc.*/arc/' \
>  		-e 's/i.86/i386/' \
>  		-e 's/sparc.*/sparc/' \
>  		-e 's/arm.*/arm/g' \
> diff --git a/toolchain/uClibc/config-ng-1.0.6/arc b/toolchain/uClibc/config-ng-1.0.6/arc
> new file mode 100644
> index 0000000..7fb83f7
> --- /dev/null
> +++ b/toolchain/uClibc/config-ng-1.0.6/arc
> @@ -0,0 +1,12 @@
> +ARCH_ANY_ENDIAN=y
> +ARCH_LITTLE_ENDIAN=y
> +ARCH_WANTS_LITTLE_ENDIAN=y
> +# COMPILE_IN_THUMB_MODE is not set
> +TARGET_ARCH="arc"
> +TARGET_arc=y
> +CONFIG_ARC_CPU_700=y
> +# CONFIG_ARC_CPU_HS is not set
> +CONFIG_ARC_PAGE_SIZE_8K=y
> +# CONFIG_ARC_PAGE_SIZE_16K is not set
> +# CONFIG_ARC_PAGE_SIZE_4K is not set
> +
> 
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list