Skip to contentSkip to conversation

Regression: commit 987fdfec2410 causes build to incorrectly issue warning

DISCUSSION Russell King - ARM Linux admin 2 participants 3 messages Jul 2, 2021 – Jul 5, 2021 arm64

lore
Share & tools
lore
#0 lore raw

Hi,

Commit 987fdfec2410 ("arm64: move --fix-cortex-a53-843419 linker test to Kconfig") breaks the ability to detect linker support for this option. Building 5.13 for aarch64 with Debian binutils 2.31.1 results in:

.../arch/arm64/Makefile:25: ld does not support --fix-cortex-a53-843419; kernel may be susceptible to erratum

This is because ARM64_LD_HAS_FIX_ERRATUM_843419 is not set in the Kconfig, indicating that the Kconfig test for linker support for --fix-cortex-a53-843419 has failed, yet this version of binutils does support this option:

$ aarch64-linux-gnu-ld --help | grep -e --fix-cortex-a53-843419 | wc -l
8

Reverting this commit fixes the problem for me.

Thanks.

Signature · 7 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#1 lore raw
Quoted 13 lines · Russell King - ARM Linux admin

Hi,

Commit 987fdfec2410 ("arm64: move --fix-cortex-a53-843419 linker test to Kconfig") breaks the ability to detect linker support for this option. Building 5.13 for aarch64 with Debian binutils 2.31.1 results in:

.../arch/arm64/Makefile:25: ld does not support --fix-cortex-a53-843419; kernel may be susceptible to erratum

This is because ARM64_LD_HAS_FIX_ERRATUM_843419 is not set in the Kconfig, indicating that the Kconfig test for linker support for --fix-cortex-a53-843419 has failed, yet this version of binutils does support this option:

Quoted 4 lines
$ aarch64-linux-gnu-ld --help | grep -e --fix-cortex-a53-843419 | wc -l
8

Reverting this commit fixes the problem for me.

Sadly, while reverting the commit fixes it during the initial build run, the warning pops up when doing the installation step.

I'm not entirely sure what's going on here. Having put the commit back, and re-run strace (and waited ages) it appears that the ld-option command does succeed, and I eventually end up with the option present in .config.

However, it seems that if we have a .config that has the errata enabled, but doesn't contain the _LD_ option, then we end up issuing the warning before we re-run the Kconfig step.

Eventually, I seem to have ended up with the _LD_ option set. Quite how, I don't know. When I originally noticed the problem, I had done a full rebuild. I then re-ran the build several times, and the warning popped up every time.

Now that I've touched arch/arm64/Kconfig and re-run the build, it doesn't warn anymore - in fact, while investigating this and stracing, the option magically set itself and the problem has vanished.

There is definitely weirdness and unpredictability going on with Kbuild - I can't explain it. Maybe its just become way to complex...

Signature · 7 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#2 lore raw
Quoted 41 lines · Russell King (Oracle)
Quoted 13 lines · Russell King - ARM Linux admin

Hi,

Commit 987fdfec2410 ("arm64: move --fix-cortex-a53-843419 linker test to Kconfig") breaks the ability to detect linker support for this option. Building 5.13 for aarch64 with Debian binutils 2.31.1 results in:

.../arch/arm64/Makefile:25: ld does not support --fix-cortex-a53-843419; kernel may be susceptible to erratum

This is because ARM64_LD_HAS_FIX_ERRATUM_843419 is not set in the Kconfig, indicating that the Kconfig test for linker support for --fix-cortex-a53-843419 has failed, yet this version of binutils does support this option:

Quoted 4 lines
$ aarch64-linux-gnu-ld --help | grep -e --fix-cortex-a53-843419 | wc -l
8

Reverting this commit fixes the problem for me.

Sadly, while reverting the commit fixes it during the initial build run, the warning pops up when doing the installation step.

I'm not entirely sure what's going on here. Having put the commit back, and re-run strace (and waited ages) it appears that the ld-option command does succeed, and I eventually end up with the option present in .config.

However, it seems that if we have a .config that has the errata enabled, but doesn't contain the _LD_ option, then we end up issuing the warning before we re-run the Kconfig step.

