Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: WANG Xuerui <kernel@xen0n.name>
To: Huacai Chen <chenhuacai@kernel.org>
Cc: WANG Rui <wangrui@loongson.cn>,
	Nathan Chancellor <nathan@kernel.org>,
	Xi Ruoyao <xry111@xry111.site>,
	loongarch@lists.linux.dev, linux-kbuild@vger.kernel.org,
	llvm@lists.linux.dev, linux-kernel@vger.kernel.org,
	WANG Xuerui <git@xen0n.name>
Subject: [PATCH 2/2] LoongArch: Include KBUILD_CPPFLAGS in CHECKFLAGS invocation
Date: Tue, 27 Jun 2023 21:01:22 +0800	[thread overview]
Message-ID: <20230627130122.1491765-3-kernel@xen0n.name> (raw)
In-Reply-To: <20230627130122.1491765-1-kernel@xen0n.name>

From: WANG Xuerui <git@xen0n.name>

This is a port of commit 08f6554ff90e ("mips: Include KBUILD_CPPFLAGS
in CHECKFLAGS invocation") to arch/loongarch, for fixing
cross-compilation of Linux/LoongArch with Clang, where previously the
`--target` flag would no longer be present for the CHECKFLAGS cc
invocation leading to build failure.

Reported-by: Nathan Chancellor <nathan@kernel.org>
Link: https://github.com/ClangBuiltLinux/linux/issues/1787#issuecomment-1608306002
Signed-off-by: WANG Xuerui <git@xen0n.name>
---
 arch/loongarch/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
index a63683da3bcf..09ba338a64de 100644
--- a/arch/loongarch/Makefile
+++ b/arch/loongarch/Makefile
@@ -112,7 +112,7 @@ KBUILD_CFLAGS += -isystem $(shell $(CC) -print-file-name=include)
 KBUILD_LDFLAGS	+= -m $(ld-emul)
 
 ifdef CONFIG_LOONGARCH
-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_)?_' | \
 	sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g')
 endif
-- 
2.40.0


  parent reply	other threads:[~2023-06-27 13:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-27 13:01 [PATCH 0/2] Fix cross-compilation issues with Clang WANG Xuerui
2023-06-27 13:01 ` [PATCH 1/2] LoongArch: vDSO: Use CLANG_FLAGS instead of filtering out '--target=' WANG Xuerui
2023-06-27 16:24   ` Nathan Chancellor
2023-06-28  4:22     ` Huacai Chen
2023-06-27 13:01 ` WANG Xuerui [this message]
2023-06-27 16:25   ` [PATCH 2/2] LoongArch: Include KBUILD_CPPFLAGS in CHECKFLAGS invocation Nathan Chancellor
2023-06-28  4:22     ` Huacai Chen
2023-06-27 16:32 ` [PATCH 0/2] Fix cross-compilation issues with Clang Nathan Chancellor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230627130122.1491765-3-kernel@xen0n.name \
    --to=kernel@xen0n.name \
    --cc=chenhuacai@kernel.org \
    --cc=git@xen0n.name \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=loongarch@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=wangrui@loongson.cn \
    --cc=xry111@xry111.site \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox