From e1c89b083250c79668c6469215087aef4424f524 Mon Sep 17 00:00:00 2001 From: Nick Desaulniers Date: Wed, 30 Jan 2019 18:23:26 -0800 Subject: [PATCH] BACKPORT: FROMLIST: Makefile: lld: tell clang to use lld This is needed because clang doesn't select which linker to use based on $LD but rather -fuse-ld=lld. This is problematic especially for cc-ldoption, which checks for linker flag support via invoking the compiler, rather than the linker. (am from https://lkml.org/lkml/2019/2/11/1947) Bug: 63740206 Change-Id: I3edf2f0f6c0bac842bef22194bd48a993fc0e3c0 Link: ClangBuiltLinux/linux#342 Suggested-by: Nathan Chancellor Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor Signed-off-by: Nick Desaulniers --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 96d4894be71d..908f6c9c3880 100644 --- a/Makefile +++ b/Makefile @@ -609,6 +609,9 @@ endif # Use make W=1 to enable them (see scripts/Makefile.build) KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) +ifneq ($(LLVM),) +KBUILD_CFLAGS += -fuse-ld=lld +endif ifeq ($(mixed-targets),1) # ===========================================================================