Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kbuild: replace cc-name test with CONFIG_CC_IS_CLANG

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>

+6 -6
+1 -1
Makefile
··· 702 702 703 703 KBUILD_CFLAGS += $(stackp-flags-y) 704 704 705 - ifeq ($(cc-name),clang) 705 + ifdef CONFIG_CC_IS_CLANG 706 706 KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) 707 707 KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) 708 708 KBUILD_CFLAGS += $(call cc-disable-warning, gnu)
+1 -1
arch/mips/Makefile
··· 128 128 # clang's output will be based upon the build machine. So for clang we simply 129 129 # unconditionally specify -EB or -EL as appropriate. 130 130 # 131 - ifeq ($(cc-name),clang) 131 + ifdef CONFIG_CC_IS_CLANG 132 132 cflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB 133 133 cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -EL 134 134 else
+1 -1
arch/mips/vdso/Makefile
··· 10 10 $(filter -march=%,$(KBUILD_CFLAGS)) \ 11 11 -D__VDSO__ 12 12 13 - ifeq ($(cc-name),clang) 13 + ifdef CONFIG_CC_IS_CLANG 14 14 ccflags-vdso += $(filter --target=%,$(KBUILD_CFLAGS)) 15 15 endif 16 16
+2 -2
arch/powerpc/Makefile
··· 96 96 aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mabi=elfv2 97 97 endif 98 98 99 - ifneq ($(cc-name),clang) 99 + ifndef CONFIG_CC_IS_CLANG 100 100 cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mno-strict-align 101 101 endif 102 102 ··· 175 175 # Work around gcc code-gen bugs with -pg / -fno-omit-frame-pointer in gcc <= 4.8 176 176 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44199 177 177 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52828 178 - ifneq ($(cc-name),clang) 178 + ifndef CONFIG_CC_IS_CLANG 179 179 CC_FLAGS_FTRACE += $(call cc-ifversion, -lt, 0409, -mno-sched-epilog) 180 180 endif 181 181 endif
+1 -1
scripts/Makefile.extrawarn
··· 64 64 KBUILD_CFLAGS += $(warning) 65 65 else 66 66 67 - ifeq ($(cc-name),clang) 67 + ifdef CONFIG_CC_IS_CLANG 68 68 KBUILD_CFLAGS += $(call cc-disable-warning, initializer-overrides) 69 69 KBUILD_CFLAGS += $(call cc-disable-warning, unused-value) 70 70 KBUILD_CFLAGS += $(call cc-disable-warning, format)