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

Jonas Gorski jogo at openwrt.org
Wed Sep 2 04:08:49 EDT 2015


Hi,

On Thu, Aug 27, 2015 at 1:03 PM, Alexey Brodkin
<Alexey.Brodkin at synopsys.com> 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)

One of BINUTILS_VERSION_ARC and BINUTILS_VERSION_LINARO will always be
set regardless of TOOLCHAINOPTS being set, so you can drop the || ( )
part.

> 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)

Any reason why ifeq($(CONFIG_BINUTILS_VERSION),arc) directly doesn't work?

> +       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

Can we call this "4.8-arc" just like the others?

>         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

Jonas
_______________________________________________
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