From 10fa2703fb52f2adf0332c6743587d44ce670b0f Mon Sep 17 00:00:00 2001 From: Nick Desaulniers Date: Wed, 30 Jan 2019 18:22:58 -0800 Subject: [PATCH] ANDROID: scripts/Kbuild: add ld-name support for ld.lld Bug: 63740206 Change-Id: I0cd9940c2fa07a6bb4573ec8b1edcd21fd1f3a4d Signed-off-by: Nick Desaulniers Signed-off-by: Sami Tolvanen --- scripts/Kbuild.include | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index ae30702c1f15..08969e192c38 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -204,8 +204,19 @@ ld-option = $(call try-run, $(LD) $(LDFLAGS) $(1) -v,$(1),$(2)) ar-option = $(call try-run, $(AR) rc$(1) "$$TMP",$(1),$(2)) # ld-name -# Expands to either bfd or gold -ld-name = $(shell $(LD) -v 2>&1 | grep -q "GNU gold" && echo gold || echo bfd) +# Expands to either bfd, gold, or lld +ifneq (,$(LD)) + __ld-name = $(shell $(LD) -v 2>&1) +endif +ifneq (,$(findstring GNU gold,$(__ld-name))) + ld-name = gold +else + ifneq (,$(findstring LLD,$(__ld-name))) + ld-name = lld + else + ld-name = bfd + endif +endif # ld-version # Note this is mainly for HJ Lu's 3 number binutil versions