configure: arm: Don't add -march= to the compiler if no preference was passed
authorMartin Storsjö <martin@martin.st>
Mon, 20 Sep 2021 10:00:40 +0000 (13:00 +0300)
committerSebastian Ramacher <sramacher@debian.org>
Sat, 15 Jan 2022 16:49:38 +0000 (16:49 +0000)
commit65c4a4b9567254756dc8039ce13ce37e27f55d35
treed26906360d7652c16c548a8bed5e34655040d6f5
parente074232edf6f4c580425de8ce1387104634870ae
configure: arm: Don't add -march= to the compiler if no preference was passed

If no --cpu= option was passed to configure, we detect what the
compiler defaults to. This detected value was then fed back to the
rest of the configure logic, as if it was an explicit choice.

This breaks on Ubuntu 21.10 with GCC 11.1.

Since GCC 8, it's possible to add configure extra features via the
-march option, like e.g. -march=armv7-a+neon. If the -mfpu= option
is configured to default to 'auto', the fpu setting gets taken
from the -march option.

GCC 11.1 in Ubuntu seems to be configured to use -mfpu=auto. This
has the effect of breaking any compilation command that specifies
-march=armv7-a, because the driver implicitly also adds -mfloat-abi=hard,
and that combination results in this error:

    cc1: error: ‘-mfloat-abi=hard’: selected processor lacks an FPU

Therefore, restructure configure. If no specific preference was set
(and the 'cpu' configure variable was set as the output of
probe_arm_arch), the value we tried to set via -march= was the same
value that we just tried to detect as the compiler default.

So instead, just try to detect what the compiler defaults to, with
to allow setting other configure settings (such as 'fast_unaligned'),
but don't try to spell out the compiler's default via the -march flag.

Signed-off-by: Martin Storsjö <martin@martin.st>
Gbp-Pq: Name 0002-configure-arm-Don-t-add-march-to-the-compiler-if-no-.patch
configure