mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-22 17:01:14 +00:00
kbuild: add -fcf-protection=none when using retpoline flags
[ Upstream commit 29be86d7f9
]
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>
This commit is contained in:
parent
b125188db9
commit
2103cc67db
1 changed files with 6 additions and 0 deletions
6
Makefile
6
Makefile
|
@ -843,6 +843,12 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init)
|
||||||
# change __FILE__ to the relative path from the srctree
|
# change __FILE__ to the relative path from the srctree
|
||||||
KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(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
|
# use the deterministic mode of AR if available
|
||||||
KBUILD_ARFLAGS := $(call ar-option,D)
|
KBUILD_ARFLAGS := $(call ar-option,D)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue