Skip to content

Fix redundant usage of -mcpu and -march/-mtune

Thomas Petazzoni buildroot 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest0 of 1 patch 0 repliesNew

Patches in v1 No applies recorded yet

The patch the cover letter announces is not in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

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

Dear K?roly Kasza,

Quoted 8 lines · K?roly Kasza

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.

Quoted 5 lines
Quoted 5 lines

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?

Quoted 7 lines

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

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