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
#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)
{
#include "gc.h"
-LinkArch *thelinkarch = &link386;
int thechar = '8';
char *thestring = "386";
+LinkArch *thelinkarch = &link386;
+
+void
+linkarchinit(void)
+{
+}
+
void
ginit(void)
{
int32 align(int32, Type*, int, int32*);
int32 maxround(int32, int32);
int hasdotdotdot(void);
+void linkarchinit(void);
extern schar ewidth[];
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;
quotefmtinstall(); // before cinit, which overrides %Q
+ linkarchinit();
ctxt = linknew(thelinkarch);
ctxt->diag = yyerror;
ctxt->bso = &bstdout;