Commit 463009ff authored by Shenghou Ma's avatar Shenghou Ma Committed by Russ Cox

5a, 5c, 5g, 5l: fix build for Linux/ARM.

ARM doesn't have the concept of scale, so I renamed the field
Addr.scale to Addr.flag to better reflect its true meaning.

R=rsc
CC=golang-dev
https://golang.org/cl/5687044
parent 72f5a91a
......@@ -491,6 +491,7 @@ zaddr(Gen *a, int s)
Bputc(&obuf, a->type);
Bputc(&obuf, a->reg);
Bputc(&obuf, 0); // flag
Bputc(&obuf, s);
Bputc(&obuf, a->name);
switch(a->type) {
......
......@@ -564,9 +564,10 @@ zaddr(char *bp, Adr *a, int s)
bp[0] = a->type;
bp[1] = a->reg;
bp[2] = s;
bp[3] = a->name;
bp += 4;
bp[2] = 0; // flag
bp[3] = s;
bp[4] = a->name;
bp += 5;
switch(a->type) {
default:
diag(Z, "unknown type %d in zaddr", a->type);
......
......@@ -27,6 +27,7 @@ struct Addr
uchar reg;
char pun;
uchar etype;
char flag;
};
#define A ((Addr*)0)
......
......@@ -93,6 +93,7 @@ zaddr(Biobuf *b, Addr *a, int s)
default:
Bputc(b, a->type);
Bputc(b, a->reg);
Bputc(b, a->flag);
Bputc(b, s);
Bputc(b, a->name);
}
......
......@@ -254,9 +254,9 @@ ggloblnod(Node *nam, int32 width)
p->to.type = D_CONST;
p->to.offset = width;
if(nam->readonly)
p->from.scale = RODATA;
p->from.flag = RODATA;
if(nam->type != T && !haspointers(nam->type))
p->from.scale |= NOPTR;
p->from.flag |= NOPTR;
}
void
......@@ -273,6 +273,7 @@ ggloblsym(Sym *s, int32 width, int dupok)
p->to.offset = width;
if(dupok)
p->reg = DUPOK;
p->from.flag |= RODATA;
}
int
......
......@@ -74,6 +74,7 @@ enum {
ElfStrRelPlt,
ElfStrPlt,
ElfStrNoteNetbsdIdent,
ElfStrNoPtrData,
NElfStr
};
......@@ -164,6 +165,7 @@ doelf(void)
elfstr[ElfStrEmpty] = addstring(shstrtab, "");
elfstr[ElfStrText] = addstring(shstrtab, ".text");
elfstr[ElfStrNoPtrData] = addstring(shstrtab, ".noptrdata");
elfstr[ElfStrData] = addstring(shstrtab, ".data");
elfstr[ElfStrBss] = addstring(shstrtab, ".bss");
if(HEADTYPE == Hnetbsd)
......
......@@ -76,6 +76,7 @@ struct Adr
uchar index; // not used on arm, required by ld/go.c
char reg;
char name;
char flag;
int32 offset2; // argsize
char class;
Sym* gotype;
......
......@@ -301,6 +301,7 @@ zaddr(Biobuf *f, Adr *a, Sym *h[])
a->type = Bgetc(f);
a->reg = Bgetc(f);
a->flag = Bgetc(f);
c = Bgetc(f);
if(c < 0 || c > NSYM){
print("sym out of range: %d\n", c);
......@@ -549,9 +550,9 @@ loop:
s->size = p->to.offset;
if(p->reg & DUPOK)
s->dupok = 1;
if(p->from.scale & RODATA)
if(p->from.flag & RODATA)
s->type = SRODATA;
else if(p->from.scale & NOPTR)
else if(p->from.flag & NOPTR)
s->type = SNOPTRDATA;
break;
......
......@@ -112,7 +112,7 @@ addr(Biobuf *bp)
long off;
a.type = Bgetc(bp); /* a.type */
skip(bp,1); /* reg */
skip(bp,2); /* reg, flag */
a.sym = Bgetc(bp); /* sym index */
a.name = Bgetc(bp); /* sym type */
switch(a.type){
......
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