]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/6a: add support for nacl/amd64p32
authorDave Cheney <dave@cheney.net>
Fri, 7 Mar 2014 05:02:25 +0000 (16:02 +1100)
committerDave Cheney <dave@cheney.net>
Fri, 7 Mar 2014 05:02:25 +0000 (16:02 +1100)
Replaces CL 70000043.

Switch to the amd64p32 linker model if we are building under nacl/amd64p32.

No need to introduce linkarchinit() as 6a contains its own main() function.

LGTM=rsc
R=rsc, minux.ma
CC=golang-codereviews
https://golang.org/cl/72020043

src/cmd/6a/lex.c

index 98f3e427254075f6b982c350f6faf9c99e283f91..e24fbc9dc4b9175ab00eea7bc71e2df7de221654 100644 (file)
@@ -63,6 +63,8 @@ Lconv(Fmt *fp)
        return linklinefmt(ctxt, fp);
 }
 
+LinkArch*       thelinkarch = &linkamd64;
+
 void
 main(int argc, char *argv[])
 {
@@ -72,18 +74,20 @@ main(int argc, char *argv[])
        thechar = '6';
        thestring = "amd64";
 
-       ctxt = linknew(&linkamd64);
-       ctxt->diag = yyerror;
-       ctxt->bso = &bstdout;
-       Binit(&bstdout, 1, OWRITE);
-       listinit6();
-       fmtinstall('L', Lconv);
-
        // Allow GOARCH=thestring or GOARCH=thestringsuffix,
        // but not other values.        
        p = getgoarch();
        if(strncmp(p, thestring, strlen(thestring)) != 0)
                sysfatal("cannot use %cc with GOARCH=%s", thechar, p);
+       if(strcmp(p, "amd64p32") == 0)
+               thelinkarch = &linkamd64p32;
+
+       ctxt = linknew(thelinkarch);
+       ctxt->diag = yyerror;
+       ctxt->bso = &bstdout;
+       Binit(&bstdout, 1, OWRITE);
+       listinit6();
+       fmtinstall('L', Lconv);
 
        ensuresymb(NSYMB);
        memset(debug, 0, sizeof(debug));