* [PATCH 6.1 1/4] x86/boot/compressed: prefer cc-option for CFLAGS additions
2023-06-14 18:04 [PATCH 6.1 0/4] Update as-{instr,option} to use KBUILD_AFLAGS Nathan Chancellor
@ 2023-06-14 18:04 ` Nathan Chancellor
2023-06-19 7:51 ` Patch "x86/boot/compressed: prefer cc-option for CFLAGS additions" has been added to the 6.1-stable tree gregkh
2023-06-14 18:04 ` [PATCH 6.1 2/4] MIPS: Move '-Wa,-msoft-float' check from as-option to cc-option Nathan Chancellor
` (3 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Nathan Chancellor @ 2023-06-14 18:04 UTC (permalink / raw)
To: gregkh, sashal, ndesaulniers
Cc: naresh.kamboju, stable, llvm, Masahiro Yamada, Nathan Chancellor,
Linux Kernel Functional Testing, Anders Roxell
From: Nick Desaulniers <ndesaulniers@google.com>
commit 994f5f7816ff963f49269cfc97f63cb2e4edb84f upstream.
as-option tests new options using KBUILD_CFLAGS, which causes problems
when using as-option to update KBUILD_AFLAGS because many compiler
options are not valid assembler options.
This will be fixed in a follow up patch. Before doing so, move the
assembler test for -Wa,-mrelax-relocations=no from using as-option to
cc-option.
Link: https://lore.kernel.org/llvm/CAK7LNATcHt7GcXZ=jMszyH=+M_LC9Qr6yeAGRCBbE6xriLxtUQ@mail.gmail.com/
Suggested-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Tested-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
arch/x86/boot/compressed/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index 3a261abb6d15..15b7b403a4bd 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -50,7 +50,7 @@ KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
KBUILD_CFLAGS += -D__DISABLE_EXPORTS
# Disable relocation relaxation in case the link is not PIE.
-KBUILD_CFLAGS += $(call as-option,-Wa$(comma)-mrelax-relocations=no)
+KBUILD_CFLAGS += $(call cc-option,-Wa$(comma)-mrelax-relocations=no)
KBUILD_CFLAGS += -include $(srctree)/include/linux/hidden.h
# sev.c indirectly inludes inat-table.h which is generated during
--
2.41.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* Patch "x86/boot/compressed: prefer cc-option for CFLAGS additions" has been added to the 6.1-stable tree
2023-06-14 18:04 ` [PATCH 6.1 1/4] x86/boot/compressed: prefer cc-option for CFLAGS additions Nathan Chancellor
@ 2023-06-19 7:51 ` gregkh
0 siblings, 0 replies; 10+ messages in thread
From: gregkh @ 2023-06-19 7:51 UTC (permalink / raw)
To: anders.roxell, gregkh, lkft, llvm, masahiroy, naresh.kamboju,
nathan, ndesaulniers, sashal
Cc: stable-commits
This is a note to let you know that I've just added the patch titled
x86/boot/compressed: prefer cc-option for CFLAGS additions
to the 6.1-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
x86-boot-compressed-prefer-cc-option-for-cflags-additions.patch
and it can be found in the queue-6.1 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
From nathan@kernel.org Wed Jun 14 20:04:41 2023
From: Nathan Chancellor <nathan@kernel.org>
Date: Wed, 14 Jun 2023 11:04:35 -0700
Subject: x86/boot/compressed: prefer cc-option for CFLAGS additions
To: gregkh@linuxfoundation.org, sashal@kernel.org, ndesaulniers@google.com
Cc: naresh.kamboju@linaro.org, stable@vger.kernel.org, llvm@lists.linux.dev, Masahiro Yamada <masahiroy@kernel.org>, Nathan Chancellor <nathan@kernel.org>, Linux Kernel Functional Testing <lkft@linaro.org>, Anders Roxell <anders.roxell@linaro.org>
Message-ID: <20230612-6-1-asssembler-target-llvm-17-v1-1-75605d553401@kernel.org>
From: Nick Desaulniers <ndesaulniers@google.com>
commit 994f5f7816ff963f49269cfc97f63cb2e4edb84f upstream.
as-option tests new options using KBUILD_CFLAGS, which causes problems
when using as-option to update KBUILD_AFLAGS because many compiler
options are not valid assembler options.
This will be fixed in a follow up patch. Before doing so, move the
assembler test for -Wa,-mrelax-relocations=no from using as-option to
cc-option.
Link: https://lore.kernel.org/llvm/CAK7LNATcHt7GcXZ=jMszyH=+M_LC9Qr6yeAGRCBbE6xriLxtUQ@mail.gmail.com/
Suggested-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Tested-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/x86/boot/compressed/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -50,7 +50,7 @@ KBUILD_CFLAGS += $(call cc-option,-fmacr
KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
KBUILD_CFLAGS += -D__DISABLE_EXPORTS
# Disable relocation relaxation in case the link is not PIE.
-KBUILD_CFLAGS += $(call as-option,-Wa$(comma)-mrelax-relocations=no)
+KBUILD_CFLAGS += $(call cc-option,-Wa$(comma)-mrelax-relocations=no)
KBUILD_CFLAGS += -include $(srctree)/include/linux/hidden.h
# sev.c indirectly inludes inat-table.h which is generated during
Patches currently in stable-queue which might be from nathan@kernel.org are
queue-6.1/riscv-purgatory-remove-pgo-flags.patch
queue-6.1/powerpc-purgatory-remove-pgo-flags.patch
queue-6.1/mips-move-wa-msoft-float-check-from-as-option-to-cc-option.patch
queue-6.1/kexec-support-purgatories-with-.text.hot-sections.patch
queue-6.1/mips-prefer-cc-option-for-additions-to-cflags.patch
queue-6.1/x86-purgatory-remove-pgo-flags.patch
queue-6.1/x86-boot-compressed-prefer-cc-option-for-cflags-additions.patch
queue-6.1/kbuild-update-assembler-calls-to-use-proper-flags-and-language-target.patch
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 6.1 2/4] MIPS: Move '-Wa,-msoft-float' check from as-option to cc-option
2023-06-14 18:04 [PATCH 6.1 0/4] Update as-{instr,option} to use KBUILD_AFLAGS Nathan Chancellor
2023-06-14 18:04 ` [PATCH 6.1 1/4] x86/boot/compressed: prefer cc-option for CFLAGS additions Nathan Chancellor
@ 2023-06-14 18:04 ` Nathan Chancellor
2023-06-19 7:51 ` Patch "MIPS: Move '-Wa,-msoft-float' check from as-option to cc-option" has been added to the 6.1-stable tree gregkh
2023-06-14 18:04 ` [PATCH 6.1 3/4] MIPS: Prefer cc-option for additions to cflags Nathan Chancellor
` (2 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Nathan Chancellor @ 2023-06-14 18:04 UTC (permalink / raw)
To: gregkh, sashal, ndesaulniers
Cc: naresh.kamboju, stable, llvm, Nathan Chancellor, tsbogend,
linux-mips
This patch is for linux-6.1.y and earlier, it has no direct mainline
equivalent.
In order to backport commit d5c8d6e0fa61 ("kbuild: Update assembler
calls to use proper flags and language target") to resolve a separate
issue regarding PowerPC, the problem noticed and fixed by
commit 80a20d2f8288 ("MIPS: Always use -Wa,-msoft-float and eliminate
GAS_HAS_SET_HARDFLOAT") needs to be addressed. Unfortunately, 6.1 and
earlier do not contain commit e4412739472b ("Documentation: raise
minimum supported version of binutils to 2.25"), so it cannot be assumed
that all supported versions of GNU as have support for -msoft-float.
In order to switch from KBUILD_CFLAGS to KBUILD_AFLAGS in as-option
without consequence, move the '-Wa,-msoft-float' check to cc-option,
including '$(cflags-y)' directly to avoid the issue mentioned in
commit 80a20d2f8288 ("MIPS: Always use -Wa,-msoft-float and eliminate
GAS_HAS_SET_HARDFLOAT").
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Cc: tsbogend@alpha.franken.de
Cc: linux-mips@vger.kernel.org
---
arch/mips/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index b296e33f8e33..de8d508f27af 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -109,7 +109,7 @@ endif
# (specifically newer than 2.24.51.20140728) we then also need to explicitly
# set ".set hardfloat" in all files which manipulate floating point registers.
#
-ifneq ($(call as-option,-Wa$(comma)-msoft-float,),)
+ifneq ($(call cc-option,$(cflags-y) -Wa$(comma)-msoft-float,),)
cflags-y += -DGAS_HAS_SET_HARDFLOAT -Wa,-msoft-float
endif
--
2.41.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* Patch "MIPS: Move '-Wa,-msoft-float' check from as-option to cc-option" has been added to the 6.1-stable tree
2023-06-14 18:04 ` [PATCH 6.1 2/4] MIPS: Move '-Wa,-msoft-float' check from as-option to cc-option Nathan Chancellor
@ 2023-06-19 7:51 ` gregkh
0 siblings, 0 replies; 10+ messages in thread
From: gregkh @ 2023-06-19 7:51 UTC (permalink / raw)
To: gregkh, llvm, naresh.kamboju, nathan, ndesaulniers, sashal,
tsbogend
Cc: stable-commits
This is a note to let you know that I've just added the patch titled
MIPS: Move '-Wa,-msoft-float' check from as-option to cc-option
to the 6.1-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
mips-move-wa-msoft-float-check-from-as-option-to-cc-option.patch
and it can be found in the queue-6.1 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
From nathan@kernel.org Wed Jun 14 20:04:42 2023
From: Nathan Chancellor <nathan@kernel.org>
Date: Wed, 14 Jun 2023 11:04:36 -0700
Subject: MIPS: Move '-Wa,-msoft-float' check from as-option to cc-option
To: gregkh@linuxfoundation.org, sashal@kernel.org, ndesaulniers@google.com
Cc: naresh.kamboju@linaro.org, stable@vger.kernel.org, llvm@lists.linux.dev, Nathan Chancellor <nathan@kernel.org>, tsbogend@alpha.franken.de, linux-mips@vger.kernel.org
Message-ID: <20230612-6-1-asssembler-target-llvm-17-v1-2-75605d553401@kernel.org>
From: Nathan Chancellor <nathan@kernel.org>
This patch is for linux-6.1.y and earlier, it has no direct mainline
equivalent.
In order to backport commit d5c8d6e0fa61 ("kbuild: Update assembler
calls to use proper flags and language target") to resolve a separate
issue regarding PowerPC, the problem noticed and fixed by
commit 80a20d2f8288 ("MIPS: Always use -Wa,-msoft-float and eliminate
GAS_HAS_SET_HARDFLOAT") needs to be addressed. Unfortunately, 6.1 and
earlier do not contain commit e4412739472b ("Documentation: raise
minimum supported version of binutils to 2.25"), so it cannot be assumed
that all supported versions of GNU as have support for -msoft-float.
In order to switch from KBUILD_CFLAGS to KBUILD_AFLAGS in as-option
without consequence, move the '-Wa,-msoft-float' check to cc-option,
including '$(cflags-y)' directly to avoid the issue mentioned in
commit 80a20d2f8288 ("MIPS: Always use -Wa,-msoft-float and eliminate
GAS_HAS_SET_HARDFLOAT").
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
Cc: tsbogend@alpha.franken.de
Cc: linux-mips@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/mips/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -109,7 +109,7 @@ endif
# (specifically newer than 2.24.51.20140728) we then also need to explicitly
# set ".set hardfloat" in all files which manipulate floating point registers.
#
-ifneq ($(call as-option,-Wa$(comma)-msoft-float,),)
+ifneq ($(call cc-option,$(cflags-y) -Wa$(comma)-msoft-float,),)
cflags-y += -DGAS_HAS_SET_HARDFLOAT -Wa,-msoft-float
endif
Patches currently in stable-queue which might be from nathan@kernel.org are
queue-6.1/riscv-purgatory-remove-pgo-flags.patch
queue-6.1/powerpc-purgatory-remove-pgo-flags.patch
queue-6.1/mips-move-wa-msoft-float-check-from-as-option-to-cc-option.patch
queue-6.1/kexec-support-purgatories-with-.text.hot-sections.patch
queue-6.1/mips-prefer-cc-option-for-additions-to-cflags.patch
queue-6.1/x86-purgatory-remove-pgo-flags.patch
queue-6.1/x86-boot-compressed-prefer-cc-option-for-cflags-additions.patch
queue-6.1/kbuild-update-assembler-calls-to-use-proper-flags-and-language-target.patch
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 6.1 3/4] MIPS: Prefer cc-option for additions to cflags
2023-06-14 18:04 [PATCH 6.1 0/4] Update as-{instr,option} to use KBUILD_AFLAGS Nathan Chancellor
2023-06-14 18:04 ` [PATCH 6.1 1/4] x86/boot/compressed: prefer cc-option for CFLAGS additions Nathan Chancellor
2023-06-14 18:04 ` [PATCH 6.1 2/4] MIPS: Move '-Wa,-msoft-float' check from as-option to cc-option Nathan Chancellor
@ 2023-06-14 18:04 ` Nathan Chancellor
2023-06-19 7:51 ` Patch "MIPS: Prefer cc-option for additions to cflags" has been added to the 6.1-stable tree gregkh
2023-06-14 18:04 ` [PATCH 6.1 4/4] kbuild: Update assembler calls to use proper flags and language target Nathan Chancellor
2023-06-19 7:51 ` [PATCH 6.1 0/4] Update as-{instr,option} to use KBUILD_AFLAGS Greg KH
4 siblings, 1 reply; 10+ messages in thread
From: Nathan Chancellor @ 2023-06-14 18:04 UTC (permalink / raw)
To: gregkh, sashal, ndesaulniers
Cc: naresh.kamboju, stable, llvm, Nathan Chancellor,
Thomas Bogendoerfer, Philippe Mathieu-Daudé,
Linux Kernel Functional Testing, Anders Roxell, Masahiro Yamada
commit 337ff6bb8960fdc128cabd264aaea3d42ca27a32 upstream.
A future change will switch as-option to use KBUILD_AFLAGS instead of
KBUILD_CFLAGS to allow clang to drop -Qunused-arguments, which may cause
issues if the flag being tested requires a flag previously added to
KBUILD_CFLAGS but not KBUILD_AFLAGS. Use cc-option for cflags additions
so that the flags are tested properly.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Acked-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Tested-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
arch/mips/Makefile | 2 +-
arch/mips/loongson2ef/Platform | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index de8d508f27af..85d3c3b4b7bd 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -152,7 +152,7 @@ cflags-y += -fno-stack-check
#
# Avoid this by explicitly disabling that assembler behaviour.
#
-cflags-y += $(call as-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
+cflags-y += $(call cc-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
#
# CPU-dependent compiler/assembler options for optimization.
diff --git a/arch/mips/loongson2ef/Platform b/arch/mips/loongson2ef/Platform
index eebabf9df6ac..c6f7a4b95997 100644
--- a/arch/mips/loongson2ef/Platform
+++ b/arch/mips/loongson2ef/Platform
@@ -25,7 +25,7 @@ cflags-$(CONFIG_CPU_LOONGSON2F) += -march=loongson2f
# binutils does not merge support for the flag then we can revisit & remove
# this later - for now it ensures vendor toolchains don't cause problems.
#
-cflags-$(CONFIG_CPU_LOONGSON2EF) += $(call as-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
+cflags-$(CONFIG_CPU_LOONGSON2EF) += $(call cc-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
# Enable the workarounds for Loongson2f
ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS
--
2.41.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* Patch "MIPS: Prefer cc-option for additions to cflags" has been added to the 6.1-stable tree
2023-06-14 18:04 ` [PATCH 6.1 3/4] MIPS: Prefer cc-option for additions to cflags Nathan Chancellor
@ 2023-06-19 7:51 ` gregkh
0 siblings, 0 replies; 10+ messages in thread
From: gregkh @ 2023-06-19 7:51 UTC (permalink / raw)
To: anders.roxell, gregkh, lkft, llvm, masahiroy, naresh.kamboju,
nathan, ndesaulniers, philmd, sashal, tsbogend
Cc: stable-commits
This is a note to let you know that I've just added the patch titled
MIPS: Prefer cc-option for additions to cflags
to the 6.1-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
mips-prefer-cc-option-for-additions-to-cflags.patch
and it can be found in the queue-6.1 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
From nathan@kernel.org Wed Jun 14 20:04:43 2023
From: Nathan Chancellor <nathan@kernel.org>
Date: Wed, 14 Jun 2023 11:04:37 -0700
Subject: MIPS: Prefer cc-option for additions to cflags
To: gregkh@linuxfoundation.org, sashal@kernel.org, ndesaulniers@google.com
Cc: naresh.kamboju@linaro.org, stable@vger.kernel.org, llvm@lists.linux.dev, "Nathan Chancellor" <nathan@kernel.org>, "Thomas Bogendoerfer" <tsbogend@alpha.franken.de>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, "Linux Kernel Functional Testing" <lkft@linaro.org>, "Anders Roxell" <anders.roxell@linaro.org>, "Masahiro Yamada" <masahiroy@kernel.org>
Message-ID: <20230612-6-1-asssembler-target-llvm-17-v1-3-75605d553401@kernel.org>
From: Nathan Chancellor <nathan@kernel.org>
commit 337ff6bb8960fdc128cabd264aaea3d42ca27a32 upstream.
A future change will switch as-option to use KBUILD_AFLAGS instead of
KBUILD_CFLAGS to allow clang to drop -Qunused-arguments, which may cause
issues if the flag being tested requires a flag previously added to
KBUILD_CFLAGS but not KBUILD_AFLAGS. Use cc-option for cflags additions
so that the flags are tested properly.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Acked-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Tested-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/mips/Makefile | 2 +-
arch/mips/loongson2ef/Platform | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -152,7 +152,7 @@ cflags-y += -fno-stack-check
#
# Avoid this by explicitly disabling that assembler behaviour.
#
-cflags-y += $(call as-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
+cflags-y += $(call cc-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
#
# CPU-dependent compiler/assembler options for optimization.
--- a/arch/mips/loongson2ef/Platform
+++ b/arch/mips/loongson2ef/Platform
@@ -25,7 +25,7 @@ cflags-$(CONFIG_CPU_LOONGSON2F) += -marc
# binutils does not merge support for the flag then we can revisit & remove
# this later - for now it ensures vendor toolchains don't cause problems.
#
-cflags-$(CONFIG_CPU_LOONGSON2EF) += $(call as-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
+cflags-$(CONFIG_CPU_LOONGSON2EF) += $(call cc-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
# Enable the workarounds for Loongson2f
ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS
Patches currently in stable-queue which might be from nathan@kernel.org are
queue-6.1/riscv-purgatory-remove-pgo-flags.patch
queue-6.1/powerpc-purgatory-remove-pgo-flags.patch
queue-6.1/mips-move-wa-msoft-float-check-from-as-option-to-cc-option.patch
queue-6.1/kexec-support-purgatories-with-.text.hot-sections.patch
queue-6.1/mips-prefer-cc-option-for-additions-to-cflags.patch
queue-6.1/x86-purgatory-remove-pgo-flags.patch
queue-6.1/x86-boot-compressed-prefer-cc-option-for-cflags-additions.patch
queue-6.1/kbuild-update-assembler-calls-to-use-proper-flags-and-language-target.patch
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 6.1 4/4] kbuild: Update assembler calls to use proper flags and language target
2023-06-14 18:04 [PATCH 6.1 0/4] Update as-{instr,option} to use KBUILD_AFLAGS Nathan Chancellor
` (2 preceding siblings ...)
2023-06-14 18:04 ` [PATCH 6.1 3/4] MIPS: Prefer cc-option for additions to cflags Nathan Chancellor
@ 2023-06-14 18:04 ` Nathan Chancellor
2023-06-19 7:51 ` Patch "kbuild: Update assembler calls to use proper flags and language target" has been added to the 6.1-stable tree gregkh
2023-06-19 7:51 ` [PATCH 6.1 0/4] Update as-{instr,option} to use KBUILD_AFLAGS Greg KH
4 siblings, 1 reply; 10+ messages in thread
From: Nathan Chancellor @ 2023-06-14 18:04 UTC (permalink / raw)
To: gregkh, sashal, ndesaulniers
Cc: naresh.kamboju, stable, llvm, Masahiro Yamada, Nathan Chancellor,
Linux Kernel Functional Testing, Anders Roxell
From: Nick Desaulniers <ndesaulniers@google.com>
commit d5c8d6e0fa61401a729e9eb6a9c7077b2d3aebb0 upstream.
as-instr uses KBUILD_AFLAGS, but as-option uses KBUILD_CFLAGS. This can
cause as-option to fail unexpectedly when CONFIG_WERROR is set, because
clang will emit -Werror,-Wunused-command-line-argument for various -m
and -f flags in KBUILD_CFLAGS for assembler sources.
Callers of as-option and as-instr should be adding flags to
KBUILD_AFLAGS / aflags-y, not KBUILD_CFLAGS / cflags-y. Use
KBUILD_AFLAGS in all macros to clear up the initial problem.
Unfortunately, -Wunused-command-line-argument can still be triggered
with clang by the presence of warning flags or macro definitions because
'-x assembler' is used, instead of '-x assembler-with-cpp', which will
consume these flags. Switch to '-x assembler-with-cpp' in places where
'-x assembler' is used, as the compiler is always used as the driver for
out of line assembler sources in the kernel.
Finally, add -Werror to these macros so that they behave consistently
whether or not CONFIG_WERROR is set.
[nathan: Reworded and expanded on problems in commit message
Use '-x assembler-with-cpp' in a couple more places]
Link: https://github.com/ClangBuiltLinux/linux/issues/1699
Suggested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Tested-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
scripts/Kconfig.include | 2 +-
scripts/Makefile.compiler | 8 ++++----
scripts/as-version.sh | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/scripts/Kconfig.include b/scripts/Kconfig.include
index 274125307ebd..5a84b6443875 100644
--- a/scripts/Kconfig.include
+++ b/scripts/Kconfig.include
@@ -33,7 +33,7 @@ ld-option = $(success,$(LD) -v $(1))
# $(as-instr,<instr>)
# Return y if the assembler supports <instr>, n otherwise
-as-instr = $(success,printf "%b\n" "$(1)" | $(CC) $(CLANG_FLAGS) -c -x assembler -o /dev/null -)
+as-instr = $(success,printf "%b\n" "$(1)" | $(CC) $(CLANG_FLAGS) -c -x assembler-with-cpp -o /dev/null -)
# check if $(CC) and $(LD) exist
$(error-if,$(failure,command -v $(CC)),C compiler '$(CC)' not found)
diff --git a/scripts/Makefile.compiler b/scripts/Makefile.compiler
index 20d353dcabfb..158c57f2acfd 100644
--- a/scripts/Makefile.compiler
+++ b/scripts/Makefile.compiler
@@ -29,16 +29,16 @@ try-run = $(shell set -e; \
fi)
# as-option
-# Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
+# Usage: aflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
as-option = $(call try-run,\
- $(CC) $(KBUILD_CFLAGS) $(1) -c -x assembler /dev/null -o "$$TMP",$(1),$(2))
+ $(CC) -Werror $(KBUILD_AFLAGS) $(1) -c -x assembler-with-cpp /dev/null -o "$$TMP",$(1),$(2))
# as-instr
-# Usage: cflags-y += $(call as-instr,instr,option1,option2)
+# Usage: aflags-y += $(call as-instr,instr,option1,option2)
as-instr = $(call try-run,\
- printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3))
+ printf "%b\n" "$(1)" | $(CC) -Werror $(KBUILD_AFLAGS) -c -x assembler-with-cpp -o "$$TMP" -,$(2),$(3))
# __cc-option
# Usage: MY_CFLAGS += $(call __cc-option,$(CC),$(MY_CFLAGS),-march=winchip-c6,-march=i586)
diff --git a/scripts/as-version.sh b/scripts/as-version.sh
index 1a21495e9ff0..af717476152d 100755
--- a/scripts/as-version.sh
+++ b/scripts/as-version.sh
@@ -45,7 +45,7 @@ orig_args="$@"
# Get the first line of the --version output.
IFS='
'
-set -- $(LC_ALL=C "$@" -Wa,--version -c -x assembler /dev/null -o /dev/null 2>/dev/null)
+set -- $(LC_ALL=C "$@" -Wa,--version -c -x assembler-with-cpp /dev/null -o /dev/null 2>/dev/null)
# Split the line on spaces.
IFS=' '
--
2.41.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* Patch "kbuild: Update assembler calls to use proper flags and language target" has been added to the 6.1-stable tree
2023-06-14 18:04 ` [PATCH 6.1 4/4] kbuild: Update assembler calls to use proper flags and language target Nathan Chancellor
@ 2023-06-19 7:51 ` gregkh
0 siblings, 0 replies; 10+ messages in thread
From: gregkh @ 2023-06-19 7:51 UTC (permalink / raw)
To: anders.roxell, gregkh, lkft, llvm, masahiroy, naresh.kamboju,
nathan, ndesaulniers, sashal
Cc: stable-commits
This is a note to let you know that I've just added the patch titled
kbuild: Update assembler calls to use proper flags and language target
to the 6.1-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
kbuild-update-assembler-calls-to-use-proper-flags-and-language-target.patch
and it can be found in the queue-6.1 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
From nathan@kernel.org Wed Jun 14 20:04:43 2023
From: Nathan Chancellor <nathan@kernel.org>
Date: Wed, 14 Jun 2023 11:04:38 -0700
Subject: kbuild: Update assembler calls to use proper flags and language target
To: gregkh@linuxfoundation.org, sashal@kernel.org, ndesaulniers@google.com
Cc: naresh.kamboju@linaro.org, stable@vger.kernel.org, llvm@lists.linux.dev, Masahiro Yamada <masahiroy@kernel.org>, Nathan Chancellor <nathan@kernel.org>, Linux Kernel Functional Testing <lkft@linaro.org>, Anders Roxell <anders.roxell@linaro.org>
Message-ID: <20230612-6-1-asssembler-target-llvm-17-v1-4-75605d553401@kernel.org>
From: Nick Desaulniers <ndesaulniers@google.com>
commit d5c8d6e0fa61401a729e9eb6a9c7077b2d3aebb0 upstream.
as-instr uses KBUILD_AFLAGS, but as-option uses KBUILD_CFLAGS. This can
cause as-option to fail unexpectedly when CONFIG_WERROR is set, because
clang will emit -Werror,-Wunused-command-line-argument for various -m
and -f flags in KBUILD_CFLAGS for assembler sources.
Callers of as-option and as-instr should be adding flags to
KBUILD_AFLAGS / aflags-y, not KBUILD_CFLAGS / cflags-y. Use
KBUILD_AFLAGS in all macros to clear up the initial problem.
Unfortunately, -Wunused-command-line-argument can still be triggered
with clang by the presence of warning flags or macro definitions because
'-x assembler' is used, instead of '-x assembler-with-cpp', which will
consume these flags. Switch to '-x assembler-with-cpp' in places where
'-x assembler' is used, as the compiler is always used as the driver for
out of line assembler sources in the kernel.
Finally, add -Werror to these macros so that they behave consistently
whether or not CONFIG_WERROR is set.
[nathan: Reworded and expanded on problems in commit message
Use '-x assembler-with-cpp' in a couple more places]
Link: https://github.com/ClangBuiltLinux/linux/issues/1699
Suggested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Tested-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
scripts/Kconfig.include | 2 +-
scripts/Makefile.compiler | 8 ++++----
scripts/as-version.sh | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
--- a/scripts/Kconfig.include
+++ b/scripts/Kconfig.include
@@ -33,7 +33,7 @@ ld-option = $(success,$(LD) -v $(1))
# $(as-instr,<instr>)
# Return y if the assembler supports <instr>, n otherwise
-as-instr = $(success,printf "%b\n" "$(1)" | $(CC) $(CLANG_FLAGS) -c -x assembler -o /dev/null -)
+as-instr = $(success,printf "%b\n" "$(1)" | $(CC) $(CLANG_FLAGS) -c -x assembler-with-cpp -o /dev/null -)
# check if $(CC) and $(LD) exist
$(error-if,$(failure,command -v $(CC)),C compiler '$(CC)' not found)
--- a/scripts/Makefile.compiler
+++ b/scripts/Makefile.compiler
@@ -29,16 +29,16 @@ try-run = $(shell set -e; \
fi)
# as-option
-# Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
+# Usage: aflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
as-option = $(call try-run,\
- $(CC) $(KBUILD_CFLAGS) $(1) -c -x assembler /dev/null -o "$$TMP",$(1),$(2))
+ $(CC) -Werror $(KBUILD_AFLAGS) $(1) -c -x assembler-with-cpp /dev/null -o "$$TMP",$(1),$(2))
# as-instr
-# Usage: cflags-y += $(call as-instr,instr,option1,option2)
+# Usage: aflags-y += $(call as-instr,instr,option1,option2)
as-instr = $(call try-run,\
- printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3))
+ printf "%b\n" "$(1)" | $(CC) -Werror $(KBUILD_AFLAGS) -c -x assembler-with-cpp -o "$$TMP" -,$(2),$(3))
# __cc-option
# Usage: MY_CFLAGS += $(call __cc-option,$(CC),$(MY_CFLAGS),-march=winchip-c6,-march=i586)
--- a/scripts/as-version.sh
+++ b/scripts/as-version.sh
@@ -45,7 +45,7 @@ orig_args="$@"
# Get the first line of the --version output.
IFS='
'
-set -- $(LC_ALL=C "$@" -Wa,--version -c -x assembler /dev/null -o /dev/null 2>/dev/null)
+set -- $(LC_ALL=C "$@" -Wa,--version -c -x assembler-with-cpp /dev/null -o /dev/null 2>/dev/null)
# Split the line on spaces.
IFS=' '
Patches currently in stable-queue which might be from nathan@kernel.org are
queue-6.1/riscv-purgatory-remove-pgo-flags.patch
queue-6.1/powerpc-purgatory-remove-pgo-flags.patch
queue-6.1/mips-move-wa-msoft-float-check-from-as-option-to-cc-option.patch
queue-6.1/kexec-support-purgatories-with-.text.hot-sections.patch
queue-6.1/mips-prefer-cc-option-for-additions-to-cflags.patch
queue-6.1/x86-purgatory-remove-pgo-flags.patch
queue-6.1/x86-boot-compressed-prefer-cc-option-for-cflags-additions.patch
queue-6.1/kbuild-update-assembler-calls-to-use-proper-flags-and-language-target.patch
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 6.1 0/4] Update as-{instr,option} to use KBUILD_AFLAGS
2023-06-14 18:04 [PATCH 6.1 0/4] Update as-{instr,option} to use KBUILD_AFLAGS Nathan Chancellor
` (3 preceding siblings ...)
2023-06-14 18:04 ` [PATCH 6.1 4/4] kbuild: Update assembler calls to use proper flags and language target Nathan Chancellor
@ 2023-06-19 7:51 ` Greg KH
4 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2023-06-19 7:51 UTC (permalink / raw)
To: Nathan Chancellor
Cc: sashal, ndesaulniers, naresh.kamboju, stable, llvm,
Masahiro Yamada, Linux Kernel Functional Testing, Anders Roxell,
tsbogend, linux-mips, Philippe Mathieu-Daudé
On Wed, Jun 14, 2023 at 11:04:34AM -0700, Nathan Chancellor wrote:
> Hi all,
>
> This series backports commit d5c8d6e0fa61 ("kbuild: Update assembler
> calls to use proper flags and language target") to linux-6.1.y to
> address a recent issue caused by a change in behavior in clang:
>
> https://lore.kernel.org/CA+G9fYsJq0sPC+q6vLNKUgBqCGmmjDrfeP4R1-95Eu28FJRY_A@mail.gmail.com/
> https://lore.kernel.org/20230612185424.GA2891387@dev-arch.thelio-3990X/
>
> While that was not the original intention of the aforementioned change,
> it ends up resolving the issue for the same reason, by not passing flags
> that are not supported or necessary for the current language target
> (KBUILD_CFLAGS for .c files and KBUILD_AFLAGS for .S files) when testing
> flags for that language target.
>
> All patches except the second one are direct backports from mainline.
> The second patch is a stable specific patch because the upstream
> solution could break stable due to the minimum supported version of
> binutils in mainline being a newer version than 6.1 and earlier; it
> chooses to do the more conservative fix, which was alluded to in the
> changelog of the upstream commit.
>
> For now, this is just a 6.1 issue. If the issue occurs in older
> releases, I will send separate backports. If there are any issues or
> objections to this series, please let me know.
All now queued up, thanks.
greg k-h
^ permalink raw reply [flat|nested] 10+ messages in thread