This is an updated version of [1], just for 5.4, which was waiting on commit 87c4e1459e80 ("ARM: 9448/1: Use an absolute path to unified.h in KBUILD_AFLAGS") to avoid regressing the build [2].
These changes are needed there due to an upstream LLVM change [3] that changes the behavior of -Qunused-arguments with unknown target options, which is only used in 6.1 and older since I removed it in commit 8d9acfce3332 ("kbuild: Stop using '-Qunused-arguments' with clang") in 6.3.
Please let me know if there are any issues.
[1]: https://lore.kernel.org/20250604233141.GA2374479@ax162/ [2]: https://lore.kernel.org/CACo-S-1qbCX4WAVFA63dWfHtrRHZBTyyr2js8Lx=Az03XHTTHg@... [3]: https://github.com/llvm/llvm-project/commit/a4b2f4a72aa9b4655ecc723838830e0a...
Masahiro Yamada (1): kbuild: add $(CLANG_FLAGS) to KBUILD_CPPFLAGS
Nathan Chancellor (4): ARM: 9448/1: Use an absolute path to unified.h in KBUILD_AFLAGS mips: Include KBUILD_CPPFLAGS in CHECKFLAGS invocation kbuild: Add CLANG_FLAGS to as-instr kbuild: Add KBUILD_CPPFLAGS to as-option invocation
Nick Desaulniers (1): kbuild: Update assembler calls to use proper flags and language target
Makefile | 3 +-- arch/arm/Makefile | 2 +- arch/mips/Makefile | 2 +- scripts/Kbuild.include | 8 ++++---- 4 files changed, 7 insertions(+), 8 deletions(-)
base-commit: 04b7726c3cdd2fb4da040c2b898bcf405ed607bd
commit 87c4e1459e80bf65066f864c762ef4dc932fad4b upstream.
After commit d5c8d6e0fa61 ("kbuild: Update assembler calls to use proper flags and language target"), which updated as-instr to use the 'assembler-with-cpp' language option, the Kbuild version of as-instr always fails internally for arch/arm with
<command-line>: fatal error: asm/unified.h: No such file or directory compilation terminated.
because '-include' flags are now taken into account by the compiler driver and as-instr does not have '$(LINUXINCLUDE)', so unified.h is not found.
This went unnoticed at the time of the Kbuild change because the last use of as-instr in Kbuild that arch/arm could reach was removed in 5.7 by commit 541ad0150ca4 ("arm: Remove 32bit KVM host support") but a stable backport of the Kbuild change to before that point exposed this potential issue if one were to be reintroduced.
Follow the general pattern of '-include' paths throughout the tree and make unified.h absolute using '$(srctree)' to ensure KBUILD_AFLAGS can be used independently.
Closes: https://lore.kernel.org/CACo-S-1qbCX4WAVFA63dWfHtrRHZBTyyr2js8Lx=Az03XHTTHg@...
Cc: stable@vger.kernel.org Fixes: d5c8d6e0fa61 ("kbuild: Update assembler calls to use proper flags and language target") Reported-by: KernelCI bot bot@kernelci.org Reviewed-by: Masahiro Yamada masahiroy@kernel.org Signed-off-by: Nathan Chancellor nathan@kernel.org Signed-off-by: Russell King (Oracle) rmk+kernel@armlinux.org.uk [nathan: Fix conflicts] Signed-off-by: Nathan Chancellor nathan@kernel.org --- arch/arm/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 4f098edfbf20..cb33ed8de5f8 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -136,7 +136,7 @@ endif
# Need -Uarm for gcc < 3.x KBUILD_CFLAGS +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm -KBUILD_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float +KBUILD_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include $(srctree)/arch/arm/include/asm/unified.h -msoft-float
CHECKFLAGS += -D__arm__
[ Sasha's backport helper bot ]
Hi,
✅ All tests passed successfully. No issues detected. No action required from the submitter.
The upstream commit SHA1 provided is correct: 87c4e1459e80bf65066f864c762ef4dc932fad4b
Status in newer kernel trees: 6.15.y | Not found 6.12.y | Not found 6.6.y | Not found 6.1.y | Not found 5.15.y | Not found 5.10.y | Not found
Note: The patch differs from the upstream commit: --- 1: 87c4e1459e80 < -: ------------ ARM: 9448/1: Use an absolute path to unified.h in KBUILD_AFLAGS -: ------------ > 1: 8bf09d3cd9a8 ARM: 9448/1: Use an absolute path to unified.h in KBUILD_AFLAGS
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | 5.4 | Success | Success |
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/Kbuild.include | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 82eb69f07b35..11f905b95e65 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -99,16 +99,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)
[ Sasha's backport helper bot ]
Hi,
Summary of potential issues: ℹ️ This is part 2/6 of a series ⚠️ Found follow-up fixes in mainline
The upstream commit SHA1 provided is correct: d5c8d6e0fa61401a729e9eb6a9c7077b2d3aebb0
WARNING: Author mismatch between patch and upstream commit: Backport author: Nathan Chancellor nathan@kernel.org Commit author: Nick Desaulniers ndesaulniers@google.com
Status in newer kernel trees: 6.15.y | Present (exact SHA1) 6.12.y | Present (exact SHA1) 6.6.y | Present (exact SHA1) 6.1.y | Present (different SHA1: a76d4933c38e) 5.15.y | Present (different SHA1: cefb372db498) 5.10.y | Present (different SHA1: 7fa1764188bf)
Found fixes commits: 87c4e1459e80 ARM: 9448/1: Use an absolute path to unified.h in KBUILD_AFLAGS
Note: The patch differs from the upstream commit: --- 1: d5c8d6e0fa61 ! 1: e516ff739515 kbuild: Update assembler calls to use proper flags and language target @@ Metadata ## Commit message ## kbuild: Update assembler calls to use proper flags and language target
+ 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 @@ Commit message 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 ## -@@ scripts/Kconfig.include: 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) - - ## scripts/Makefile.compiler ## -@@ scripts/Makefile.compiler: try-run = $(shell set -e; \ + ## scripts/Kbuild.include ## +@@ scripts/Kbuild.include: try-run = $(shell set -e; \ fi)
# as-option @@ scripts/Makefile.compiler: try-run = $(shell set -e; \
# __cc-option # Usage: MY_CFLAGS += $(call __cc-option,$(CC),$(MY_CFLAGS),-march=winchip-c6,-march=i586) - - ## scripts/as-version.sh ## -@@ scripts/as-version.sh: 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=' '
---
NOTE: These results are for this patch alone. Full series testing will be performed when all parts are received.
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | 5.4 | Success | Success |
On Tue, Aug 12, 2025 at 12:12:27AM -0400, Sasha Levin wrote:
The upstream commit SHA1 provided is correct: d5c8d6e0fa61401a729e9eb6a9c7077b2d3aebb0
WARNING: Author mismatch between patch and upstream commit: Backport author: Nathan Chancellor nathan@kernel.org Commit author: Nick Desaulniers ndesaulniers@google.com
Same comment as the other change, there is a From: line in the patch, so shouldn't Nick still have authorship of the backport?
Found fixes commits: 87c4e1459e80 ARM: 9448/1: Use an absolute path to unified.h in KBUILD_AFLAGS
Present as the first change of the series.
Cheers, Nathan
commit 08f6554ff90ef189e6b8f0303e57005bddfdd6a7 upstream.
A future change will move CLANG_FLAGS from KBUILD_{A,C}FLAGS to KBUILD_CPPFLAGS so that '--target' is available while preprocessing. When that occurs, the following error appears when building ARCH=mips with clang (tip of tree error shown):
clang: error: unsupported option '-mabi=' for target 'x86_64-pc-linux-gnu'
Add KBUILD_CPPFLAGS in the CHECKFLAGS invocation to keep everything working after the move.
Signed-off-by: Nathan Chancellor nathan@kernel.org Signed-off-by: Masahiro Yamada masahiroy@kernel.org Signed-off-by: Nathan Chancellor nathan@kernel.org --- arch/mips/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/mips/Makefile b/arch/mips/Makefile index 4542258027a7..cc6f8265f28c 100644 --- a/arch/mips/Makefile +++ b/arch/mips/Makefile @@ -319,7 +319,7 @@ KBUILD_CFLAGS += -fno-asynchronous-unwind-tables KBUILD_LDFLAGS += -m $(ld-emul)
ifdef CONFIG_MIPS -CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \ +CHECKFLAGS += $(shell $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \ egrep -vw '__GNUC_(MINOR_|PATCHLEVEL_)?_' | \ sed -e "s/^#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/$$/&&/g') endif
[ Sasha's backport helper bot ]
Hi,
✅ All tests passed successfully. No issues detected. No action required from the submitter.
The upstream commit SHA1 provided is correct: 08f6554ff90ef189e6b8f0303e57005bddfdd6a7
Status in newer kernel trees: 6.15.y | Present (exact SHA1) 6.12.y | Present (exact SHA1) 6.6.y | Present (exact SHA1) 6.1.y | Present (different SHA1: 2995dbfe98e7) 5.15.y | Present (different SHA1: d36719f29376) 5.10.y | Present (different SHA1: 9562b9f708e9)
Note: The patch differs from the upstream commit: --- 1: 08f6554ff90e ! 1: 49e341f4bf2e mips: Include KBUILD_CPPFLAGS in CHECKFLAGS invocation @@ Metadata ## Commit message ## mips: Include KBUILD_CPPFLAGS in CHECKFLAGS invocation
+ commit 08f6554ff90ef189e6b8f0303e57005bddfdd6a7 upstream. + A future change will move CLANG_FLAGS from KBUILD_{A,C}FLAGS to KBUILD_CPPFLAGS so that '--target' is available while preprocessing. When that occurs, the following error appears when building ARCH=mips @@ Commit message
Signed-off-by: Nathan Chancellor nathan@kernel.org Signed-off-by: Masahiro Yamada masahiroy@kernel.org + Signed-off-by: Nathan Chancellor nathan@kernel.org
## arch/mips/Makefile ## @@ arch/mips/Makefile: KBUILD_CFLAGS += -fno-asynchronous-unwind-tables @@ arch/mips/Makefile: KBUILD_CFLAGS += -fno-asynchronous-unwind-tables ifdef CONFIG_MIPS -CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \ +CHECKFLAGS += $(shell $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \ - grep -E -vw '__GNUC_(MINOR_|PATCHLEVEL_)?_' | \ + egrep -vw '__GNUC_(MINOR_|PATCHLEVEL_)?_' | \ sed -e "s/^#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/$$/&&/g') endif
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | 5.4 | Success | Success |
commit cff6e7f50bd315e5b39c4e46c704ac587ceb965f upstream.
A future change will move CLANG_FLAGS from KBUILD_{A,C}FLAGS to KBUILD_CPPFLAGS so that '--target' is available while preprocessing. When that occurs, the following errors appear multiple times when building ARCH=powerpc powernv_defconfig:
ld.lld: error: vmlinux.a(arch/powerpc/kernel/head_64.o):(.text+0x12d4): relocation R_PPC64_ADDR16_HI out of range: -4611686018409717520 is not in [-2147483648, 2147483647]; references '__start___soft_mask_table' ld.lld: error: vmlinux.a(arch/powerpc/kernel/head_64.o):(.text+0x12e8): relocation R_PPC64_ADDR16_HI out of range: -4611686018409717392 is not in [-2147483648, 2147483647]; references '__stop___soft_mask_table'
Diffing the .o.cmd files reveals that -DHAVE_AS_ATHIGH=1 is not present anymore, because as-instr only uses KBUILD_AFLAGS, which will no longer contain '--target'.
Mirror Kconfig's as-instr and add CLANG_FLAGS explicitly to the invocation to ensure the target information is always present.
Signed-off-by: Nathan Chancellor nathan@kernel.org Signed-off-by: Masahiro Yamada masahiroy@kernel.org Signed-off-by: Nathan Chancellor nathan@kernel.org --- scripts/Kbuild.include | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 11f905b95e65..b01d3108596b 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -108,7 +108,7 @@ as-option = $(call try-run,\ # Usage: aflags-y += $(call as-instr,instr,option1,option2)
as-instr = $(call try-run,\ - printf "%b\n" "$(1)" | $(CC) -Werror $(KBUILD_AFLAGS) -c -x assembler-with-cpp -o "$$TMP" -,$(2),$(3)) + printf "%b\n" "$(1)" | $(CC) -Werror $(CLANG_FLAGS) $(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)
[ Sasha's backport helper bot ]
Hi,
✅ All tests passed successfully. No issues detected. No action required from the submitter.
The upstream commit SHA1 provided is correct: cff6e7f50bd315e5b39c4e46c704ac587ceb965f
Status in newer kernel trees: 6.15.y | Present (exact SHA1) 6.12.y | Present (exact SHA1) 6.6.y | Present (exact SHA1) 6.1.y | Present (different SHA1: ae5a2797e742) 5.15.y | Present (different SHA1: f85d6a08cc9f) 5.10.y | Present (different SHA1: 58c2cac0e779)
Note: Could not generate a diff with upstream commit: --- Note: Could not generate diff - patch failed to apply for comparison ---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | 5.4 | Success | Success |
From: Masahiro Yamada masahiroy@kernel.org
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@konsulko.com Signed-off-by: Masahiro Yamada masahiroy@kernel.org Reviewed-by: Nathan Chancellor nathan@kernel.org Tested-by: Nathan Chancellor nathan@kernel.org Signed-off-by: Nathan Chancellor nathan@kernel.org --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/Makefile b/Makefile index f65e282f4a3f..16a23aaaa547 100644 --- a/Makefile +++ b/Makefile @@ -568,8 +568,7 @@ ifneq ($(LLVM_IAS),1) CLANG_FLAGS += -no-integrated-as endif CLANG_FLAGS += -Werror=unknown-warning-option -KBUILD_CFLAGS += $(CLANG_FLAGS) -KBUILD_AFLAGS += $(CLANG_FLAGS) +KBUILD_CPPFLAGS += $(CLANG_FLAGS) export CLANG_FLAGS endif
[ Sasha's backport helper bot ]
Hi,
Summary of potential issues: ℹ️ This is part 5/6 of a series ⚠️ Found follow-up fixes in mainline
The upstream commit SHA1 provided is correct: feb843a469fb0ab00d2d23cfb9bcc379791011bb
WARNING: Author mismatch between patch and upstream commit: Backport author: Nathan Chancellor nathan@kernel.org Commit author: Masahiro Yamada masahiroy@kernel.org
Status in newer kernel trees: 6.15.y | Present (exact SHA1) 6.12.y | Present (exact SHA1) 6.6.y | Present (exact SHA1) 6.1.y | Not found 5.15.y | Not found 5.10.y | Not found
Found fixes commits: 02e9a22ceef0 kbuild: hdrcheck: fix cross build with clang 1b71c2fb04e7 kbuild: userprogs: fix bitsize and target detection on clang 43fc0a99906e kbuild: Add KBUILD_CPPFLAGS to as-option invocation
Note: The patch differs from the upstream commit: --- 1: feb843a469fb < -: ------------ kbuild: add $(CLANG_FLAGS) to KBUILD_CPPFLAGS -: ------------ > 1: 69d313b2b765 kbuild: add $(CLANG_FLAGS) to KBUILD_CPPFLAGS
---
NOTE: These results are for this patch alone. Full series testing will be performed when all parts are received.
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | 5.4 | Success | Success |
Hi,
On Tue, Aug 12, 2025 at 12:12:25AM -0400, Sasha Levin wrote:
The upstream commit SHA1 provided is correct: feb843a469fb0ab00d2d23cfb9bcc379791011bb
WARNING: Author mismatch between patch and upstream commit: Backport author: Nathan Chancellor nathan@kernel.org Commit author: Masahiro Yamada masahiroy@kernel.org
Hmmm, the patch has a "From:" header that has Masahiro as the author, is that not sufficient for authorship?
Status in newer kernel trees:
...
6.1.y | Not found 5.15.y | Not found 5.10.y | Not found
Odd, it appears to be there to me?
6.1.142: 8d21861f91a1 ("kbuild: add $(CLANG_FLAGS) to KBUILD_CPPFLAGS") 5.15.186: 0690824cc325 ("kbuild: add $(CLANG_FLAGS) to KBUILD_CPPFLAGS") 5.10.239: 951dfb0bdcd6 ("kbuild: add $(CLANG_FLAGS) to KBUILD_CPPFLAGS")
Found fixes commits: 02e9a22ceef0 kbuild: hdrcheck: fix cross build with clang
Unnecessary in 5.4: https://lore.kernel.org/20250617233200.GC3356351@ax162/
1b71c2fb04e7 kbuild: userprogs: fix bitsize and target detection on clang
Uncessary in 5.4: https://lore.kernel.org/20250617232006.GB3356351@ax162/
43fc0a99906e kbuild: Add KBUILD_CPPFLAGS to as-option invocation
43fc0a99906e is present in this series after feb843a469fb0a because that is how it happened upstream but 43fc0a99906e could be applied before feb843a469fb0a in stable.
Cheers, Nathan
commit 43fc0a99906e04792786edf8534d8d58d1e9de0c upstream.
After commit feb843a469fb ("kbuild: add $(CLANG_FLAGS) to KBUILD_CPPFLAGS"), there is an error while building certain PowerPC assembly files with clang:
arch/powerpc/lib/copypage_power7.S: Assembler messages: arch/powerpc/lib/copypage_power7.S:34: Error: junk at end of line: `0b01000' arch/powerpc/lib/copypage_power7.S:35: Error: junk at end of line: `0b01010' arch/powerpc/lib/copypage_power7.S:37: Error: junk at end of line: `0b01000' arch/powerpc/lib/copypage_power7.S:38: Error: junk at end of line: `0b01010' arch/powerpc/lib/copypage_power7.S:40: Error: junk at end of line: `0b01010' clang: error: assembler command failed with exit code 1 (use -v to see invocation)
as-option only uses KBUILD_AFLAGS, so after removing CLANG_FLAGS from KBUILD_AFLAGS, there is no more '--target=' or '--prefix=' flags. As a result of those missing flags, the host target will be tested during as-option calls and likely fail, meaning necessary flags may not get added when building assembly files, resulting in errors like seen above.
Add KBUILD_CPPFLAGS to as-option invocations to clear up the errors. This should have been done in commit d5c8d6e0fa61 ("kbuild: Update assembler calls to use proper flags and language target"), which switched from using the assembler target to the assembler-with-cpp target, so flags that affect preprocessing are passed along in all relevant tests. as-option now mirrors cc-option.
Fixes: feb843a469fb ("kbuild: add $(CLANG_FLAGS) to KBUILD_CPPFLAGS") Reported-by: Linux Kernel Functional Testing lkft@linaro.org Closes: https://lore.kernel.org/CA+G9fYs=koW9WardsTtora+nMgLR3raHz-LSLr58tgX4T5Mxag@... Signed-off-by: Nathan Chancellor nathan@kernel.org Tested-by: Naresh Kamboju naresh.kamboju@linaro.org Signed-off-by: Masahiro Yamada masahiroy@kernel.org Signed-off-by: Nathan Chancellor nathan@kernel.org --- scripts/Kbuild.include | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index b01d3108596b..4d2b8e659747 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -102,7 +102,7 @@ try-run = $(shell set -e; \ # Usage: aflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
as-option = $(call try-run,\ - $(CC) -Werror $(KBUILD_AFLAGS) $(1) -c -x assembler-with-cpp /dev/null -o "$$TMP",$(1),$(2)) + $(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_AFLAGS) $(1) -c -x assembler-with-cpp /dev/null -o "$$TMP",$(1),$(2))
# as-instr # Usage: aflags-y += $(call as-instr,instr,option1,option2)
[ Sasha's backport helper bot ]
Hi,
✅ All tests passed successfully. No issues detected. No action required from the submitter.
The upstream commit SHA1 provided is correct: 43fc0a99906e04792786edf8534d8d58d1e9de0c
Status in newer kernel trees: 6.15.y | Present (exact SHA1) 6.12.y | Present (exact SHA1) 6.6.y | Present (exact SHA1) 6.1.y | Present (different SHA1: 0f8b3913b3fd) 5.15.y | Present (different SHA1: 510ce6a1393c) 5.10.y | Present (different SHA1: 79a4fba715fa)
Note: Could not generate a diff with upstream commit: --- Note: Could not generate diff - patch failed to apply for comparison ---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | 5.4 | Success | Success |
linux-stable-mirror@lists.linaro.org