1
0
mirror of https://github.com/golang/go synced 2024-11-22 03:34:40 -07:00

cmd/5l: embed $GOARM value into binary as runtime.goarm

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6449127
This commit is contained in:
Shenghou Ma 2012-09-03 03:51:13 +08:00
parent 5b7562dd6f
commit 88ba4de152
2 changed files with 12 additions and 1 deletions

View File

@ -307,6 +307,7 @@ EXTERN Prog zprg;
EXTERN int dtype;
EXTERN int tlsoffset;
EXTERN int armsize;
EXTERN int goarm;
extern char* anames[];
extern Optab optab[];

View File

@ -76,6 +76,7 @@ main(int argc, char *argv[])
{
int c;
char *p, *name, *val;
Sym *s;
Binit(&bso, 1, OWRITE);
listinit();
@ -89,7 +90,11 @@ main(int argc, char *argv[])
nuxiinit();
p = getenv("GOARM");
if(p != nil && strcmp(p, "5") == 0)
if(p != nil)
goarm = atoi(p);
else
goarm = 7;
if(goarm == 5)
debug['F'] = 1;
ARGBEGIN {
@ -243,6 +248,11 @@ main(int argc, char *argv[])
cbp = buf.cbuf;
cbc = sizeof(buf.cbuf);
// embed goarm to runtime.goarm
s = lookup("runtime.goarm", 0);
s->dupok = 1;
adduint8(s, goarm);
addlibpath("command line", "command line", argv[0], "main");
loadlib();