*l/*c: add -V flag to display version number
R=rsc
CC=golang-dev
https://golang.org/cl/204044
diff --git a/src/cmd/5l/doc.go b/src/cmd/5l/doc.go
index 1324261..b724e701 100644
--- a/src/cmd/5l/doc.go
+++ b/src/cmd/5l/doc.go
@@ -23,6 +23,8 @@
-L dir1,dir2,..
Search for libraries (package files) in the comma-separated list of directories.
The default is the single location $GOROOT/pkg/$GOOS_arm.
+-V
+ Print the linker version.
*/
package documentation
diff --git a/src/cmd/5l/obj.c b/src/cmd/5l/obj.c
index 5dbd765..374e3df 100644
--- a/src/cmd/5l/obj.c
+++ b/src/cmd/5l/obj.c
@@ -141,6 +141,9 @@
if(argv[1] != nil && argv[1][0] != '-' && !isobjfile(argv[1]))
readundefs(ARGF(), SIMPORT);
break;
+ case 'V':
+ print("%cl version %s\n", thechar, getgoversion());
+ errorexit();
} ARGEND
USED(argc);
diff --git a/src/cmd/6l/doc.go b/src/cmd/6l/doc.go
index 6a0a735..fb88df5 100644
--- a/src/cmd/6l/doc.go
+++ b/src/cmd/6l/doc.go
@@ -35,6 +35,8 @@
-L dir1,dir2,..
Search for libraries (package files) in the comma-separated list of directories.
The default is the single location $GOROOT/pkg/$GOOS_amd64.
+-V
+ Print the linker version.
*/
diff --git a/src/cmd/6l/obj.c b/src/cmd/6l/obj.c
index 537ef9e..d951696 100644
--- a/src/cmd/6l/obj.c
+++ b/src/cmd/6l/obj.c
@@ -136,6 +136,9 @@
if(argv[1] != nil && argv[1][0] != '-' && !isobjfile(argv[1]))
readundefs(ARGF(), SIMPORT);
break;
+ case 'V':
+ print("%cl version %s\n", thechar, getgoversion());
+ errorexit();
} ARGEND
if(argc != 1)
diff --git a/src/cmd/8l/doc.go b/src/cmd/8l/doc.go
index 0de4dfc..3a830cb 100644
--- a/src/cmd/8l/doc.go
+++ b/src/cmd/8l/doc.go
@@ -32,6 +32,8 @@
-L dir1,dir2,..
Search for libraries (package files) in the comma-separated list of directories.
The default is the single location $GOROOT/pkg/$GOOS_386.
+-V
+ Print the linker version.
*/
diff --git a/src/cmd/8l/obj.c b/src/cmd/8l/obj.c
index 6ab4862..c3044c2 100644
--- a/src/cmd/8l/obj.c
+++ b/src/cmd/8l/obj.c
@@ -142,6 +142,9 @@
if(argv[1] != nil && argv[1][0] != '-' && !isobjfile(argv[1]))
readundefs(ARGF(), SIMPORT);
break;
+ case 'V':
+ print("%cl version %s\n", thechar, getgoversion());
+ errorexit();
} ARGEND
if(argc != 1)
diff --git a/src/cmd/gc/doc.go b/src/cmd/gc/doc.go
index 5250cfc..108a091 100644
--- a/src/cmd/gc/doc.go
+++ b/src/cmd/gc/doc.go
@@ -38,6 +38,8 @@
disable optimization
-S
write assembly language text to standard output
+ -V
+ print the compiler version
There are also a number of debugging flags; run the command with no arguments
to get a usage message.
diff --git a/src/cmd/gc/lex.c b/src/cmd/gc/lex.c
index 175d7a3..9c1cbfc 100644
--- a/src/cmd/gc/lex.c
+++ b/src/cmd/gc/lex.c
@@ -65,6 +65,9 @@
case 'I':
addidir(ARGF());
break;
+ case 'V':
+ print("%cg version %s\n", thechar, getgoversion());
+ errorexit();
} ARGEND
if(argc < 1)
@@ -168,6 +171,7 @@
print(" -h panic on an error\n");
print(" -o file specify output file\n");
print(" -S print the assembly language\n");
+ print(" -V print the compiler version\n");
print(" -w print the parse tree after typing\n");
print(" -x print lex tokens\n");
exit(0);