2016-04-20 05:45:52

by Fengguang Wu

[permalink] [raw]
Subject: mipsel-linux-gnu-gcc: error: unrecognized command line option '-mcompact-branches=optimal'

Hi,

FYI, the error/warning still remains.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 12566cc35d0e68308bde7aad615743d560cb097b
commit: c1a0e9bc885d46e519fd87d35af6a7937abfb986 MIPS: Allow compact branch policy to be changed
date: 6 months ago
config: mips-malta_qemu_32r6_defconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout c1a0e9bc885d46e519fd87d35af6a7937abfb986
# save the attached .config to linux build tree
make.cross ARCH=mips

All errors (new ones prefixed by >>):

>> mipsel-linux-gnu-gcc: error: unrecognized command line option '-mcompact-branches=optimal'
>> mipsel-linux-gnu-gcc: error: unrecognized command line option '-mcompact-branches=optimal'
make[2]: *** [kernel/bounds.s] Error 1
make[2]: Target '__build' not remade because of errors.
make[1]: *** [prepare0] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [sub-make] Error 2

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (1.25 kB)
.config.gz (13.05 kB)
Download all attachments

2016-04-20 14:02:59

by Ralf Baechle

[permalink] [raw]
Subject: Re: mipsel-linux-gnu-gcc: error: unrecognized command line option '-mcompact-branches=optimal'

On Wed, Apr 20, 2016 at 01:44:28PM +0800, kbuild test robot wrote:

> FYI, the error/warning still remains.
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 12566cc35d0e68308bde7aad615743d560cb097b
> commit: c1a0e9bc885d46e519fd87d35af6a7937abfb986 MIPS: Allow compact branch policy to be changed
> date: 6 months ago
> config: mips-malta_qemu_32r6_defconfig (attached as .config)
> reproduce:
> wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> git checkout c1a0e9bc885d46e519fd87d35af6a7937abfb986
> # save the attached .config to linux build tree
> make.cross ARCH=mips
>
> All errors (new ones prefixed by >>):
>
> >> mipsel-linux-gnu-gcc: error: unrecognized command line option '-mcompact-branches=optimal'
> >> mipsel-linux-gnu-gcc: error: unrecognized command line option '-mcompact-branches=optimal'

-mcompact-branches=optimal is an option for the latest version of the MIPS
architecture which is enabled by mips-malta_qemu_32r6_defconfig but your
compiler is too old, doesn't support R6. Unfortunately there's no simple
way to run a test on the build environment from kconfig or even before
kconfig runs so we've just ignord this particular build issue. Plus
there being the additional issue that we only know the toolchain to be
used after certain options have been picked.

Ralf

2016-04-21 04:51:35

by Fengguang Wu

[permalink] [raw]
Subject: Re: [kbuild-all] mipsel-linux-gnu-gcc: error: unrecognized command line option '-mcompact-branches=optimal'

Hi Ralf,

On Wed, Apr 20, 2016 at 03:30:21PM +0200, Ralf Baechle wrote:
> On Wed, Apr 20, 2016 at 01:44:28PM +0800, kbuild test robot wrote:
>
> > FYI, the error/warning still remains.
> >
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > head: 12566cc35d0e68308bde7aad615743d560cb097b
> > commit: c1a0e9bc885d46e519fd87d35af6a7937abfb986 MIPS: Allow compact branch policy to be changed
> > date: 6 months ago
> > config: mips-malta_qemu_32r6_defconfig (attached as .config)
> > reproduce:
> > wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
> > chmod +x ~/bin/make.cross
> > git checkout c1a0e9bc885d46e519fd87d35af6a7937abfb986
> > # save the attached .config to linux build tree
> > make.cross ARCH=mips
> >
> > All errors (new ones prefixed by >>):
> >
> > >> mipsel-linux-gnu-gcc: error: unrecognized command line option '-mcompact-branches=optimal'
> > >> mipsel-linux-gnu-gcc: error: unrecognized command line option '-mcompact-branches=optimal'
>
> -mcompact-branches=optimal is an option for the latest version of the MIPS
> architecture which is enabled by mips-malta_qemu_32r6_defconfig but your
> compiler is too old, doesn't support R6. Unfortunately there's no simple
> way to run a test on the build environment from kconfig or even before
> kconfig runs so we've just ignord this particular build issue. Plus
> there being the additional issue that we only know the toolchain to be
> used after certain options have been picked.

We are running Debian's mips cross compiler.

% mips-linux-gnu-gcc --version
mips-linux-gnu-gcc (Debian 5.2.1-16) 5.2.1 20150903
Copyright (C) 2015 Free Software Foundation, Inc.

How about temporarily disable that error, until we upgrade to a new
gcc version which supports the -mcompact-branches option?

Thanks,
Fengguang

2016-04-21 19:55:49

by Maciej W. Rozycki

[permalink] [raw]
Subject: Re: [kbuild-all] mipsel-linux-gnu-gcc: error: unrecognized command line option '-mcompact-branches=optimal'

On Thu, 21 Apr 2016, Fengguang Wu wrote:

