Re: [linux-stable-rc:linux-5.15.y 6874/8723] arch/arm/lib/xor-neon.c:30:2: warning: This code requires at least version 4.6 of GCC

Arnd Bergmann
2022-07-25T12:56:10Z

On Mon, Jul 25, 2022 at 2:41 PM Ard Biesheuvel <ardb@kernel.org> wrote:

> > I would love to backport this as it bugs me to no end on some various
> > gerrit systems all the time. I'll look into it later this week unless
> > someone beats me to it :)
> >
>
> If backporting is an issue, we could just drop this warning - GCC
> before 4.6 hasn't been supported for a while anyway, and Clang never
> had the SIMD accelerated XOR to begin with (it needs the __restrict
> annotations that the parent patch introduces)

The other easy workaround would be to just turn off the xor-neon code
when building with clang, e.g. using this Makefile hack:

diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index 6d2ba454f25b..8e4fe6421dd2 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -43,8 +43,10 @@ endif
$(obj)/csumpartialcopy.o: $(obj)/csumpartialcopygeneric.S
$(obj)/csumpartialcopyuser.o: $(obj)/csumpartialcopygeneric.S

+ifdef CONFIG_CC_IS_CLANG
ifeq ($(CONFIG_KERNEL_MODE_NEON),y)
NEON_FLAGS := -march=armv7-a -mfloat-abi=softfp -mfpu=neon
CFLAGS_xor-neon.o += $(NEON_FLAGS)
obj-$(CONFIG_XOR_BLOCKS) += xor-neon.o
endif
+endif

As far as I understand it, without your patch the code is the same as the
generic version anyway, we just never turned it off in mainline this way because
the plan was always to make it work. It now does work, and for the stable
kernel the mainline patch would only be a performance optimization that we
normally don't backport.

Arnd