From 463009ff06c246afa7a7d0999c198fc5a3808294 Mon Sep 17 00:00:00 2001 From: Shenghou Ma Date: Sun, 19 Feb 2012 18:11:16 -0500 Subject: [PATCH] 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 --- src/cmd/5a/lex.c | 1 + src/cmd/5c/swt.c | 7 ++++--- src/cmd/5g/gg.h | 1 + src/cmd/5g/gobj.c | 1 + src/cmd/5g/gsubr.c | 5 +++-- src/cmd/5l/asm.c | 2 ++ src/cmd/5l/l.h | 1 + src/cmd/5l/obj.c | 5 +++-- src/libmach/5obj.c | 2 +- 9 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/cmd/5a/lex.c b/src/cmd/5a/lex.c index 4bef0219a2..ab7e5228ec 100644 --- a/src/cmd/5a/lex.c +++ b/src/cmd/5a/lex.c @@ -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) { diff --git a/src/cmd/5c/swt.c b/src/cmd/5c/swt.c index 7268f9af26..124a9710f5 100644 --- a/src/cmd/5c/swt.c +++ b/src/cmd/5c/swt.c @@ -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); diff --git a/src/cmd/5g/gg.h b/src/cmd/5g/gg.h index 7dbf3beecd..99b26075e5 100644 --- a/src/cmd/5g/gg.h +++ b/src/cmd/5g/gg.h @@ -27,6 +27,7 @@ struct Addr uchar reg; char pun; uchar etype; + char flag; }; #define A ((Addr*)0) diff --git a/src/cmd/5g/gobj.c b/src/cmd/5g/gobj.c index b562ba888b..1e0e96f1d1 100644 --- a/src/cmd/5g/gobj.c +++ b/src/cmd/5g/gobj.c @@ -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); } diff --git a/src/cmd/5g/gsubr.c b/src/cmd/5g/gsubr.c index 61c91b8273..387ebad355 100644 --- a/src/cmd/5g/gsubr.c +++ b/src/cmd/5g/gsubr.c @@ -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 diff --git a/src/cmd/5l/asm.c b/src/cmd/5l/asm.c index df33fbe251..4a4bfe1292 100644 --- a/src/cmd/5l/asm.c +++ b/src/cmd/5l/asm.c @@ -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) diff --git a/src/cmd/5l/l.h b/src/cmd/5l/l.h index b1a48ded89..4abb6f2f50 100644 --- a/src/cmd/5l/l.h +++ b/src/cmd/5l/l.h @@ -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; diff --git a/src/cmd/5l/obj.c b/src/cmd/5l/obj.c index f395925e15..316a9a01b3 100644 --- a/src/cmd/5l/obj.c +++ b/src/cmd/5l/obj.c @@ -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; diff --git a/src/libmach/5obj.c b/src/libmach/5obj.c index e539362b0b..a5827f5599 100644 --- a/src/libmach/5obj.c +++ b/src/libmach/5obj.c @@ -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){