summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorSeth Forshee <seth.forshee@canonical.com>2019-07-17 11:06:26 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-11-10 11:27:09 +0100
commitb17eae5a0e167e7fec32888f83d3a5dce85af1b4 (patch)
treeb31fdb5b9e948e89c3909448d654251b28f21bd1 /Makefile
parent5ee93551c703f8fa1a6c414a7d08f956de311df3 (diff)
downloadlinux-stable-b17eae5a0e167e7fec32888f83d3a5dce85af1b4.tar.gz
linux-stable-b17eae5a0e167e7fec32888f83d3a5dce85af1b4.tar.bz2
linux-stable-b17eae5a0e167e7fec32888f83d3a5dce85af1b4.zip
kbuild: add -fcf-protection=none when using retpoline flags
[ Upstream commit 29be86d7f9cb18df4123f309ac7857570513e8bc ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile6
1 files changed, 6 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 6af1c13d8753..729467fe0933 100644
--- a/Makefile
+++ b/Makefile
@@ -835,6 +835,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)