]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/cc, cmd/5c, cmd/6c, cmd/8c: introduce linkarchinit and add amd64p32 support
authorDave Cheney <dave@cheney.net>
Thu, 6 Mar 2014 22:55:59 +0000 (09:55 +1100)
committerDave Cheney <dave@cheney.net>
Thu, 6 Mar 2014 22:55:59 +0000 (09:55 +1100)
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

src/cmd/6c/txt.c
src/cmd/8c/txt.c
src/cmd/cc/cc.h
src/cmd/cc/lex.c

index 61b333c1cbe5a126b6c15e11c3554eb868192468..f308aff08c1aa932b6bb350791009e638b157687 100644 (file)
 
 #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)
 {
index 8a38955459785debab3c4bb5e5cba931a69d1865..1b6c2e6d960cb8622e3c1a179335ecb358f4440d 100644 (file)
 
 #include "gc.h"
 
-LinkArch       *thelinkarch = &link386;
 
 int thechar = '8';
 char *thestring = "386";
 
+LinkArch       *thelinkarch = &link386;
+
+void
+linkarchinit(void)
+{
+}
+
 void
 ginit(void)
 {
index 726364ce944829d2463758bd0afa0df0d08ae20c..c8aac125301fa5ea8271143230faeb204348152a 100644 (file)
@@ -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[];
 
index f6025d28073ef4fd241bb7e5f25aac8024391d11..a8ece212f055a42f8afa090b52da1a23ec41920c 100644 (file)
@@ -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;