]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/5c, cmd/6c, cmd/8c: isolate textflag and dataflag
authorAnthony Martin <ality@pbrane.org>
Tue, 4 Jun 2013 22:18:02 +0000 (15:18 -0700)
committerAnthony Martin <ality@pbrane.org>
Tue, 4 Jun 2013 22:18:02 +0000 (15:18 -0700)
Fixes #5419.

R=golang-dev, dave, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/9241044

src/cmd/5c/txt.c
src/cmd/6c/txt.c
src/cmd/8c/txt.c

index b8675fe60f9c915ea5ba8099d50ec50ce834ea7f..8dfd586fd4a3abd59545994851254cfd39ff4687 100644 (file)
@@ -139,9 +139,7 @@ gclean(void)
                        continue;
                if(s->type == types[TENUM])
                        continue;
-               textflag = s->dataflag;
                gpseudo(AGLOBL, s, nodconst(s->type->width));
-               textflag = 0;
        }
        nextpc();
        p->as = AEND;
@@ -1181,10 +1179,17 @@ gpseudo(int a, Sym *s, Node *n)
        p->from.type = D_OREG;
        p->from.sym = s;
        p->from.name = D_EXTERN;
-       if(a == ATEXT || a == AGLOBL) {
+
+       switch(a) {
+       case ATEXT:
                p->reg = textflag;
                textflag = 0;
+               break;
+       case AGLOBL:
+               p->reg = s->dataflag;
+               break;
        }
+
        if(s->class == CSTATIC)
                p->from.name = D_STATIC;
        naddr(n, &p->to);
index 364b189f271e30a254b465d31fdbb841a768c145..54b1cf54cb84062f95915361f1bf3633e3532740 100644 (file)
@@ -158,9 +158,7 @@ gclean(void)
                        continue;
                if(s->type == types[TENUM])
                        continue;
-               textflag = s->dataflag;
                gpseudo(AGLOBL, s, nodconst(s->type->width));
-               textflag = 0;
        }
        nextpc();
        p->as = AEND;
@@ -1502,8 +1500,16 @@ gpseudo(int a, Sym *s, Node *n)
        p->as = a;
        p->from.type = D_EXTERN;
        p->from.sym = s;
-       p->from.scale = textflag;
-       textflag = 0;
+
+       switch(a) {
+       case ATEXT:
+               p->from.scale = textflag;
+               textflag = 0;
+               break;
+       case AGLOBL:
+               p->from.scale = s->dataflag;
+               break;
+       }
 
        if(s->class == CSTATIC)
                p->from.type = D_STATIC;
index 1b7617bc52734e7e41e86cf0fd6392542055dbb1..7f953879550e533e9e3424282810e33676594c4f 100644 (file)
@@ -146,9 +146,7 @@ gclean(void)
                        continue;
                if(s->type == types[TENUM])
                        continue;
-               textflag = s->dataflag;
                gpseudo(AGLOBL, s, nodconst(s->type->width));
-               textflag = 0;
        }
        nextpc();
        p->as = AEND;
@@ -1381,8 +1379,16 @@ gpseudo(int a, Sym *s, Node *n)
        p->as = a;
        p->from.type = D_EXTERN;
        p->from.sym = s;
-       p->from.scale = textflag;
-       textflag = 0;
+
+       switch(a) {
+       case ATEXT:
+               p->from.scale = textflag;
+               textflag = 0;
+               break;
+       case AGLOBL:
+               p->from.scale = s->dataflag;
+               break;
+       }
 
        if(s->class == CSTATIC)
                p->from.type = D_STATIC;