Eventually, I seem to have ended up with the _LD_ option set. Quite how, I don't know. When I originally noticed the problem, I had done a full rebuild. I then re-ran the build several times, and the warning popped up every time.

Now that I've touched arch/arm64/Kconfig and re-run the build, it doesn't warn anymore - in fact, while investigating this and stracing, the option magically set itself and the problem has vanished.

Quoted 6 lines

There is definitely weirdness and unpredictability going on with Kbuild - I can't explain it. Maybe its just become way to complex...

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

I do not know your issue occurs, and not perfectly sure if this is related to your case, but I also see some cases where this false-positive warning is displayed.

Could you please try the attached patch?

Signature · 2 lines
Best Regards
Masahiro Yamada

From 39ad4bd3b42a7ba3d512254f5a0d23aae1295743 Mon Sep 17 00:00:00 2001
From: Masahiro Yamada <[email protected]>
Date: Mon, 5 Jul 2021 01:49:18 +0900
Subject: [PATCH] arm64: move warning about toolchains to archprepare

Commit 987fdfec2410 ("arm64: move --fix-cortex-a53-843419 linker test to Kconfig") fixed the false-positive warning in the installation step.

Yet, there are some cases where this false-positive is shown. For example, you can see it when you cross 987fdfec2410 during git-bisect.

  $ git checkout 987fdfec2410^
    [ snip ]
  $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig all
    [ snip ]
  $ git checkout v5.13
    [ snip]
  $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig all
    [ snip ]
  arch/arm64/Makefile:25: ld does not support --fix-cortex-a53-843419; kernel may be susceptible to erratum

In the stale include/config/auto.config, CONFIG_ARM64_ERRATUM_843419=y is set without CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419, so the warning is displayed while parsing the Makefiles.

Make will restart with the updated include/config/auto.config, hence CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419 will be set eventually, but this warning is a surprise for users.

Commit 25896d073d8a ("x86/build: Fix compiler support check for CONFIG_RETPOLINE") addressed a similar issue.

Move $(warning ...) out of the parse stage of Makefiles.

The same applies to CONFIG_ARM64_USE_LSE_ATOMICS.

---
 arch/arm64/Makefile | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
arch/arm64/Makefile +12 -9
index 3b5b1c480449..8b6fdd466d92 100644
@@ -21,19 +21,11 @@ LDFLAGS_vmlinux		+= -shared -Bsymbolic -z notext \
 endif
 
 ifeq ($(CONFIG_ARM64_ERRATUM_843419),y)
-  ifneq ($(CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419),y)
-$(warning ld does not support --fix-cortex-a53-843419; kernel may be susceptible to erratum)
-  else
+  ifeq ($(CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419),y)
 LDFLAGS_vmlinux	+= --fix-cortex-a53-843419
   endif
 endif
 
-ifeq ($(CONFIG_ARM64_USE_LSE_ATOMICS), y)
-  ifneq ($(CONFIG_ARM64_LSE_ATOMICS), y)
-$(warning LSE atomics not supported by binutils)
-  endif
-endif
-
 cc_has_k_constraint := $(call try-run,echo				\
 	'int main(void) {						\
 		asm volatile("and w0, w0, %w0" :: "K" (4294967295));	\
@@ -177,6 +169,17 @@ vdso_install:
 
 archprepare:
 	$(Q)$(MAKE) $(build)=arch/arm64/tools kapi
+ifeq ($(CONFIG_ARM64_ERRATUM_843419),y)
+  ifneq ($(CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419),y)
+	@echo "warning: ld does not support --fix-cortex-a53-843419; kernel may be susceptible to erratum" >&2
+  endif
+endif
+ifeq ($(CONFIG_ARM64_USE_LSE_ATOMICS),y)
+  ifneq ($(CONFIG_ARM64_LSE_ATOMICS),y)
+	@echo "warning: LSE atomics not supported by binutils" >&2
+  endif
+endif
+
 
 # We use MRPROPER_FILES and CLEAN_FILES now
 archclean:
Signature · 1 line
2.27.0

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel