Skip to content

Commit 548843c

Browse files
committed
Merge tag 'clang-features-v5.13-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull clang LTO fix from Kees Cook: "Clang 13 fixed some IR behavior for LTO, but this broke work-arounds used in the kernel. Handle changes to needed LTO flags in Clang 13 (Tor Vic)" * tag 'clang-features-v5.13-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: x86, lto: Pass -stack-alignment only on LLD < 13.0.0
2 parents e65b791 + 2398ce8 commit 548843c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

arch/x86/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,9 @@ endif
200200
KBUILD_LDFLAGS += -m elf_$(UTS_MACHINE)
201201

202202
ifdef CONFIG_LTO_CLANG
203-
KBUILD_LDFLAGS += -plugin-opt=-code-model=kernel \
204-
-plugin-opt=-stack-alignment=$(if $(CONFIG_X86_32),4,8)
203+
ifeq ($(shell test $(CONFIG_LLD_VERSION) -lt 130000; echo $$?),0)
204+
KBUILD_LDFLAGS += -plugin-opt=-stack-alignment=$(if $(CONFIG_X86_32),4,8)
205+
endif
205206
endif
206207

207208
ifdef CONFIG_X86_NEED_RELOCS

0 commit comments

Comments
 (0)