Skip to contentSkip to conversation

Print compiler and linker version with the version command

PATCH New Alexander Holler 2 participants 2 messages Jan 18, 2011 – Feb 2, 2011 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Print compiler and linker version with the version command

After years of unsuccessful research I've finally shamelessly stolen other peoples intellectual properties to present the all-new and world-changing updated version command:
-
U-Boot>> version

U-Boot 2010.12-00014-g7435056-dirty (Jan 18 2011 - 23:19:38) MyBoard
gcc (GCC) 0.42 (Distro foobar)
GNU ld (GNU Binutils) 0.314159265
-
May the toolchain bugs rest in peace.

---
 Makefile             |    4 ++++
 common/cmd_version.c |    9 ++++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)
Makefile +4 -0
index 9055028..b434212 100644
@@ -416,6 +416,10 @@ $(U_BOOT_ONENAND):	$(ONENAND_IPL) $(obj)u-boot.bin
 $(VERSION_FILE):
 		@( printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' "$(U_BOOT_VERSION)" \
 		 '$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ) > [email protected]
+		@( printf '#define CC_VERSION_STRING "%s"\n' \
+		 '$(shell $(CC) --version | head -n 1)' )>>  [email protected]
+		@( printf '#define LD_VERSION_STRING "%s"\n' \
+		 '$(shell $(LD) -v | head -n 1)' )>>  [email protected]
 		@cmp -s $@ [email protected] && rm -f [email protected] || mv -f [email protected] $@
 
 $(TIMESTAMP_FILE):
common/cmd_version.c +8 -1
index 7d1b495..83cb11c 100644
@@ -23,18 +23,25 @@
 
 #include <common.h>
 #include <command.h>
+#include <version.h>
 
 extern char version_string[];
 
 int do_version(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	printf("\n%s\n", version_string);
+#ifdef CC_VERSION_STRING
+	puts(CC_VERSION_STRING "\n");
+#endif
+#ifdef LD_VERSION_STRING
+	puts(LD_VERSION_STRING "\n");
+#endif
 
 	return 0;
 }
 
 U_BOOT_CMD(
 	version,	1,		1,	do_version,
-	"print monitor version",
+	"print monitor, compiler and linker version",
 	""
 );
Signature · 1 line
1.7.3.4
#1 lore raw

PATCH 1/1 Print compiler and linker version with the version command

Dear Alexander Holler,

Quoted 13 lines · In message <[email protected]> you wrote:

After years of unsuccessful research I've finally shamelessly stolen other peoples intellectual properties to present the all-new and world-changing updated version command:
-
U-Boot>> version

U-Boot 2010.12-00014-g7435056-dirty (Jan 18 2011 - 23:19:38) MyBoard
gcc (GCC) 0.42 (Distro foobar)
GNU ld (GNU Binutils) 0.314159265
-
May the toolchain bugs rest in peace.

Quoted 5 lines
---
 Makefile             |    4 ++++
 common/cmd_version.c |    9 ++++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Every time history repeats itself the price goes up.