linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tools: fix incorrect setting of CC_NO_CLANG
@ 2020-08-20  0:50 Calvin Zhang
  0 siblings, 0 replies; only message in thread
From: Calvin Zhang @ 2020-08-20  0:50 UTC (permalink / raw)
  To: yhs
  Cc: mhiramat, daniel, songliubraving, acme, zhq2014, linux-kernel,
	clang-built-linux

CC_NO_CLANG should be set according to the value of CC after overridden.

I have linked /usr/bin/cc to /usr/bin/clang and I built perf with a gcc
cross-compiler:

    $ ARCH=arm64 CROSS_COMPILE=aarch64-calvin-linux-gnu- make -C \
        ../linux/tools/perf/ O=$(pwd)

It worked well. But when I tried to rebuild that with FIXDEP=1:

    $ ARCH=arm64 CROSS_COMPILE=aarch64-calvin-linux-gnu- make -C \
        ../linux/tools/perf/ O=$(pwd) FIXDEP=1

Every .o files were rebuilt since EXTRA_WARNINGS was changed due to
false value of CC_NO_CLANG. Things worked in first build because submake
of Makefile.perf inherited CC from first make and CC_NO_CLANG was
rectified in submake.

Signed-off-by: Calvin Zhang <zhq2014@mail.ustc.edu.cn>
---
 tools/scripts/Makefile.include | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include
index a7974638561c..dc887669828b 100644
--- a/tools/scripts/Makefile.include
+++ b/tools/scripts/Makefile.include
@@ -39,8 +39,6 @@ EXTRA_WARNINGS += -Wundef
 EXTRA_WARNINGS += -Wwrite-strings
 EXTRA_WARNINGS += -Wformat
 
-CC_NO_CLANG := $(shell $(CC) -dM -E -x c /dev/null | grep -Fq "__clang__"; echo $$?)
-
 # Makefiles suck: This macro sets a default value of $(2) for the
 # variable named by $(1), unless the variable has been set by
 # environment or command line. This is necessary for CC and AR
@@ -59,6 +57,8 @@ $(call allow-override,LD,$(CROSS_COMPILE)ld)
 $(call allow-override,CXX,$(CROSS_COMPILE)g++)
 $(call allow-override,STRIP,$(CROSS_COMPILE)strip)
 
+CC_NO_CLANG := $(shell $(CC) -dM -E -x c /dev/null | grep -Fq "__clang__"; echo $$?)
+
 ifeq ($(CC_NO_CLANG), 1)
 EXTRA_WARNINGS += -Wstrict-aliasing=3
 endif
-- 
2.18.4



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-09-05  2:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-20  0:50 [PATCH] tools: fix incorrect setting of CC_NO_CLANG Calvin Zhang

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).