[Buildroot] [PATCH 0/1] Fix redundant usage of -mcpu and -march/-mtune

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Tue May 13 20:22:47 UTC 2014


Dear Károly Kasza,

On Tue, 13 May 2014 16:33:18 +0200, Károly Kasza wrote:

> The BR2_cortex_a7=y breaks it, it will generate a warning while compiling
> busybox (every invocation of gcc):
> warning: switch -mcpu=cortex-a7 conflicts with -march=armv7-a switch
> [enabled by default]
> 
> Then an error with mmc-utils like this:
> mmc.c:1:0: error: switch -mcpu=cortex-a7 conflicts with -march=armv7-a
> switch [-Werror]

Indeed, with Cortex-A7, I can reproduce this. This is because
Cortex-A7, A-12 and A-15 support more features than the other armv7-a
cores (A5, A8, A9), so gcc has a separate -march argument: armv7ve.

So normally, we should set BR2_GCC_TARGET_ARCH to armv7ve for those
Cortex-A variants. I'm currently experimenting with this, but I'm
having a few issues. Also, it's likely that armv7ve is quite recent,
and may not be present in older gcc versions.

> > The potential problem I see is that the code you're changing is used
> > for *all* architectures, but the change you're making has only been
> > made with ARM specificities in mind. Does ignoring -march and -mtune
> > when -mcpu is defined also works for all other architectures?
> >
> This is a tough question, because based on the GCC online manual, not all
> architectures accept all three parameters.
> It looks like -mcpu is always the most definite, but is is deprecated on
> i386 and x86_64 for example.
> 
> Maybe it would be wise to define and use these 3 parameters only based on
> the target architecture.

This is already the case. They are only passed if
BR2_GCC_TARGET_{ARCH,CPU,TUNE} are defined. Some architectures (such as
ARM) defines all three, but other architectures (such as x86) do not.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com



More information about the buildroot mailing list