> > -mcompact-branches=optimal is an option for the latest version of the MIPS
> > architecture which is enabled by mips-malta_qemu_32r6_defconfig but your
> > compiler is too old, doesn't support R6. Unfortunately there's no simple
> > way to run a test on the build environment from kconfig or even before
> > kconfig runs so we've just ignord this particular build issue. Plus
> > there being the additional issue that we only know the toolchain to be
> > used after certain options have been picked.
>
> We are running Debian's mips cross compiler.
>
> % mips-linux-gnu-gcc --version
> mips-linux-gnu-gcc (Debian 5.2.1-16) 5.2.1 20150903
> Copyright (C) 2015 Free Software Foundation, Inc.
>
> How about temporarily disable that error, until we upgrade to a new
> gcc version which supports the -mcompact-branches option?

I don't think it makes sense as the compiler won't support MIPSr6 code
anyway, so first it'll bail out on `-march=mips32r6', and if we go even
further and disable that too, then GAS will probably break somewhere on
inline asm and GCC will produce code which does not make sense otherwise.

Maciej

2016-04-21 20:31:43

by Ralf Baechle

[permalink] [raw]
Subject: Re: [kbuild-all] mipsel-linux-gnu-gcc: error: unrecognized command line option '-mcompact-branches=optimal'

On Thu, Apr 21, 2016 at 12:51:29PM +0800, Fengguang Wu wrote:

> On Wed, Apr 20, 2016 at 03:30:21PM +0200, Ralf Baechle wrote:
> > On Wed, Apr 20, 2016 at 01:44:28PM +0800, kbuild test robot wrote:
> >
> > > FYI, the error/warning still remains.
> > >
> > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > > head: 12566cc35d0e68308bde7aad615743d560cb097b
> > > commit: c1a0e9bc885d46e519fd87d35af6a7937abfb986 MIPS: Allow compact branch policy to be changed
> > > date: 6 months ago
> > > config: mips-malta_qemu_32r6_defconfig (attached as .config)
> > > reproduce:
> > > wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
> > > chmod +x ~/bin/make.cross
> > > git checkout c1a0e9bc885d46e519fd87d35af6a7937abfb986
> > > # save the attached .config to linux build tree
> > > make.cross ARCH=mips
> > >
> > > All errors (new ones prefixed by >>):
> > >
> > > >> mipsel-linux-gnu-gcc: error: unrecognized command line option '-mcompact-branches=optimal'
> > > >> mipsel-linux-gnu-gcc: error: unrecognized command line option '-mcompact-branches=optimal'
> >
> > -mcompact-branches=optimal is an option for the latest version of the MIPS
> > architecture which is enabled by mips-malta_qemu_32r6_defconfig but your
> > compiler is too old, doesn't support R6. Unfortunately there's no simple
> > way to run a test on the build environment from kconfig or even before
> > kconfig runs so we've just ignord this particular build issue. Plus
> > there being the additional issue that we only know the toolchain to be
> > used after certain options have been picked.
>
> We are running Debian's mips cross compiler.
>
> % mips-linux-gnu-gcc --version
> mips-linux-gnu-gcc (Debian 5.2.1-16) 5.2.1 20150903
> Copyright (C) 2015 Free Software Foundation, Inc.
>
> How about temporarily disable that error, until we upgrade to a new
> gcc version which supports the -mcompact-branches option?

Let's try to sort this properly :)

The culprit seems to be commit c1a0e9bc885d46e519fd87d35af6a7937abfb986
("MIPS: Allow compact branch policy to be changed"). Paul, any reason
why we don't offer the option of not using -mcompact-branches? It seems
GCC 5.2 needs that.

Ralf

2016-04-21 20:34:21

by Ralf Baechle

[permalink] [raw]
Subject: Re: [kbuild-all] mipsel-linux-gnu-gcc: error: unrecognized command line option '-mcompact-branches=optimal'

On Thu, Apr 21, 2016 at 08:55:34PM +0100, Maciej W. Rozycki wrote:

> > % mips-linux-gnu-gcc --version
> > mips-linux-gnu-gcc (Debian 5.2.1-16) 5.2.1 20150903
> > Copyright (C) 2015 Free Software Foundation, Inc.
> >
> > How about temporarily disable that error, until we upgrade to a new
> > gcc version which supports the -mcompact-branches option?
>
> I don't think it makes sense as the compiler won't support MIPSr6 code
> anyway, so first it'll bail out on `-march=mips32r6', and if we go even
> further and disable that too, then GAS will probably break somewhere on
> inline asm and GCC will produce code which does not make sense otherwise.

GCC 5.2.0 claims to support mips32r6 and mips64r6. It's just the option
-mcompact-branches which seem to have been added later only.

Ralf

2016-04-21 21:11:06

by Maciej W. Rozycki

[permalink] [raw]
Subject: Re: [kbuild-all] mipsel-linux-gnu-gcc: error: unrecognized command line option '-mcompact-branches=optimal'

On Thu, 21 Apr 2016, Ralf Baechle wrote:

