This is a note to let you know that I've just added the patch titled kbuild: add $(CLANG_FLAGS) to KBUILD_CPPFLAGS to the 6.4-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-add-clang_flags-to-kbuild_cppflags.patch and it can be found in the queue-6.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From feb843a469fb0ab00d2d23cfb9bcc379791011bb Mon Sep 17 00:00:00 2001 From: Masahiro Yamada <masahiroy@xxxxxxxxxx> Date: Sun, 9 Apr 2023 23:53:57 +0900 Subject: kbuild: add $(CLANG_FLAGS) to KBUILD_CPPFLAGS From: Masahiro Yamada <masahiroy@xxxxxxxxxx> commit feb843a469fb0ab00d2d23cfb9bcc379791011bb upstream. When preprocessing arch/*/kernel/vmlinux.lds.S, the target triple is not passed to $(CPP) because we add it only to KBUILD_{C,A}FLAGS. As a result, the linker script is preprocessed with predefined macros for the build host instead of the target. Assuming you use an x86 build machine, compare the following: $ clang -dM -E -x c /dev/null $ clang -dM -E -x c /dev/null -target aarch64-linux-gnu There is no actual problem presumably because our linker scripts do not rely on such predefined macros, but it is better to define correct ones. Move $(CLANG_FLAGS) to KBUILD_CPPFLAGS, so that all *.c, *.S, *.lds.S will be processed with the proper target triple. [Note] After the patch submission, we got an actual problem that needs this commit. (CBL issue 1859) Link: https://github.com/ClangBuiltLinux/linux/issues/1859 Reported-by: Tom Rini <trini@xxxxxxxxxxxx> Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx> Reviewed-by: Nathan Chancellor <nathan@xxxxxxxxxx> Tested-by: Nathan Chancellor <nathan@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- scripts/Makefile.clang | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/Makefile.clang b/scripts/Makefile.clang index 9076cc939e87..058a4c0f864e 100644 --- a/scripts/Makefile.clang +++ b/scripts/Makefile.clang @@ -34,6 +34,5 @@ CLANG_FLAGS += -Werror=unknown-warning-option CLANG_FLAGS += -Werror=ignored-optimization-argument CLANG_FLAGS += -Werror=option-ignored CLANG_FLAGS += -Werror=unused-command-line-argument -KBUILD_CFLAGS += $(CLANG_FLAGS) -KBUILD_AFLAGS += $(CLANG_FLAGS) +KBUILD_CPPFLAGS += $(CLANG_FLAGS) export CLANG_FLAGS -- 2.41.0 Patches currently in stable-queue which might be from masahiroy@xxxxxxxxxx are queue-6.4/kbuild-fix-cfi-failures-with-gcov.patch queue-6.4/mips-include-kbuild_cppflags-in-checkflags-invocation.patch queue-6.4/soc-fsl-qe-fix-usb.c-build-errors.patch queue-6.4/kbuild-add-clang_flags-to-as-instr.patch queue-6.4/modpost-fix-off-by-one-in-is_executable_section.patch queue-6.4/kbuild-builddeb-always-make-modules_install-to-insta.patch queue-6.4/modpost-remove-broken-calculation-of-exception_table.patch queue-6.4/kbuild-add-clang_flags-to-kbuild_cppflags.patch queue-6.4/media-cec-i2c-ch7322-also-select-regmap.patch queue-6.4/arc-define-asm_nl-and-__align-_str-outside-ifdef-__a.patch queue-6.4/kbuild-deb-pkg-remove-the-config_modules-check-in-bu.patch queue-6.4/modpost-fix-section-mismatch-message-for-r_arm_-pc24.patch queue-6.4/powerpc-vdso-include-clang_flags-explicitly-in-ldflags-y.patch queue-6.4/scripts-mksysmap-fix-badly-escaped.patch queue-6.4/modpost-fix-section-mismatch-message-for-r_arm_abs32.patch queue-6.4/kbuild-disable-gcov-for-.mod.o.patch queue-6.4/kbuild-add-kbuild_cppflags-to-as-option-invocation.patch