From 03cd8d16c1fe7a19430887119a84432601c2e51a 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 78cb119a249a..d7795596a2d5 100644 --- a/Makefile +++ b/Makefile @@ -552,6 +552,9 @@ CLANG_FLAGS += $(call cc-option, -Wno-misleading-indentation) CLANG_FLAGS += $(call cc-option, -Wno-bool-operation) KBUILD_CFLAGS += $(CLANG_FLAGS) KBUILD_AFLAGS += $(CLANG_FLAGS) +ifneq ($(LLVM),) +KBUILD_CFLAGS += -fuse-ld=lld +endif endif ifeq ($(mixed-targets),1)