All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/Makefile: make -stack-alignment conditional on LLD < 13.0.0
@ 2021-06-10  9:28 torvic9
  2021-06-10 10:04 ` Greg KH
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: torvic9 @ 2021-06-10  9:28 UTC (permalink / raw)
  To: linux-kernel, nathan, ndesaulniers, tglx, mingo
  Cc: stable, clang-built-linux, x86

Since LLVM commit 3787ee4, the '-stack-alignment' flag has been dropped [1],
leading to the following error message when building a LTO kernel with
Clang-13 and LLD-13:

    ld.lld: error: -plugin-opt=-: ld.lld: Unknown command line argument 
    '-stack-alignment=8'.  Try 'ld.lld --help'
    ld.lld: Did you mean '--stackrealign=8'?

It also appears that the '-code-model' flag is not necessary anymore starting
with LLVM-9 [2].

Drop '-code-model' and make '-stack-alignment' conditional on LLD < 13.0.0.

This is for linux-stable 5.12.
Another patch will be submitted for 5.13 shortly (unless there are objections).

Discussion: https://github.com/ClangBuiltLinux/linux/issues/1377
[1]: https://reviews.llvm.org/D103048
[2]: https://reviews.llvm.org/D52322

Signed-off-by: Tor Vic <torvic9@mailbox.org>
---
 arch/x86/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 1f2e5bf..2855a1a 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -192,8 +192,9 @@ endif
 KBUILD_LDFLAGS += -m elf_$(UTS_MACHINE)
 
 ifdef CONFIG_LTO_CLANG
-KBUILD_LDFLAGS	+= -plugin-opt=-code-model=kernel \
-		   -plugin-opt=-stack-alignment=$(if $(CONFIG_X86_32),4,8)
+ifeq ($(shell test $(CONFIG_LLD_VERSION) -lt 130000; echo $$?),0)
+KBUILD_LDFLAGS	+= -plugin-opt=-stack-alignment=$(if $(CONFIG_X86_32),4,8)
+endif
 endif
 
 ifdef CONFIG_X86_NEED_RELOCS
-- 
2.32.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-06-11  8:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-10  9:28 [PATCH] x86/Makefile: make -stack-alignment conditional on LLD < 13.0.0 torvic9
2021-06-10 10:04 ` Greg KH
2021-06-10 16:42 ` Nathan Chancellor
2021-06-10 18:39   ` Tor Vic
2021-06-10 19:17     ` Nick Desaulniers
2021-06-10 19:20 ` Nick Desaulniers
2021-06-10 20:16   ` Tor Vic
2021-06-10 20:40     ` Nathan Chancellor
2021-06-11  8:07   ` David Laight

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.