--- /dev/null
+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=' '
--- /dev/null
+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
+
--- /dev/null
+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
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
- drivers/target/target_core_transport.c | 2 ++
+ drivers/target/target_core_transport.c | 2 ++
1 file changed, 2 insertions(+)
-diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
-index 86adff2a86ed..687adc9e086c 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
-@@ -504,6 +504,8 @@ target_setup_session(struct se_portal_group *tpg,
+@@ -504,6 +504,8 @@ target_setup_session(struct se_portal_gr
free_sess:
transport_free_session(sess);
free_cnt:
target_free_cmd_counter(cmd_cnt);
return ERR_PTR(rc);
---
-2.41.0
-
net-sched-act_api-add-specific-ext_warn_msg-for-tc-action.patch
neighbour-delete-neigh_lookup_nodev-as-not-used.patch
scsi-target-core-fix-error-path-in-target_setup_session.patch
+x86-boot-compressed-prefer-cc-option-for-cflags-additions.patch
+mips-move-wa-msoft-float-check-from-as-option-to-cc-option.patch
+mips-prefer-cc-option-for-additions-to-cflags.patch
+kbuild-update-assembler-calls-to-use-proper-flags-and-language-target.patch
--- /dev/null
+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