summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorBehan Webster <behanw@converseincode.com>2014-09-15 17:10:34 -0700
committerBehan Webster <behanw@converseincode.com>2015-01-18 18:05:13 -0800
commit3d726e6b2cbc25050b1ac269bd37643733660614 (patch)
tree4630d324d748d3a7373bb2ecbfa316a22a5cc623 /Makefile
parentda6eac19c706d1408c3f3f05cd4f55eea47b2c59 (diff)
kbuild, LLVMLinux: Add more compiler options for clang
Change default compiler options when using clang Signed-off-by: Behan Webster <behanw@converseincode.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile13
1 files changed, 8 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 28a2a35c754..9e239cffd36 100644
--- a/Makefile
+++ b/Makefile
@@ -302,7 +302,7 @@ 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
+ -Wno-missing-field-initializers
endif
# Decide whether to build built-in, modular, or both.
@@ -625,8 +625,6 @@ all: vmlinux
include $(srctree)/arch/$(SRCARCH)/Makefile
-KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
-
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,)
else
@@ -689,19 +687,24 @@ KBUILD_CFLAGS += $(stackp-flag)
ifeq ($(COMPILER),clang)
KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,)
-KBUILD_CPPFLAGS += $(call cc-option,-Wno-unknown-warning-option,)
KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable)
KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier)
KBUILD_CFLAGS += $(call cc-disable-warning, gnu)
+KBUILD_CFLAGS += -Wno-asm-operand-widths
+KBUILD_CFLAGS += -Wno-initializer-overrides
+KBUILD_CFLAGS += -fno-builtin
+
# Quiet clang warning: comparison of unsigned expression < 0 is always false
KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare)
+
# CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the
# source of a reference will be _MergedGlobals and not on of the whitelisted names.
# See modpost pattern 2
KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,)
-KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior)
+
else
+KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
# This warning generated too much noise in a regular build.
# Use make W=1 to enable this warning (see scripts/Makefile.build)
KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)