diff options
Diffstat (limited to 'src/cmd/6l')
-rw-r--r-- | src/cmd/6l/asm.c | 44 | ||||
-rw-r--r-- | src/cmd/6l/l.h | 25 | ||||
-rw-r--r-- | src/cmd/6l/obj.c | 18 | ||||
-rw-r--r-- | src/cmd/6l/pass.c | 9 |
4 files changed, 41 insertions, 55 deletions
diff --git a/src/cmd/6l/asm.c b/src/cmd/6l/asm.c index fb041d83a..ba2074fde 100644 --- a/src/cmd/6l/asm.c +++ b/src/cmd/6l/asm.c @@ -1101,32 +1101,34 @@ genasmsym(void (*put)(Sym*, char*, int, vlong, vlong, int, Sym*)) { Auto *a; Sym *s; - int h; - for(h=0; h<NHASH; h++) { - for(s=hash[h]; s!=S; s=s->hash) { - switch(s->type&~SSUB) { - case SCONST: - case SRODATA: - case SDATA: - case SELFDATA: - case SMACHOGOT: - case SWINDOWS: - if(!s->reachable) - continue; - put(s, s->name, 'D', symaddr(s), s->size, s->version, s->gotype); + for(s=allsym; s!=S; s=s->allsym) { + if(s->hide) + continue; + switch(s->type&~SSUB) { + case SCONST: + case SRODATA: + case SDATA: + case SELFDATA: + case SMACHOGOT: + case STYPE: + case SSTRING: + case SGOSTRING: + case SWINDOWS: + if(!s->reachable) continue; + put(s, s->name, 'D', symaddr(s), s->size, s->version, s->gotype); + continue; - case SBSS: - if(!s->reachable) - continue; - put(s, s->name, 'B', symaddr(s), s->size, s->version, s->gotype); + case SBSS: + if(!s->reachable) continue; + put(s, s->name, 'B', symaddr(s), s->size, s->version, s->gotype); + continue; - case SFILE: - put(nil, s->name, 'f', s->value, 0, s->version, 0); - continue; - } + case SFILE: + put(nil, s->name, 'f', s->value, 0, s->version, 0); + continue; } } diff --git a/src/cmd/6l/l.h b/src/cmd/6l/l.h index 6933d8eb1..4fc13b94a 100644 --- a/src/cmd/6l/l.h +++ b/src/cmd/6l/l.h @@ -132,11 +132,13 @@ struct Sym uchar dynexport; uchar special; uchar stkcheck; + uchar hide; int32 dynid; int32 sig; int32 plt; int32 got; Sym* hash; // in hash table + Sym* allsym; // in all symbol list Sym* next; // in text or data list Sym* sub; // in SSUB list Sym* outer; // container of sub @@ -177,29 +179,6 @@ struct Movtab enum { - Sxxx, - - /* order here is order in output file */ - STEXT = 1, - SELFDATA, - SMACHOPLT, - SRODATA, - SDATA, - SMACHOGOT, - SWINDOWS, - SBSS, - - SXREF, - SMACHODYNSTR, - SMACHODYNSYM, - SMACHOINDIRECTPLT, - SMACHOINDIRECTGOT, - SFILE, - SCONST, - SDYNIMPORT, - SSUB = 1<<8, - - NHASH = 10007, MINSIZ = 8, STRINGSZ = 200, MINLC = 1, diff --git a/src/cmd/6l/obj.c b/src/cmd/6l/obj.c index f113e3ec1..6b43d2df4 100644 --- a/src/cmd/6l/obj.c +++ b/src/cmd/6l/obj.c @@ -287,7 +287,7 @@ zsym(char *pn, Biobuf *f, Sym *h[]) { int o; - o = Bgetc(f); + o = BGETC(f); if(o < 0 || o >= NSYM || h[o] == nil) mangle(pn); return h[o]; @@ -301,12 +301,12 @@ zaddr(char *pn, Biobuf *f, Adr *a, Sym *h[]) Sym *s; Auto *u; - t = Bgetc(f); + t = BGETC(f); a->index = D_NONE; a->scale = 0; if(t & T_INDEX) { - a->index = Bgetc(f); - a->scale = Bgetc(f); + a->index = BGETC(f); + a->scale = BGETC(f); } a->offset = 0; if(t & T_OFFSET) { @@ -330,7 +330,7 @@ zaddr(char *pn, Biobuf *f, Adr *a, Sym *h[]) a->type = D_SCONST; } if(t & T_TYPE) - a->type = Bgetc(f); + a->type = BGETC(f); if(a->type < 0 || a->type >= D_SIZE) mangle(pn); adrgotype = S; @@ -405,10 +405,10 @@ newloop: loop: if(f->state == Bracteof || Boffset(f) >= eof) goto eof; - o = Bgetc(f); + o = BGETC(f); if(o == Beof) goto eof; - o |= Bgetc(f) << 8; + o |= BGETC(f) << 8; if(o <= AXXX || o >= ALAST) { if(o < 0) goto eof; @@ -421,8 +421,8 @@ loop: sig = 0; if(o == ASIGNAME) sig = Bget4(f); - v = Bgetc(f); /* type */ - o = Bgetc(f); /* sym */ + v = BGETC(f); /* type */ + o = BGETC(f); /* sym */ r = 0; if(v == D_STATIC) r = version; diff --git a/src/cmd/6l/pass.c b/src/cmd/6l/pass.c index 8fda94392..0b0ee1253 100644 --- a/src/cmd/6l/pass.c +++ b/src/cmd/6l/pass.c @@ -274,10 +274,10 @@ patch(void) if(HEADTYPE == Hwindows) { // Windows // Convert - // op n(GS), reg + // op n(GS), reg // to // MOVL 0x58(GS), reg - // op n(reg), reg + // op n(reg), reg // The purpose of this patch is to fix some accesses // to extern register variables (TLS) on Windows, as // a different method is used to access them. @@ -674,6 +674,11 @@ dostkoff(void) p->spadj = -autoffset; p = appendp(p); p->as = ARET; + // If there are instructions following + // this ARET, they come from a branch + // with the same stackframe, so undo + // the cleanup. + p->spadj = +autoffset; } } } |