ANDROID: scripts/Kbuild: avoid <<< for dash shell

The build server seems to be using dash shell, which doesn't support
<<<. Avoid invoking the shell entirely to figure out which linker we're
using, so that we don't have bugs and build failures on the server that
aren't reproducible locally.

Bug: 117299373
Change-Id: I0cd9940c2fa07a6bb4573ec8b1edcd21fd1f3a4d
Reported-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Rapherion Rollerscaperers <rapherion@raphielgang.org>
This commit is contained in:
Nick Desaulniers 2019-03-21 11:43:13 -07:00 committed by xxmustafacooTR
parent 773f7f9fdc
commit 3caa54b873
No known key found for this signature in database
GPG key ID: 520B6FE385CBF5C9

View file

@ -205,8 +205,19 @@ ld-option = $(call try-run, $(LD) $(LDFLAGS) $(1) -v,$(1),$(2),$(3))
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 GNU ld,$(__ld-name)))
ld-name = bfd
else
ld-name = lld
endif
endif
# ld-version
# Note this is mainly for HJ Lu's 3 number binutil versions