kbuild: replace cc-name test with CONFIG_CC_IS_CLANG
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Tue, 30 Oct 2018 13:26:33 +0000 (22:26 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Fri, 2 Nov 2018 13:49:00 +0000 (22:49 +0900)
Evaluating cc-name invokes the compiler every time even when you are
not compiling anything, like 'make help'. This is not efficient.

The compiler type has been already detected in the Kconfig stage.
Use CONFIG_CC_IS_CLANG, instead.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Acked-by: Paul Burton <paul.burton@mips.com> (MIPS)
Acked-by: Joel Stanley <joel@jms.id.au>
Makefile
arch/mips/Makefile
arch/mips/vdso/Makefile
arch/powerpc/Makefile
scripts/Makefile.extrawarn

index 9aa352b38815801e37fd3cb04c66fa96511443f5..8d6529c371e185f12f3d2a53395699f2d7133604 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -702,7 +702,7 @@ stackp-flags-$(CONFIG_STACKPROTECTOR_STRONG)      := -fstack-protector-strong
 
 KBUILD_CFLAGS += $(stackp-flags-y)
 
-ifeq ($(cc-name),clang)
+ifdef CONFIG_CC_IS_CLANG
 KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,)
 KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier)
 KBUILD_CFLAGS += $(call cc-disable-warning, gnu)
index 15a84cfd07191f95dcaa83744f76feaae3a37af2..68410490e12fdc2497104c3eeb7cdf64a8e84b8e 100644 (file)
@@ -128,7 +128,7 @@ cflags-y += -ffreestanding
 # clang's output will be based upon the build machine. So for clang we simply
 # unconditionally specify -EB or -EL as appropriate.
 #
-ifeq ($(cc-name),clang)
+ifdef CONFIG_CC_IS_CLANG
 cflags-$(CONFIG_CPU_BIG_ENDIAN)                += -EB
 cflags-$(CONFIG_CPU_LITTLE_ENDIAN)     += -EL
 else
index 34605ca214984c7257507fa2fb5925eb48bd9f92..58a0315ad743d5bcf965814fd17431f3f2f2bf03 100644 (file)
@@ -10,7 +10,7 @@ ccflags-vdso := \
        $(filter -march=%,$(KBUILD_CFLAGS)) \
        -D__VDSO__
 
-ifeq ($(cc-name),clang)
+ifdef CONFIG_CC_IS_CLANG
 ccflags-vdso += $(filter --target=%,$(KBUILD_CFLAGS))
 endif
 
index 17be664dafa2f2166d12025c8ee536d49c593b14..8a2ce14d68d077b2d62771070b40ac931d8a975a 100644 (file)
@@ -96,7 +96,7 @@ aflags-$(CONFIG_CPU_BIG_ENDIAN)               += $(call cc-option,-mabi=elfv1)
 aflags-$(CONFIG_CPU_LITTLE_ENDIAN)     += -mabi=elfv2
 endif
 
-ifneq ($(cc-name),clang)
+ifndef CONFIG_CC_IS_CLANG
   cflags-$(CONFIG_CPU_LITTLE_ENDIAN)   += -mno-strict-align
 endif
 
@@ -175,7 +175,7 @@ endif
 # Work around gcc code-gen bugs with -pg / -fno-omit-frame-pointer in gcc <= 4.8
 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44199
 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52828
-ifneq ($(cc-name),clang)
+ifndef CONFIG_CC_IS_CLANG
 CC_FLAGS_FTRACE        += $(call cc-ifversion, -lt, 0409, -mno-sched-epilog)
 endif
 endif
index 24b2fb1d12974d1507705f475b52aedc81c9be5c..800a10f1b4f39e0a68c70167ed59e26e2e32ad63 100644 (file)
@@ -64,7 +64,7 @@ endif
 KBUILD_CFLAGS += $(warning)
 else
 
-ifeq ($(cc-name),clang)
+ifdef CONFIG_CC_IS_CLANG
 KBUILD_CFLAGS += $(call cc-disable-warning, initializer-overrides)
 KBUILD_CFLAGS += $(call cc-disable-warning, unused-value)
 KBUILD_CFLAGS += $(call cc-disable-warning, format)