So we can tell from a binary which version of
Go built it.
LGTM=minux, rsc
R=golang-codereviews, minux, khr, rsc, dave
CC=golang-codereviews
https://golang.org/cl/
117040043
"package runtime\n"
"\n"
"const defaultGoroot = `%s`\n"
- "const theVersion = `%s`\n", goroot_final, goversion));
+ "const theVersion = `%s`\n"
+ "var buildVersion = theVersion\n", goroot_final, goversion));
writefile(&out, file, 0);
static bool haveexperiment(int8*);
static void allgadd(G*);
+extern String runtime·buildVersion;
+
// The bootstrap sequence is:
//
// call osinit
runtime·copystack = false;
mstats.enablegc = 1;
+
+ if(runtime·buildVersion.str == nil) {
+ // Condition should never trigger. This code just serves
+ // to ensure runtime·buildVersion is kept in the resulting binary.
+ runtime·buildVersion.str = (uint8*)"unknown";
+ runtime·buildVersion.len = 7;
+ }
}
extern void main·init(void);