Patchwork [U-Boot,v3,1/9] tools, config.mk: add binutils-version

login
register
mail settings
Submitter Allen Martin
Date Aug. 15, 2012, 9:38 p.m.
Message ID <1345066741-19613-2-git-send-email-amartin@nvidia.com>
Download mbox | patch
Permalink /patch/177864/
State Changes Requested
Delegated to: Tom Warren
Headers show

Comments

Allen Martin - Aug. 15, 2012, 9:38 p.m.
Modeled after gcc-version, add function to get binutils version.

Signed-off-by: Allen Martin <amartin@nvidia.com>
---
 config.mk                 |    1 +
 tools/binutils-version.sh |   20 ++++++++++++++++++++
 2 files changed, 21 insertions(+)
 create mode 100755 tools/binutils-version.sh
Wolfgang Denk - Sept. 2, 2012, 3:05 p.m.
Dear Allen Martin,

In message <1345066741-19613-2-git-send-email-amartin@nvidia.com> you wrote:
> Modeled after gcc-version, add function to get binutils version.
> 
> Signed-off-by: Allen Martin <amartin@nvidia.com>
> ---
>  config.mk                 |    1 +
>  tools/binutils-version.sh |   20 ++++++++++++++++++++
>  2 files changed, 21 insertions(+)
>  create mode 100755 tools/binutils-version.sh

As this is part of a series that will go through the tegra / arm
trees:

Acked-by: Wolfgang Denk <wd@denx.de>


Best regards,

Wolfgang Denk
Allen Martin - Sept. 4, 2012, 8:30 p.m.
On Sun, Sep 02, 2012 at 08:05:11AM -0700, Wolfgang Denk wrote:
> Dear Allen Martin,
> 
> In message <1345066741-19613-2-git-send-email-amartin@nvidia.com> you wrote:
> > Modeled after gcc-version, add function to get binutils version.
> > 
> > Signed-off-by: Allen Martin <amartin@nvidia.com>
> > ---
> >  config.mk                 |    1 +
> >  tools/binutils-version.sh |   20 ++++++++++++++++++++
> >  2 files changed, 21 insertions(+)
> >  create mode 100755 tools/binutils-version.sh
> 
> As this is part of a series that will go through the tegra / arm
> trees:
> 
> Acked-by: Wolfgang Denk <wd@denx.de>
> 
> 

I'm carrying it in this series because I hit the assembler bug that
this works around, but I also posted it as a separate patch (2 patches
actually, this one and "arm: work around assembler bug").  I'm fine
with just carrying it in this series if that's preferred, since I seem
to be the only one hitting this when I enable thumb for tegra.

-Allen

Patch

diff --git a/config.mk b/config.mk
index 3dcea6a..919b77d 100644
--- a/config.mk
+++ b/config.mk
@@ -128,6 +128,7 @@  endif
 # cc-version
 # Usage gcc-ver := $(call cc-version)
 cc-version = $(shell $(SHELL) $(SRCTREE)/tools/gcc-version.sh $(CC))
+binutils-version = $(shell $(SHELL) $(SRCTREE)/tools/binutils-version.sh $(AS))
 
 #
 # Include the make variables (CC, etc...)
diff --git a/tools/binutils-version.sh b/tools/binutils-version.sh
new file mode 100755
index 0000000..d4d9eb4
--- /dev/null
+++ b/tools/binutils-version.sh
@@ -0,0 +1,20 @@ 
+#!/bin/sh
+#
+# binutils-version [-p] gas-command
+#
+# Prints the binutils version of `gas-command' in a canonical 4-digit form
+# such as `0222' for binutils 2.22
+#
+
+gas="$*"
+
+if [ ${#gas} -eq 0 ]; then
+	echo "Error: No assembler specified."
+	printf "Usage:\n\t$0 <gas-command>\n"
+	exit 1
+fi
+
+MAJOR=$($gas --version | head -1 | awk '{print $NF}' | cut -d . -f 1)
+MINOR=$($gas --version | head -1 | awk '{print $NF}' | cut -d . -f 2)
+
+printf "%02d%02d\\n" $MAJOR $MINOR