On Mon, Oct 18, 2021 at 9:03 AM Sebastian Andrzej Siewior
<sebast...@breakpoint.cc> wrote:
> On 2021-10-16 12:17:40 [+0200], Matthias Klose wrote:
> > The change is intended; the configure changes are already in GCC 8, but the
> > configure options that we used, are now being deprecated upstream.
> >
> > Changes: https://gcc.gnu.org/gcc-8/changes.html
>
> I guess you refer to
> | The -march and -mcpu options now accept optional extensions…
>
> which describes the syntax. But this is gcc-8 introducing new syntax not
> gcc-11 dropping old syntax or so.

>From what I understand now, gcc-11 did not actually change, only the
way that gcc is packaged in Debian and Ubuntu changed at [1].
This has apparently gone back and forth a couple of time, but I don't
recall anyone reporting the kernel build regression before, so I assume
the new way is not yet widely used outside of debian.

What happens is that the kernel tries out the configured -march=
options individually, falling back to e.g. -march=armv5t if we can't
build for -march=armv6. Once it has established the -march=
argument, it adds further flags like -msoft-float, since the kernel
itself is built without floating-point instructions disabled.

On builds of gcc-11, this would lead to compiling with

-march=armv6 -mfpu=vfpv3-d16 -mfloat-abi=hard

to override the -march=armv7-a. On new builds, there is no -mfpu=vfp3-d16,
so it attempts and fails to build with

-march=armv6 -mfloat-abi=hard

and then falls back to -march=armv5t with -msoft-float added in the
next step. Building an ARMv6 kernel with -march=armv5t fails when
the assembler rejects inline assembly statements with newer instructions.

> > > On gcc-10 it evaluated to "-march=armv7-a".
> > > On gcc-11 it evaluates to "-march=armv5t -Wa,-march=armv7-a" leading to
> >
> > -march=armv7-a+fp probably should be used. Same in assembler files where 
> > armv7-a
> > is used as an architecture. I'm not a kernel developer however, so don't 
> > know if
> > this is the intended approach.
>
> I was asking because `gcc -v' changes from
>   --with-arch=armv7-a --with-fpu=vfpv3-d16
> to
>   --with-arch=armv7-a+fp
>
> and I wasn't sure if this is intended or a side effect. But it may be
> mandatory due to the new syntax.
>
> As for the option, I would guess "armv7-a+nofp" since the expectation is
> not to clobber any FPU/SIMD registers like in auto-vectorization etc.
> But I see Arnd is on Cc: and silently hope he looks into it ;)

I'll send the kernel workaround soon, and that should make it into all
stable kernels.

The compilers I build for kernel.org do not set a default -march value
and end up with the default that gcc picks, which apparently is
a softfloat -mcpu=arm10tdmi.

       Arnd

[1] 
https://salsa.debian.org/toolchain-team/gcc/-/commit/0070c26305320144b5e049ae12e1adfec82f508

Reply via email to