* [PATCH v2 1/2] kbuild: replace cc-name test with CONFIG_CC_IS_CLANG
@ 2018-10-30 13:26 Masahiro Yamada
2018-10-30 16:51 ` Paul Burton
2018-10-30 21:11 ` Joel Stanley
0 siblings, 2 replies; 3+ messages in thread
From: Masahiro Yamada @ 2018-10-30 13:26 UTC (permalink / raw)
To: linux-kbuild
Cc: linux-mips, Michal Marek, James Hogan, linux-kernel, Ralf Baechle,
Masahiro Yamada, Paul Burton, Paul Mackerras, linuxppc-dev
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)
---
Changes in v2:
- Use ifdef/ifndef insteaed of ifeq/ifneq
Makefile | 2 +-
arch/mips/Makefile | 2 +-
arch/mips/vdso/Makefile | 2 +-
arch/powerpc/Makefile | 4 ++--
| 2 +-
5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
index 0a42d06..1c0696d 100644
--- a/Makefile
+++ b/Makefile
@@ -707,7 +707,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)
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 15a84cf..6841049 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -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
diff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile
index 34605ca..58a0315 100644
--- a/arch/mips/vdso/Makefile
+++ b/arch/mips/vdso/Makefile
@@ -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
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 17be664..8a2ce14 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -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
--git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 24b2fb1..800a10f 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -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)
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/2] kbuild: replace cc-name test with CONFIG_CC_IS_CLANG
2018-10-30 13:26 [PATCH v2 1/2] kbuild: replace cc-name test with CONFIG_CC_IS_CLANG Masahiro Yamada
@ 2018-10-30 16:51 ` Paul Burton
2018-10-30 21:11 ` Joel Stanley
1 sibling, 0 replies; 3+ messages in thread
From: Paul Burton @ 2018-10-30 16:51 UTC (permalink / raw)
To: Masahiro Yamada
Cc: linux-mips@linux-mips.org, Michal Marek,
linux-kbuild@vger.kernel.org, James Hogan,
linux-kernel@vger.kernel.org, Ralf Baechle, Paul Mackerras,
linuxppc-dev@lists.ozlabs.org
Hi Masahiro,
On Tue, Oct 30, 2018 at 10:26:33PM +0900, Masahiro Yamada wrote:
> 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)
Looks good to me:
Acked-by: Paul Burton <paul.burton@mips.com> (MIPS)
Thanks,
Paul
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/2] kbuild: replace cc-name test with CONFIG_CC_IS_CLANG
2018-10-30 13:26 [PATCH v2 1/2] kbuild: replace cc-name test with CONFIG_CC_IS_CLANG Masahiro Yamada
2018-10-30 16:51 ` Paul Burton
@ 2018-10-30 21:11 ` Joel Stanley
1 sibling, 0 replies; 3+ messages in thread
From: Joel Stanley @ 2018-10-30 21:11 UTC (permalink / raw)
To: Masahiro Yamada
Cc: linux-mips, Michal Marek, linux-kbuild, jhogan,
Linux Kernel Mailing List, ralf, paul.burton, Paul Mackerras,
linuxppc-dev
On Tue, 30 Oct 2018 at 23:58, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> 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.
Thanks, I didn't know about this.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Acked-by: Joel Stanley <joel@jms.id.au>
Cheers,
Joel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-10-30 21:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-30 13:26 [PATCH v2 1/2] kbuild: replace cc-name test with CONFIG_CC_IS_CLANG Masahiro Yamada
2018-10-30 16:51 ` Paul Burton
2018-10-30 21:11 ` Joel Stanley
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).