Commit d4896fb8 authored by Dave Cheney's avatar Dave Cheney

cmd/cc, cmd/5c, cmd/6c, cmd/8c: introduce linkarchinit and add amd64p32 support

Replaces CL 70000043.

Introduce linkarchinit() from cmd/ld.

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

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/72010043
parent 2fb87ddb
......@@ -30,11 +30,18 @@
#include "gc.h"
LinkArch *thelinkarch = &linkamd64;
int thechar = '6';
char *thestring = "amd64";
LinkArch *thelinkarch = &linkamd64;
void
linkarchinit(void)
{
if(strcmp(getgoarch(), "amd64p32") == 0)
thelinkarch = &linkamd64p32;
}
void
ginit(void)
{
......
......@@ -30,11 +30,17 @@
#include "gc.h"
LinkArch *thelinkarch = &link386;
int thechar = '8';
char *thestring = "386";
LinkArch *thelinkarch = &link386;
void
linkarchinit(void)
{
}
void
ginit(void)
{
......
......@@ -795,6 +795,7 @@ int32 exreg(Type*);
int32 align(int32, Type*, int, int32*);
int32 maxround(int32, int32);
int hasdotdotdot(void);
void linkarchinit(void);
extern schar ewidth[];
......
......@@ -124,7 +124,7 @@ main(int argc, char *argv[])
p = getgoarch();
if(strncmp(p, thestring, strlen(thestring)) != 0)
sysfatal("cannot use %cc with GOARCH=%s", thechar, p);
if(strcmp(getgoarch(), "amd64p32") == 0) // must be before cinit
if(strcmp(p, "amd64p32") == 0) // must be before cinit
ewidth[TIND] = 4;
nacl = strcmp(getgoos(), "nacl") == 0;
......@@ -133,6 +133,7 @@ main(int argc, char *argv[])
quotefmtinstall(); // before cinit, which overrides %Q
linkarchinit();
ctxt = linknew(thelinkarch);
ctxt->diag = yyerror;
ctxt->bso = &bstdout;
......
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