Commit 2449909d authored by Anthony Martin's avatar Anthony Martin

cmd/5c, cmd/6c, cmd/8c: isolate textflag and dataflag

Fixes #5419.

R=golang-dev, dave, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/9241044
parent 2bcc3089
...@@ -139,9 +139,7 @@ gclean(void) ...@@ -139,9 +139,7 @@ gclean(void)
continue; continue;
if(s->type == types[TENUM]) if(s->type == types[TENUM])
continue; continue;
textflag = s->dataflag;
gpseudo(AGLOBL, s, nodconst(s->type->width)); gpseudo(AGLOBL, s, nodconst(s->type->width));
textflag = 0;
} }
nextpc(); nextpc();
p->as = AEND; p->as = AEND;
...@@ -1181,10 +1179,17 @@ gpseudo(int a, Sym *s, Node *n) ...@@ -1181,10 +1179,17 @@ gpseudo(int a, Sym *s, Node *n)
p->from.type = D_OREG; p->from.type = D_OREG;
p->from.sym = s; p->from.sym = s;
p->from.name = D_EXTERN; p->from.name = D_EXTERN;
if(a == ATEXT || a == AGLOBL) {
switch(a) {
case ATEXT:
p->reg = textflag; p->reg = textflag;
textflag = 0; textflag = 0;
break;
case AGLOBL:
p->reg = s->dataflag;
break;
} }
if(s->class == CSTATIC) if(s->class == CSTATIC)
p->from.name = D_STATIC; p->from.name = D_STATIC;
naddr(n, &p->to); naddr(n, &p->to);
......
...@@ -158,9 +158,7 @@ gclean(void) ...@@ -158,9 +158,7 @@ gclean(void)
continue; continue;
if(s->type == types[TENUM]) if(s->type == types[TENUM])
continue; continue;
textflag = s->dataflag;
gpseudo(AGLOBL, s, nodconst(s->type->width)); gpseudo(AGLOBL, s, nodconst(s->type->width));
textflag = 0;
} }
nextpc(); nextpc();
p->as = AEND; p->as = AEND;
...@@ -1502,8 +1500,16 @@ gpseudo(int a, Sym *s, Node *n) ...@@ -1502,8 +1500,16 @@ gpseudo(int a, Sym *s, Node *n)
p->as = a; p->as = a;
p->from.type = D_EXTERN; p->from.type = D_EXTERN;
p->from.sym = s; p->from.sym = s;
switch(a) {
case ATEXT:
p->from.scale = textflag; p->from.scale = textflag;
textflag = 0; textflag = 0;
break;
case AGLOBL:
p->from.scale = s->dataflag;
break;
}
if(s->class == CSTATIC) if(s->class == CSTATIC)
p->from.type = D_STATIC; p->from.type = D_STATIC;
......
...@@ -146,9 +146,7 @@ gclean(void) ...@@ -146,9 +146,7 @@ gclean(void)
continue; continue;
if(s->type == types[TENUM]) if(s->type == types[TENUM])
continue; continue;
textflag = s->dataflag;
gpseudo(AGLOBL, s, nodconst(s->type->width)); gpseudo(AGLOBL, s, nodconst(s->type->width));
textflag = 0;
} }
nextpc(); nextpc();
p->as = AEND; p->as = AEND;
...@@ -1381,8 +1379,16 @@ gpseudo(int a, Sym *s, Node *n) ...@@ -1381,8 +1379,16 @@ gpseudo(int a, Sym *s, Node *n)
p->as = a; p->as = a;
p->from.type = D_EXTERN; p->from.type = D_EXTERN;
p->from.sym = s; p->from.sym = s;
switch(a) {
case ATEXT:
p->from.scale = textflag; p->from.scale = textflag;
textflag = 0; textflag = 0;
break;
case AGLOBL:
p->from.scale = s->dataflag;
break;
}
if(s->class == CSTATIC) if(s->class == CSTATIC)
p->from.type = D_STATIC; p->from.type = D_STATIC;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment