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

Alexey Brodkin Alexey.Brodkin at synopsys.com
Thu Sep 3 10:19:07 EDT 2015


Hi Jonas,

On Thu, 2015-09-03 at 15:18 +0200, Jonas Gorski wrote:
> Hi,
> 
> On Wed, Sep 2, 2015 at 9:58 PM, Alexey Brodkin
> <Alexey.Brodkin at synopsys.com> wrote:
> > Hi Jonas,
> > 
> > On Wed, 2015-09-02 at 10:08 +0200, Jonas Gorski wrote:
> > > 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
> > > > 
> > 
> > [snip]
> > 
> > > > 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.
> > 
> > Well that's not entirely correct.
> > If TOOLCHAIN is not set then BINUTILS_VERSION_xxx won't be set as well.
> > In other words following construction will lead to missing BINUTILS_VERSION
> > in .config:
> > ------------------------>8------------------------
> > default "linaro"          if BINUTILS_VERSION_LINARO || (!TOOLCHAINOPTS && !arc)
> > default "arc"             if BINUTILS_VERSION_ARC || (!TOOLCHAINOPTS && arc)
> > ------------------------>8------------------------
> > 
> > Following construction will work:
> > ------------------------>8------------------------
> > default "linaro"          if !arc
> > default "arc"             if arc
> > ------------------------>8------------------------
> > 
> > But then this thing "prompt "Binutils Version" if TOOLCHAINOPTS" makes no sense
> > because we force set ARC binutils for ARC and Linaro binutils for anything else.
> > 
> > Well even now that prompt is useless because it doesn't allow to choose anything
> > except Linaro :)
> 
> This looks like a bug in kconfig; the symbols shouldn't just vanish
> just because the choice isn't visible. Since this isn't obvious to fix
> (at least I couldn't find a way at a first glance), I'd rather mirror
> how we worked around if for the GCC version selection, so use
> something like
> 
> choice
>        prompt "Binutils Version" if TOOLCHAINOPTS
>        default BINUTILS_USE_VERSION_LINARO if !arc
>        default BINUTILS_USE_VERSION_ARC if arc
> 
>        config BINUTILS_USE_VERSION_LINARO
>                 bool "Linaro binutils 2.24"
>                 select BINUTILS_VERSION_LINARO
> 
>        config BINUTILS_USE_VERSION_LINARO
>                 bool "ARC binutils 2015.06"
>                 select BINUTILS_VERSION_ARC
> 
> endchoice
> ...
> config BINUTILS_VERSION_LINARO
>        default y if !TOOLCHAINOPTS && !arc
> 
> config BINUTILS_VERSION_ARC
>        default y if !TOOLCHAINOPTS && arc
> 
> 
> Btw, does your ARC binutils version have any upstream/vanilla binutils
> version equivalence? That might be more interesting than the "date"
> release version.

Currently we have our port is based on upstream v2.23 but now we have completely
written from scratch port in works so for some time we'll stay with 2.23-based
thing only applying critical changes on top of it.

Still we cut releases of our toolchain every couple of months and to make life
of our users easier we name all components of toolchain with the same prefix.
That's how we got binutils tag name "arc-2015.06".

In other words for now - until we're not in upstream binutils, gcc & gdb
we'll continue to cut releases with date-line names.

Hope that's acceptable fine for OpenWRT.

> > > > 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?
> > 
> > Well it's possible to do that this way but it requires quotes word we're comparing to.
> > So following string will work:
> > ------------------------>8------------------------
> > ifeq ($(CONFIG_BINUTILS_VERSION),"arc")
> > ------------------------>8------------------------
> > 
> > That's because version we set in Config in is quoted as well.
> > 
> > Still if we do search of "arc" substring it will work even if we change binutils
> > version string to match gcc's pattern like "arc-2015.06" etc.
> > So I wanted to implement a sort of universal approach.
> 
> And then we get a sparc-binutils version and everything breaks apart ;P

I may agree that proper implementation should have been " arc ".
That shielded with spaces search item won't false
trigger on either aarch64, sparc etc.

> If we ever would want to support more than one binutils version, then
> I'd rather do it like the gcc selection, so keep the
> arc/linaro/vanilla fork separate from the release version.

I thought about making binutils' Config.mk to look similar to gcc's one but
wanted to make smaller changes.

Now I see that it's better to re-write binutils' Config.mk so I will do it.

> > 
> > If you think that explanation above makes not much sense I will
> > rework it.
> > 
> > > >  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?
> > 
> > I'm afraid not. Because we use that name later to reconstruct the a name
> > of the tarball, see:
> > ------------------------>8------------------------
> > PKG_SOURCE:=$(PKG_NAME)-$(GCC_VERSION).tar.gz
> > ------------------------>8------------------------
> > 
> > And our tarball name is "gcc-arc-2015.06.tar.gz".
> 
> linaro gcc versions also use a date-release for their tarball names,
> but have it hidden behind their branch selection. (4.8, 4,9, ..). But
> well, this isn't uservisible, so it's a-ok.
> 
> I assume the arc binutils and gccs are only a stop-gap solution util
> the arc support trickled down into the default openwrt toolchains?

Indeed. We're working hard on upstreaming of all our tools.
In GCC uptream we plan to get in 6.x version.
For binutils this is not that clear which upstream version we're currently
targeting. Once we have new implementation ready we'll know better.

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