diff mbox series

[2/2] LoongArch: Include KBUILD_CPPFLAGS in CHECKFLAGS invocation

Message ID 20230627130122.1491765-3-kernel@xen0n.name (mailing list archive)
State New, archived
Headers show
Series Fix cross-compilation issues with Clang | expand

Commit Message

WANG Xuerui June 27, 2023, 1:01 p.m. UTC
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(-)

Comments

Nathan Chancellor June 27, 2023, 4:25 p.m. UTC | #1
On Tue, Jun 27, 2023 at 09:01:22PM +0800, WANG Xuerui wrote:
> 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>

Thanks for the patch!

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
>  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
>
Huacai Chen June 28, 2023, 4:22 a.m. UTC | #2
Queued for loongarch-next, thanks.

Huacai

On Wed, Jun 28, 2023 at 12:25 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> On Tue, Jun 27, 2023 at 09:01:22PM +0800, WANG Xuerui wrote:
> > 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>
>
> Thanks for the patch!
>
> Reviewed-by: Nathan Chancellor <nathan@kernel.org>
>
> > ---
> >  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
> >
diff mbox series

Patch

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