summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeth Forshee <seth.forshee@canonical.com>2019-07-17 18:06:26 +0200
committerMasahiro Yamada <yamada.masahiro@socionext.com>2019-07-20 04:20:24 +0200
commit29be86d7f9cb18df4123f309ac7857570513e8bc (patch)
tree60fdf871b68f29be66d9221d505e78f77f59ad93
parentkbuild: update compile-test header list for v5.3-rc1 (diff)
downloadlinux-29be86d7f9cb18df4123f309ac7857570513e8bc.tar.xz
linux-29be86d7f9cb18df4123f309ac7857570513e8bc.zip
kbuild: add -fcf-protection=none when using retpoline flags
The gcc -fcf-protection=branch option is not compatible with -mindirect-branch=thunk-extern. The latter is used when CONFIG_RETPOLINE is selected, and this will fail to build with a gcc which has -fcf-protection=branch enabled by default. Adding -fcf-protection=none when building with retpoline enabled prevents such build failures. Signed-off-by: Seth Forshee <seth.forshee@canonical.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to '')
-rw-r--r--Makefile6
1 files changed, 6 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 86d26c0ad9a9..fd6f7949bc1a 100644
--- a/Makefile
+++ b/Makefile
@@ -882,6 +882,12 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init)
# change __FILE__ to the relative path from the srctree
KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
+# ensure -fcf-protection is disabled when using retpoline as it is
+# incompatible with -mindirect-branch=thunk-extern
+ifdef CONFIG_RETPOLINE
+KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none)
+endif
+
# use the deterministic mode of AR if available
KBUILD_ARFLAGS := $(call ar-option,D)