linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: clang: fix build failures with sparse check
@ 2017-10-20 21:09 David Lin
  2017-10-24  4:13 ` Masahiro Yamada
  0 siblings, 1 reply; 2+ messages in thread
From: David Lin @ 2017-10-20 21:09 UTC (permalink / raw)
  To: corbet, yamada.masahiro, michal.lkml, behanw
  Cc: ghackmann, linux-kbuild, linux-kernel, David Lin

We should avoid using the space character when passing arguments to
clang, because static code analysis check tool such as sparse may
misinterpret the arguments followed by spaces as build targets hence
cause the build to fail.

Signed-off-by: David Lin <dtwlin@google.com>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 05f95df0a247..c8819d0de907 100644
--- a/Makefile
+++ b/Makefile
@@ -685,11 +685,11 @@ KBUILD_CFLAGS += $(stackp-flag)
 
 ifeq ($(cc-name),clang)
 ifneq ($(CROSS_COMPILE),)
-CLANG_TARGET	:= -target $(notdir $(CROSS_COMPILE:%-=%))
+CLANG_TARGET	:= --target=$(notdir $(CROSS_COMPILE:%-=%))
 GCC_TOOLCHAIN	:= $(realpath $(dir $(shell which $(LD)))/..)
 endif
 ifneq ($(GCC_TOOLCHAIN),)
-CLANG_GCC_TC	:= -gcc-toolchain $(GCC_TOOLCHAIN)
+CLANG_GCC_TC	:= --gcc-toolchain=$(GCC_TOOLCHAIN)
 endif
 KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC)
 KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC)
-- 
2.15.0.rc0.271.g36b669edcc-goog

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] kbuild: clang: fix build failures with sparse check
  2017-10-20 21:09 [PATCH] kbuild: clang: fix build failures with sparse check David Lin
@ 2017-10-24  4:13 ` Masahiro Yamada
  0 siblings, 0 replies; 2+ messages in thread
From: Masahiro Yamada @ 2017-10-24  4:13 UTC (permalink / raw)
  To: David Lin
  Cc: Jonathan Corbet, Michal Marek, Behan Webster, Greg Hackmann,
	Linux Kbuild mailing list, Linux Kernel Mailing List

2017-10-21 6:09 GMT+09:00 David Lin <dtwlin@google.com>:
> We should avoid using the space character when passing arguments to
> clang, because static code analysis check tool such as sparse may
> misinterpret the arguments followed by spaces as build targets hence
> cause the build to fail.
>
> Signed-off-by: David Lin <dtwlin@google.com>
> ---
>  Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 05f95df0a247..c8819d0de907 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -685,11 +685,11 @@ KBUILD_CFLAGS += $(stackp-flag)
>
>  ifeq ($(cc-name),clang)
>  ifneq ($(CROSS_COMPILE),)
> -CLANG_TARGET   := -target $(notdir $(CROSS_COMPILE:%-=%))
> +CLANG_TARGET   := --target=$(notdir $(CROSS_COMPILE:%-=%))
>  GCC_TOOLCHAIN  := $(realpath $(dir $(shell which $(LD)))/..)
>  endif
>  ifneq ($(GCC_TOOLCHAIN),)
> -CLANG_GCC_TC   := -gcc-toolchain $(GCC_TOOLCHAIN)
> +CLANG_GCC_TC   := --gcc-toolchain=$(GCC_TOOLCHAIN)
>  endif
>  KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC)
>  KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC)
> --
> 2.15.0.rc0.271.g36b669edcc-goog
>

Applied to linux-kbuild/fixes.  Thanks!


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-24  4:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-20 21:09 [PATCH] kbuild: clang: fix build failures with sparse check David Lin
2017-10-24  4:13 ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).