Skip to content
This repository has been archived by the owner on Dec 28, 2020. It is now read-only.

Commit

Permalink
FROMLIST: BACKPORT: Makefile: lld: tell clang to use lld
Browse files Browse the repository at this point in the history
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.

Link: ClangBuiltLinux/linux#342
Suggested-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com>
  • Loading branch information
nickdesaulniers authored and 0ctobot committed Jun 28, 2019
1 parent a639eef commit c562138
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,12 @@ LDFINAL_vmlinux := $(LD)
LD := $(LDLLD)
endif

ifeq ($(cc-name),clang)
ifeq ($(ld-name),lld)
KBUILD_CFLAGS += -fuse-ld=lld
endif
endif

ifdef CONFIG_LTO_CLANG
# use GNU gold with LLVMgold or LLD for LTO linking, and LD for vmlinux_link
ifeq ($(ld-name),gold)
Expand Down

0 comments on commit c562138

Please sign in to comment.