LLVMLINUX: kbuild, LLVMLinux: Add more compiler options for clang
Change default compiler options when using clang
Signed-off-by: Behan Webster <behanw@converseincode.com>
[Refreshed patch following nearby changes in upstream and rename of $(COMPILER)
to $(cc-name)]
Change-Id: I817956d811c57d602851ccbb91afe348b78d7749
Signed-off-by: Daniel Sanders <daniel.sanders@imgtec.com>
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Git-commit: 3389e33f857f6204563e19945539281ed6f6a813
Git-repo: https://android.googlesource.com/kernel/common/
[satyap@codeaurora.org: resolution of trivial merge conflicts]
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
[snaseem@codeaurora.org: resolution of trivial merge conflicts]
Signed-off-by: Shadab Naseem <snaseem@codeaurora.org>
Signed-off-by: Gaurav Kohli <gkohli@codeaurora.org>
Signed-off-by: Naitik Bharadiya <bharad@codeaurora.org>
diff --git a/Makefile b/Makefile
index 1cfb7b3..86ef89f4 100755
--- a/Makefile
+++ b/Makefile
@@ -306,6 +306,11 @@
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
+endif
+
# Decide whether to build built-in, modular, or both.
# Normally, just do built-in.
@@ -532,8 +537,12 @@
KBUILD_CFLAGS += $(call cc-disable-warning, duplicate-decl-specifier)
KBUILD_CFLAGS += -Wno-undefined-optimized
KBUILD_CFLAGS += -Wno-tautological-constant-out-of-range-compare
+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.
@@ -546,6 +555,7 @@
KBUILD_AFLAGS += $(CLANG_FLAGS)
else
+KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
# These warnings generated too much noise in a regular build.
# Use make W=1 to enable them (see scripts/Makefile.build)
KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)