summaryrefslogtreecommitdiff
path: root/arch/x86/Makefile
diff options
context:
space:
mode:
authorSami Tolvanen <samitolvanen@google.com>2019-04-10 14:17:20 -0700
committerKees Cook <keescook@chromium.org>2021-02-23 12:46:58 -0800
commitb33fff07e3e3817d94dbec7bf2040070ecd96d16 (patch)
tree0630706a267af3a9f728d1ba3fe2b6e74b4dfbad /arch/x86/Makefile
parentd2dcd3e37475a66012f9702c4f9f0863ccdae716 (diff)
x86, build: allow LTO to be selected
Pass code model and stack alignment to the linker as these are not stored in LLVM bitcode, and allow CONFIG_LTO_CLANG* to be enabled. Signed-off-by: Sami Tolvanen <samitolvanen@google.com> Reviewed-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'arch/x86/Makefile')
-rw-r--r--arch/x86/Makefile5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 7116da3980be..845baf58d147 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -166,6 +166,11 @@ ifeq ($(ACCUMULATE_OUTGOING_ARGS), 1)
KBUILD_CFLAGS += $(call cc-option,-maccumulate-outgoing-args,)
endif
+ifdef CONFIG_LTO_CLANG
+KBUILD_LDFLAGS += -plugin-opt=-code-model=kernel \
+ -plugin-opt=-stack-alignment=$(if $(CONFIG_X86_32),4,8)
+endif
+
# Workaround for a gcc prelease that unfortunately was shipped in a suse release
KBUILD_CFLAGS += -Wno-sign-compare
#