[build] Fix get-build-id to work with Clang

There are two issues:

(1) $(READELF) variable contains string with spaces so it has to be
quoted before passing to get-build-id script

(2) Unlike readelf, llvm-readobj prints the version stored in the
NT_GNU_GOLD_VERSION note. Unfortunatelly, when gold produces this note
it (accidentally?) places in three zero bytes at the end of the note
string. llvm-readobj prints those which causes grep to interpret the
output as a binary, not as a text (grep interprets any content that
contains zero byte as binary), so we need to force grep to always
interpret the output as text in this case.

Change-Id: I854806262c758cf12b7e4a85dc97ebd45e777139
Esse commit está contido em:
Petr Hosek
2017-03-08 10:51:21 -08:00
commit bfc4462b03
2 arquivos alterados com 2 adições e 2 exclusões
+1 -1
Ver Arquivo
@@ -90,7 +90,7 @@ $(BUILDDIR)/%.size: $(BUILDDIR)/%
$(NOECHO)$(NM) -S --size-sort $< > $@
$(BUILDDIR)/%.id: $(BUILDDIR)/%
$(NOECHO)env READELF=$(READELF) $(call SCRIPTNAME, scripts/get-build-id) $< > $@
$(NOECHO)env READELF="$(READELF)" $(call SCRIPTNAME, scripts/get-build-id) $< > $@
ifneq ($(USER_AUTORUN),)
USER_MANIFEST_LINES += autorun=$(USER_AUTORUN)
+1 -1
Ver Arquivo
@@ -21,4 +21,4 @@ fi
READELF=${READELF:-readelf}
FILE="$1"
LC_ALL=C $READELF -n $FILE | grep 'Build ID:' | sed 's/.*: //g'
LC_ALL=C $READELF -n $FILE | grep -a 'Build ID:' | sed 's/.*: //g'