diff mbox

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

Message ID 1345066741-19613-2-git-send-email-amartin@nvidia.com
State Changes Requested
Delegated to: Tom Warren
Headers show

Commit Message

Allen Martin Aug. 15, 2012, 9:38 p.m. UTC
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

Comments

Wolfgang Denk Sept. 2, 2012, 3:05 p.m. UTC | #1
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. UTC | #2
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
diff mbox

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