linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: llvmlinux: Fix -fno-delete-null-pointer-checks compiler-flag
@ 2015-09-15  3:03 Sedat Dilek
  2015-10-26 20:01 ` Michal Marek
  0 siblings, 1 reply; 2+ messages in thread
From: Sedat Dilek @ 2015-09-15  3:03 UTC (permalink / raw)
  To: Michal Marek, linux-kbuild, linux-kernel; +Cc: Sedat Dilek

CLANG (here: v3.7) does not support '-fno-delete-null-pointer-checks'
as a compiler-flag.

Fix the HOSTCFLAGS and KBUILD_CFLAGS settings accordingly.
Furthermore, move and correct the $HOSTCC check.

Tested against Linux v4.3-rc1 and a refreshed llvmlinux patchset.
---
 Makefile | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index aaf1d52bc646..4249441e535d 100644
--- a/Makefile
+++ b/Makefile
@@ -300,9 +300,9 @@ HOSTCXX      = g++
 HOSTCFLAGS   = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89
 HOSTCXXFLAGS = -O2
 
-ifeq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1)
-HOSTCFLAGS  += -Wno-unused-value -Wno-unused-parameter \
-		-Wno-missing-field-initializers -fno-delete-null-pointer-checks
+HOSTCFLAGS  += -Wno-unused-value -Wno-unused-parameter -Wno-missing-field-initializers
+ifneq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1)
+HOSTCFLAGS  += -fno-delete-null-pointer-checks
 endif
 
 # Decide whether to build built-in, modular, or both.
@@ -617,7 +617,9 @@ ARCH_AFLAGS :=
 ARCH_CFLAGS :=
 include arch/$(SRCARCH)/Makefile
 
+ifneq ($(cc-name),clang)
 KBUILD_CFLAGS	+= $(call cc-option,-fno-delete-null-pointer-checks,)
+endif
 
 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
 KBUILD_CFLAGS	+= -Os $(call cc-disable-warning,maybe-uninitialized,)
-- 
2.5.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] kbuild: llvmlinux: Fix -fno-delete-null-pointer-checks compiler-flag
  2015-09-15  3:03 [PATCH] kbuild: llvmlinux: Fix -fno-delete-null-pointer-checks compiler-flag Sedat Dilek
@ 2015-10-26 20:01 ` Michal Marek
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Marek @ 2015-10-26 20:01 UTC (permalink / raw)
  To: Sedat Dilek; +Cc: linux-kbuild, linux-kernel

Dne 15.9.2015 v 05:03 Sedat Dilek napsal(a):
> CLANG (here: v3.7) does not support '-fno-delete-null-pointer-checks'
> as a compiler-flag.
> 
> Fix the HOSTCFLAGS and KBUILD_CFLAGS settings accordingly.
> Furthermore, move and correct the $HOSTCC check.
> 
> Tested against Linux v4.3-rc1 and a refreshed llvmlinux patchset.
> ---
>  Makefile | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index aaf1d52bc646..4249441e535d 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -300,9 +300,9 @@ HOSTCXX      = g++
>  HOSTCFLAGS   = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89
>  HOSTCXXFLAGS = -O2
>  
> -ifeq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1)
> -HOSTCFLAGS  += -Wno-unused-value -Wno-unused-parameter \
> -		-Wno-missing-field-initializers -fno-delete-null-pointer-checks
> +HOSTCFLAGS  += -Wno-unused-value -Wno-unused-parameter -Wno-missing-field-initializers

You are enabling the -Wno-* options for gcc with this.

Michal

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-26 20:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-15  3:03 [PATCH] kbuild: llvmlinux: Fix -fno-delete-null-pointer-checks compiler-flag Sedat Dilek
2015-10-26 20:01 ` Michal Marek

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