]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/gc, cmd/5g, cmd/6g, cmd/8g: introduce linkarchinit and add amd64p32 support
authorDave Cheney <dave@cheney.net>
Fri, 7 Mar 2014 04:33:44 +0000 (15:33 +1100)
committerDave Cheney <dave@cheney.net>
Fri, 7 Mar 2014 04:33:44 +0000 (15:33 +1100)
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

src/cmd/5g/galign.c
src/cmd/6g/galign.c
src/cmd/8g/galign.c
src/cmd/gc/go.h
src/cmd/gc/lex.c

index 14d323fa7eff2a92d92896d41c137e383625f6f3..a62102ef84f38e1909531777472c42e251b09165 100644 (file)
@@ -10,6 +10,11 @@ int  thechar = '5';
 char*  thestring       = "arm";
 LinkArch*      thelinkarch = &linkarm;
 
+void
+linkarchinit(void)
+{
+}
+
 vlong MAXWIDTH = (1LL<<32) - 1;
 
 /*
index ec37ceb23308f764997c70c9397db8d360279d3d..d0727fe57c8ea3e4a2a3e0af8c2f05ae1f6649c6 100644 (file)
@@ -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;
index 439e741553f60f847f684d2a4c479ad313e9cb36..fbd2e9ad35de8e7e623863d33e6c4c3ff134e1aa 100644 (file)
@@ -10,6 +10,11 @@ int  thechar = '8';
 char*  thestring       = "386";
 LinkArch*      thelinkarch = &link386;
 
+void
+linkarchinit(void)
+{
+}
+
 vlong MAXWIDTH = (1LL<<32) - 1;
 
 /*
index 3750413a81e4a07c9c42ca138afe2895f60cf076..151032eb905ffe75dec9ae2f28c23ee77cbecdea 100644 (file)
@@ -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);
index 430abae5b13de8b9ae61b2e642cc083368f438de..aeeac68a155ea25b7c3e35b968ea9d3fec6e0f04 100644 (file)
@@ -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;