aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2016-02-05 16:48:04 -0800
committerKees Cook <keescook@chromium.org>2016-02-05 16:48:16 -0800
commita8e1d4600559bf3e7973ac9786037245cdaed527 (patch)
treeb6be57f146695c108c9917caa15ea96ed962d76c
parentbd68e8c213e0b25a7ee6f9310bc58d3152205ca8 (diff)
downloadv4.1-brillo-m10-release.tar.gz
FROMLIST: kbuild: disable Android-specific compiler featuresbrillo-m10-releasebrillo-m10-dev
The Android compilers enable some non-standard features by default. While most Android build systems inject the needed "-mno-android" option via KCFLAGS, it happens too late (at least on x86_64), since KBUILD_CFLAGS gains KCFLAGS after running (and failing) many cc-option tests. (For example, the stack-protector tests happen after arch-specific KBUILD_CFLAGS are added but before the external KCFLAGS are added.) As such, we should notice this option and immediately turn it on as the first cc-option test we run. Signed-off-by: Kees Cook <keescook@chromium.org> Bug: 27039414 Patchset: android compiler (git am from https://patchwork.kernel.org/patch/8240831/) Signed-off-by: Kees Cook <keescook@chromium.org> Change-Id: Idc0c80ddef90bb02ce6255055f30b05864ff4cfd
-rw-r--r--Makefile4
1 files changed, 4 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index cf35f6bcffd..591fd021e27 100644
--- a/Makefile
+++ b/Makefile
@@ -403,6 +403,10 @@ KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-Wno-format-security \
-std=gnu89
+# We must turn off the Android-specific compiler options as early as possible
+# otherwise cc-option calls below may erroneously fail.
+KBUILD_CFLAGS += $(call cc-option,-mno-android,)
+
KBUILD_AFLAGS_KERNEL :=
KBUILD_CFLAGS_KERNEL :=
KBUILD_AFLAGS := -D__ASSEMBLY__