Commit e31a1ce1 authored by Dave Cheney's avatar Dave Cheney

cmd/gc, cmd/5g, cmd/6g, cmd/8g: introduce linkarchinit and add amd64p32 support

Replaces CL 70000043.

Introduce linkarchinit() from cmd/ld.

For cmd/6g, switch to the amd64p32 linker model if we are building under nacl/amd64p32.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/71330045
parent 22c668a8
......@@ -10,6 +10,11 @@ int thechar = '5';
char* thestring = "arm";
LinkArch* thelinkarch = &linkarm;
void
linkarchinit(void)
{
}
vlong MAXWIDTH = (1LL<<32) - 1;
/*
......
......@@ -10,6 +10,13 @@ int thechar = '6';
char* thestring = "amd64";
LinkArch* thelinkarch = &linkamd64;
void
linkarchinit(void)
{
if(strcmp(getgoarch(), "amd64p32") == 0)
thelinkarch = &linkamd64p32;
}
vlong MAXWIDTH = 1LL<<50;
int addptr = AADDQ;
......
......@@ -10,6 +10,11 @@ int thechar = '8';
char* thestring = "386";
LinkArch* thelinkarch = &link386;
void
linkarchinit(void)
{
}
vlong MAXWIDTH = (1LL<<32) - 1;
/*
......
......@@ -1505,6 +1505,7 @@ Prog* gjmp(Prog*);
void gused(Node*);
void movelarge(NodeList*);
int isfat(Type*);
void linkarchinit(void);
void liveness(Node*, Prog*, Sym*, Sym*, Sym*);
void markautoused(Prog*);
Plist* newplist(void);
......
......@@ -212,7 +212,14 @@ main(int argc, char *argv[])
#ifdef PLAN9
notify(catcher);
#endif
// Allow GOARCH=thestring or GOARCH=thestringsuffix,
// but not other values.
p = getgoarch();
if(strncmp(p, thestring, strlen(thestring)) != 0)
fatal("cannot use %cg with GOARCH=%s", thechar, p);
goarch = p;
linkarchinit();
ctxt = linknew(thelinkarch);
ctxt->diag = yyerror;
ctxt->bso = &bstdout;
......@@ -259,13 +266,6 @@ main(int argc, char *argv[])
goroot = getgoroot();
goos = getgoos();
// Allow GOARCH=thestring or GOARCH=thestringsuffix,
// but not other values.
p = getgoarch();
if(strncmp(p, thestring, strlen(thestring)) != 0)
fatal("cannot use %cg with GOARCH=%s", thechar, p);
goarch = p;
nacl = strcmp(goos, "nacl") == 0;
if(nacl)
flag_largemodel = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment