Skip to contentSkip to conversation

kbuild: llvmlinux: Fix -fno-delete-null-pointer-checks compiler-flag

PATCH In review Sedat Dilek 2 participants 2 messages Sep 15, 2015 – Oct 26, 2015 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild: llvmlinux: Fix -fno-delete-null-pointer-checks compiler-flag

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(-)
Makefile +5 -3
index aaf1d52bc646..4249441e535d 100644
@@ -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,)
Signature · 1 line
2.5.2
#1 lore raw

Dne 15.9.2015 v 05:03 Sedat Dilek napsal(a):

Quoted 16 lines

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(-)
Makefile +0 -0
index aaf1d52bc646..4249441e535d 100644

Makefile HOSTCXX = g++ · line 303

Quoted 7 lines
Makefile +1 -3
@@ -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