Skip to content

Commit 076f421

Browse files
committed
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>
1 parent 2cd3faf commit 076f421

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ stackp-flags-$(CONFIG_STACKPROTECTOR_STRONG) := -fstack-protector-strong
702702

703703
KBUILD_CFLAGS += $(stackp-flags-y)
704704

705-
ifeq ($(cc-name),clang)
705+
ifdef CONFIG_CC_IS_CLANG
706706
KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,)
707707
KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier)
708708
KBUILD_CFLAGS += $(call cc-disable-warning, gnu)

arch/mips/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ cflags-y += -ffreestanding
128128
# clang's output will be based upon the build machine. So for clang we simply
129129
# unconditionally specify -EB or -EL as appropriate.
130130
#
131-
ifeq ($(cc-name),clang)
131+
ifdef CONFIG_CC_IS_CLANG
132132
cflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB
133133
cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -EL
134134
else

arch/mips/vdso/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ccflags-vdso := \
1010
$(filter -march=%,$(KBUILD_CFLAGS)) \
1111
-D__VDSO__
1212

13-
ifeq ($(cc-name),clang)
13+
ifdef CONFIG_CC_IS_CLANG
1414
ccflags-vdso += $(filter --target=%,$(KBUILD_CFLAGS))
1515
endif
1616

arch/powerpc/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ aflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mabi=elfv1)
9696
aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mabi=elfv2
9797
endif
9898

99-
ifneq ($(cc-name),clang)
99+
ifndef CONFIG_CC_IS_CLANG
100100
cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mno-strict-align
101101
endif
102102

@@ -175,7 +175,7 @@ endif
175175
# Work around gcc code-gen bugs with -pg / -fno-omit-frame-pointer in gcc <= 4.8
176176
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44199
177177
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52828
178-
ifneq ($(cc-name),clang)
178+
ifndef CONFIG_CC_IS_CLANG
179179
CC_FLAGS_FTRACE += $(call cc-ifversion, -lt, 0409, -mno-sched-epilog)
180180
endif
181181
endif

scripts/Makefile.extrawarn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ endif
6464
KBUILD_CFLAGS += $(warning)
6565
else
6666

67-
ifeq ($(cc-name),clang)
67+
ifdef CONFIG_CC_IS_CLANG
6868
KBUILD_CFLAGS += $(call cc-disable-warning, initializer-overrides)
6969
KBUILD_CFLAGS += $(call cc-disable-warning, unused-value)
7070
KBUILD_CFLAGS += $(call cc-disable-warning, format)

0 commit comments

Comments
 (0)