> > I don't think it makes sense as the compiler won't support MIPSr6 code
> > anyway, so first it'll bail out on `-march=mips32r6', and if we go even
> > further and disable that too, then GAS will probably break somewhere on
> > inline asm and GCC will produce code which does not make sense otherwise.
>
> GCC 5.2.0 claims to support mips32r6 and mips64r6. It's just the option
> -mcompact-branches which seem to have been added later only.

Ah, I see -- I didn't track the timeline of support for this compiler's
option and I took it from an earlier response that the compiler does not
support R6 at all.

In that case however it looks to me like these `-mcompact-branches='
options (all the three we support) need to be wrapped into `$(call
cc-option,...)'. They do not affect any functionality and they are an
optimisation choice only anyway (and therefore I wonder why they've been
placed in arch/mips/Kconfig.debug rather than arch/mips/Kconfig).

Maciej

2016-04-22 08:54:53

by Paul Burton

[permalink] [raw]
Subject: Re: [kbuild-all] mipsel-linux-gnu-gcc: error: unrecognized command line option '-mcompact-branches=optimal'

On Thu, Apr 21, 2016 at 10:10:51PM +0100, Maciej W. Rozycki wrote:
> On Thu, 21 Apr 2016, Ralf Baechle wrote:
>
> > > I don't think it makes sense as the compiler won't support MIPSr6 code
> > > anyway, so first it'll bail out on `-march=mips32r6', and if we go even
> > > further and disable that too, then GAS will probably break somewhere on
> > > inline asm and GCC will produce code which does not make sense otherwise.
> >
> > GCC 5.2.0 claims to support mips32r6 and mips64r6. It's just the option
> > -mcompact-branches which seem to have been added later only.
>
> Ah, I see -- I didn't track the timeline of support for this compiler's
> option and I took it from an earlier response that the compiler does not
> support R6 at all.
>
> In that case however it looks to me like these `-mcompact-branches='
> options (all the three we support) need to be wrapped into `$(call
> cc-option,...)'.

An alternative that it could be argued better fits the principle of
least surprise is to add an extra option to the Kconfig choice that
simply leaves -mcompact-branches unspecified. I just submitted a patch
to do so [1].

> They do not affect any functionality and they are an
> optimisation choice only anyway (and therefore I wonder why they've been
> placed in arch/mips/Kconfig.debug rather than arch/mips/Kconfig).

They're in Kconfig.debug because debug is exactly what they've been
useful for - given that compact branches are new to R6 it's been useful
in debugging systems, both hardware & simulators, to sometimes not use
them. It's also been useful to force their use attempting to work around
the compiler bug that [2] works around differently (bug 2179 on DMZ
bugzilla). On the other hand I can't think of a reason we'd want to
specify compact branch policy that isn't for debug - I'd expect for
performance optimisation we're more likely to rely upon the toolchain
using a sensible policy if the kernel is built for a specific CPU (eg.
perhaps -mcpu=p6600 prefers non-compact branches & -mcpu=m6250 prefers
all compact branches, or similar).

Thanks,
Paul

[1] https://patchwork.linux-mips.org/patch/13165/
[2] https://patchwork.linux-mips.org/patch/12556/

2016-04-22 15:49:04

by Maciej W. Rozycki

[permalink] [raw]
Subject: Re: [kbuild-all] mipsel-linux-gnu-gcc: error: unrecognized command line option '-mcompact-branches=optimal'

On Fri, 22 Apr 2016, Paul Burton wrote:

> > In that case however it looks to me like these `-mcompact-branches='
> > options (all the three we support) need to be wrapped into `$(call
> > cc-option,...)'.
>
> An alternative that it could be argued better fits the principle of
> least surprise is to add an extra option to the Kconfig choice that
> simply leaves -mcompact-branches unspecified. I just submitted a patch
> to do so [1].

Hmm, good idea in principle, but given that -- as you say -- this is a
debug option I have a further suggestion I'll reply to your patch
submission with.

> > They do not affect any functionality and they are an
> > optimisation choice only anyway (and therefore I wonder why they've been
> > placed in arch/mips/Kconfig.debug rather than arch/mips/Kconfig).
>
> They're in Kconfig.debug because debug is exactly what they've been
> useful for - given that compact branches are new to R6 it's been useful
> in debugging systems, both hardware & simulators, to sometimes not use
> them. It's also been useful to force their use attempting to work around
> the compiler bug that [2] works around differently (bug 2179 on DMZ
> bugzilla). On the other hand I can't think of a reason we'd want to
> specify compact branch policy that isn't for debug - I'd expect for
> performance optimisation we're more likely to rely upon the toolchain
> using a sensible policy if the kernel is built for a specific CPU (eg.
> perhaps -mcpu=p6600 prefers non-compact branches & -mcpu=m6250 prefers
> all compact branches, or similar).

Good point, it should indeed be the compiler making the right choice for
the `-mtune=' setting selected with the default branch policy rather the
user fiddling with `-mcompact-branches=' manually unless, as you say, for
debugging.

Thanks for the patience to educate me.

Maciej