* [PATCH 0/2] Fix cross-compilation issues with Clang
@ 2023-06-27 13:01 WANG Xuerui
2023-06-27 13:01 ` [PATCH 1/2] LoongArch: vDSO: Use CLANG_FLAGS instead of filtering out '--target=' WANG Xuerui
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: WANG Xuerui @ 2023-06-27 13:01 UTC (permalink / raw)
To: Huacai Chen
Cc: WANG Rui, Nathan Chancellor, Xi Ruoyao, loongarch, linux-kbuild,
llvm, linux-kernel, WANG Xuerui
From: WANG Xuerui <git@xen0n.name>
Hi,
Just some quick fixes to the recently accepted Clang patches, thanks to
Nathan's followup testing. (I test-compiled natively so didn't notice
that cross-compilation was broken, and by chance the LLVM snapshot I
used didn't contain the breaking commit either.)
With an additional LLVM patch https://reviews.llvm.org/D153865 the Clang
builds should now get fixed.
WANG Xuerui (2):
LoongArch: vDSO: Use CLANG_FLAGS instead of filtering out '--target='
LoongArch: Include KBUILD_CPPFLAGS in CHECKFLAGS invocation
arch/loongarch/Makefile | 2 +-
arch/loongarch/vdso/Makefile | 5 +----
2 files changed, 2 insertions(+), 5 deletions(-)
--
2.40.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] LoongArch: vDSO: Use CLANG_FLAGS instead of filtering out '--target='
2023-06-27 13:01 [PATCH 0/2] Fix cross-compilation issues with Clang WANG Xuerui
@ 2023-06-27 13:01 ` WANG Xuerui
2023-06-27 16:24 ` Nathan Chancellor
2023-06-27 13:01 ` [PATCH 2/2] LoongArch: Include KBUILD_CPPFLAGS in CHECKFLAGS invocation WANG Xuerui
2023-06-27 16:32 ` [PATCH 0/2] Fix cross-compilation issues with Clang Nathan Chancellor
2 siblings, 1 reply; 8+ messages in thread
From: WANG Xuerui @ 2023-06-27 13:01 UTC (permalink / raw)
To: Huacai Chen
Cc: WANG Rui, Nathan Chancellor, Xi Ruoyao, loongarch, linux-kbuild,
llvm, linux-kernel, WANG Xuerui
From: WANG Xuerui <git@xen0n.name>
This is a port of commit 76d7fff22be3e ("MIPS: VDSO: Use CLANG_FLAGS
instead of filtering out '--target='") to arch/loongarch, for fixing
cross-compilation with Clang.
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/vdso/Makefile | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/loongarch/vdso/Makefile b/arch/loongarch/vdso/Makefile
index 3f9df4d9930f..a50308b6fc25 100644
--- a/arch/loongarch/vdso/Makefile
+++ b/arch/loongarch/vdso/Makefile
@@ -12,12 +12,9 @@ ccflags-vdso := \
$(filter -E%,$(KBUILD_CFLAGS)) \
$(filter -march=%,$(KBUILD_CFLAGS)) \
$(filter -m%-float,$(KBUILD_CFLAGS)) \
+ $(CLANG_FLAGS) \
-D__VDSO__
-ifeq ($(cc-name),clang)
-ccflags-vdso += $(filter --target=%,$(KBUILD_CFLAGS))
-endif
-
cflags-vdso := $(ccflags-vdso) \
-isystem $(shell $(CC) -print-file-name=include) \
$(filter -W%,$(filter-out -Wa$(comma)%,$(KBUILD_CFLAGS))) \
--
2.40.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] LoongArch: Include KBUILD_CPPFLAGS in CHECKFLAGS invocation
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 13:01 ` WANG Xuerui
2023-06-27 16:25 ` Nathan Chancellor
2023-06-27 16:32 ` [PATCH 0/2] Fix cross-compilation issues with Clang Nathan Chancellor
2 siblings, 1 reply; 8+ messages in thread
From: WANG Xuerui @ 2023-06-27 13:01 UTC (permalink / raw)
To: Huacai Chen
Cc: WANG Rui, Nathan Chancellor, Xi Ruoyao, loongarch, linux-kbuild,
llvm, linux-kernel, WANG Xuerui
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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] LoongArch: vDSO: Use CLANG_FLAGS instead of filtering out '--target='
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
0 siblings, 1 reply; 8+ messages in thread
From: Nathan Chancellor @ 2023-06-27 16:24 UTC (permalink / raw)
To: WANG Xuerui
Cc: Huacai Chen, WANG Rui, Xi Ruoyao, loongarch, linux-kbuild, llvm,
linux-kernel, WANG Xuerui
On Tue, Jun 27, 2023 at 09:01:21PM +0800, WANG Xuerui wrote:
> From: WANG Xuerui <git@xen0n.name>
>
> This is a port of commit 76d7fff22be3e ("MIPS: VDSO: Use CLANG_FLAGS
> instead of filtering out '--target='") to arch/loongarch, for fixing
> cross-compilation with Clang.
>
> 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/vdso/Makefile | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/arch/loongarch/vdso/Makefile b/arch/loongarch/vdso/Makefile
> index 3f9df4d9930f..a50308b6fc25 100644
> --- a/arch/loongarch/vdso/Makefile
> +++ b/arch/loongarch/vdso/Makefile
> @@ -12,12 +12,9 @@ ccflags-vdso := \
> $(filter -E%,$(KBUILD_CFLAGS)) \
> $(filter -march=%,$(KBUILD_CFLAGS)) \
> $(filter -m%-float,$(KBUILD_CFLAGS)) \
> + $(CLANG_FLAGS) \
> -D__VDSO__
>
> -ifeq ($(cc-name),clang)
> -ccflags-vdso += $(filter --target=%,$(KBUILD_CFLAGS))
> -endif
> -
> cflags-vdso := $(ccflags-vdso) \
> -isystem $(shell $(CC) -print-file-name=include) \
> $(filter -W%,$(filter-out -Wa$(comma)%,$(KBUILD_CFLAGS))) \
> --
> 2.40.0
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] LoongArch: Include KBUILD_CPPFLAGS in CHECKFLAGS invocation
2023-06-27 13:01 ` [PATCH 2/2] LoongArch: Include KBUILD_CPPFLAGS in CHECKFLAGS invocation WANG Xuerui
@ 2023-06-27 16:25 ` Nathan Chancellor
2023-06-28 4:22 ` Huacai Chen
0 siblings, 1 reply; 8+ messages in thread
From: Nathan Chancellor @ 2023-06-27 16:25 UTC (permalink / raw)
To: WANG Xuerui
Cc: Huacai Chen, WANG Rui, Xi Ruoyao, loongarch, linux-kbuild, llvm,
linux-kernel, WANG Xuerui
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
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/2] Fix cross-compilation issues with Clang
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 13:01 ` [PATCH 2/2] LoongArch: Include KBUILD_CPPFLAGS in CHECKFLAGS invocation WANG Xuerui
@ 2023-06-27 16:32 ` Nathan Chancellor
2 siblings, 0 replies; 8+ messages in thread
From: Nathan Chancellor @ 2023-06-27 16:32 UTC (permalink / raw)
To: WANG Xuerui
Cc: Huacai Chen, WANG Rui, Xi Ruoyao, loongarch, linux-kbuild, llvm,
linux-kernel, WANG Xuerui
On Tue, Jun 27, 2023 at 09:01:20PM +0800, WANG Xuerui wrote:
> From: WANG Xuerui <git@xen0n.name>
>
> Hi,
>
> Just some quick fixes to the recently accepted Clang patches, thanks to
> Nathan's followup testing. (I test-compiled natively so didn't notice
It is good to hear that everything works natively as well :)
> that cross-compilation was broken, and by chance the LLVM snapshot I
> used didn't contain the breaking commit either.)
And we can already see this effort making the compiler better! The
problematic LLVM patch is only a week old so we were able to catch it
before it made it into a released version. Thanks again for the work you
have done getting this working so far.
Cheers,
Nathan
>
> With an additional LLVM patch https://reviews.llvm.org/D153865 the Clang
> builds should now get fixed.
>
> WANG Xuerui (2):
> LoongArch: vDSO: Use CLANG_FLAGS instead of filtering out '--target='
> LoongArch: Include KBUILD_CPPFLAGS in CHECKFLAGS invocation
>
> arch/loongarch/Makefile | 2 +-
> arch/loongarch/vdso/Makefile | 5 +----
> 2 files changed, 2 insertions(+), 5 deletions(-)
>
> --
> 2.40.0
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] LoongArch: vDSO: Use CLANG_FLAGS instead of filtering out '--target='
2023-06-27 16:24 ` Nathan Chancellor
@ 2023-06-28 4:22 ` Huacai Chen
0 siblings, 0 replies; 8+ messages in thread
From: Huacai Chen @ 2023-06-28 4:22 UTC (permalink / raw)
To: Nathan Chancellor
Cc: WANG Xuerui, WANG Rui, Xi Ruoyao, loongarch, linux-kbuild, llvm,
linux-kernel, WANG Xuerui
Queued for loongarch-next, thanks.
Huacai
On Wed, Jun 28, 2023 at 12:24 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> On Tue, Jun 27, 2023 at 09:01:21PM +0800, WANG Xuerui wrote:
> > From: WANG Xuerui <git@xen0n.name>
> >
> > This is a port of commit 76d7fff22be3e ("MIPS: VDSO: Use CLANG_FLAGS
> > instead of filtering out '--target='") to arch/loongarch, for fixing
> > cross-compilation with Clang.
> >
> > 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/vdso/Makefile | 5 +----
> > 1 file changed, 1 insertion(+), 4 deletions(-)
> >
> > diff --git a/arch/loongarch/vdso/Makefile b/arch/loongarch/vdso/Makefile
> > index 3f9df4d9930f..a50308b6fc25 100644
> > --- a/arch/loongarch/vdso/Makefile
> > +++ b/arch/loongarch/vdso/Makefile
> > @@ -12,12 +12,9 @@ ccflags-vdso := \
> > $(filter -E%,$(KBUILD_CFLAGS)) \
> > $(filter -march=%,$(KBUILD_CFLAGS)) \
> > $(filter -m%-float,$(KBUILD_CFLAGS)) \
> > + $(CLANG_FLAGS) \
> > -D__VDSO__
> >
> > -ifeq ($(cc-name),clang)
> > -ccflags-vdso += $(filter --target=%,$(KBUILD_CFLAGS))
> > -endif
> > -
> > cflags-vdso := $(ccflags-vdso) \
> > -isystem $(shell $(CC) -print-file-name=include) \
> > $(filter -W%,$(filter-out -Wa$(comma)%,$(KBUILD_CFLAGS))) \
> > --
> > 2.40.0
> >
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] LoongArch: Include KBUILD_CPPFLAGS in CHECKFLAGS invocation
2023-06-27 16:25 ` Nathan Chancellor
@ 2023-06-28 4:22 ` Huacai Chen
0 siblings, 0 replies; 8+ messages in thread
From: Huacai Chen @ 2023-06-28 4:22 UTC (permalink / raw)
To: Nathan Chancellor
Cc: WANG Xuerui, WANG Rui, Xi Ruoyao, loongarch, linux-kbuild, llvm,
linux-kernel, WANG Xuerui
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
> >
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-06-28 4:22 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 2/2] LoongArch: Include KBUILD_CPPFLAGS in CHECKFLAGS invocation WANG Xuerui
2023-06-27 16:25 ` 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox