diff options
author | Russ Cox <rsc@golang.org> | 2010-10-13 15:51:21 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2010-10-13 15:51:21 -0400 |
commit | 62f10a8d5240975bc8b0ed0ac90ac58ced58f9fa (patch) | |
tree | fabbd56a68cf84c43a2e648058b03145e487c857 /src/cmd/6l/l.h | |
parent | 5c2d5da9038182e328a81cc15068a5b938931526 (diff) | |
download | go-62f10a8d5240975bc8b0ed0ac90ac58ced58f9fa.tar.gz |
5l, 6l, 8l: first pass cleanup
* Maintain Sym* list for text with individual
prog lists instead of using one huge list and
overloading p->pcond.
* Comment what each file is for.
* Move some output code from span.c to asm.c.
* Move profiling into prof.c, symbol table into symtab.c.
* Move mkfwd to ld/lib.c.
* Throw away dhog dynamic loading code.
* Throw away Alef become.
* Fix printing of WORD instructions in 5l -a.
Goal here is to be able to handle each piece of text or data
as a separate piece, both to make it easier to load the
occasional .o file and also to make it possible to split the
work across multiple threads.
R=ken2, r, ken3
CC=golang-dev
http://codereview.appspot.com/2335043
Diffstat (limited to 'src/cmd/6l/l.h')
-rw-r--r-- | src/cmd/6l/l.h | 64 |
1 files changed, 18 insertions, 46 deletions
diff --git a/src/cmd/6l/l.h b/src/cmd/6l/l.h index b8f47fc00..d8aa25eb9 100644 --- a/src/cmd/6l/l.h +++ b/src/cmd/6l/l.h @@ -44,7 +44,7 @@ enum #define P ((Prog*)0) #define S ((Sym*)0) -#define TNAME (curtext?curtext->from.sym->name:noname) +#define TNAME (cursym?cursym->name:noname) #define cput(c)\ { *cbp++ = c;\ if(--cbc <= 0)\ @@ -67,11 +67,7 @@ struct Adr Ieee u0ieee; char *u0sbig; } u0; - union - { - Auto* u1autom; - Sym* u1sym; - } u1; + Sym* sym; short type; char index; char scale; @@ -83,14 +79,11 @@ struct Adr #define ieee u0.u0ieee #define sbig u0.u0sbig -#define autom u1.u1autom -#define sym u1.u1sym - struct Prog { Adr from; Adr to; - Prog *forwd; + Prog* forwd; Prog* link; Prog* dlink; Prog* pcond; /* work on this */ @@ -116,25 +109,28 @@ struct Auto }; struct Sym { - char *name; + char* name; short type; short version; - short become; - short frame; - uchar subtype; uchar dupok; uchar reachable; uchar dynexport; + int32 sig; + Sym* hash; // in hash table + Sym* next; // in text or data list vlong value; vlong size; - int32 sig; - Sym* link; - Prog* text; - Prog* data; Sym* gotype; char* file; char* dynimpname; char* dynimplib; + + // STEXT + Auto* autom; + Prog* text; + + // SDATA, SBSS + Prog* data; }; struct Optab { @@ -164,9 +160,6 @@ enum SCONST, SUNDEF, - SIMPORT, - SEXPORT, - SMACHO, SFIXED, SELFDATA, @@ -276,8 +269,6 @@ enum Rxx = 1<<1, /* extend sib index */ Rxb = 1<<0, /* extend modrm r/m, sib base, or opcode reg */ - Roffset = 22, /* no. bits for offset in relocation address */ - Rindex = 10, /* no. bits for index in relocation address */ Maxand = 10, /* in -a output width of the byte codes */ }; @@ -314,15 +305,15 @@ EXTERN char* pcstr; EXTERN Auto* curauto; EXTERN Auto* curhist; EXTERN Prog* curp; -EXTERN Prog* curtext; +EXTERN Sym* cursym; EXTERN Prog* datap; EXTERN Prog* edatap; EXTERN vlong datsize; EXTERN vlong elfdatsize; EXTERN char debug[128]; EXTERN char literal[32]; -EXTERN Prog* etextp; -EXTERN Prog* firstp; +EXTERN Sym* textp; +EXTERN Sym* etextp; EXTERN int xrefresolv; EXTERN char ycover[Ymax*Ymax]; EXTERN uchar* andptr; @@ -330,7 +321,6 @@ EXTERN uchar* rexptr; EXTERN uchar and[30]; EXTERN int reg[D_NONE]; EXTERN int regrex[D_NONE+1]; -EXTERN Prog* lastp; EXTERN int32 lcsize; EXTERN int nerrors; EXTERN char* noname; @@ -340,7 +330,6 @@ EXTERN char* rpath; EXTERN int32 spsize; EXTERN Sym* symlist; EXTERN int32 symsize; -EXTERN Prog* textp; EXTERN vlong textsize; EXTERN int tlsoffset; EXTERN int version; @@ -350,13 +339,6 @@ EXTERN char* paramspace; EXTERN Sym* adrgotype; // type symbol on last Adr read EXTERN Sym* fromgotype; // type symbol on last p->from read -EXTERN Adr* reloca; -EXTERN int doexp; // export table -EXTERN int dlm; // dynamically loadable module -EXTERN int imports, nimports; -EXTERN int exports, nexports; -EXTERN char* EXPTAB; -EXTERN Prog undefp; EXTERN vlong textstksiz; EXTERN vlong textarg; extern char thechar; @@ -365,8 +347,6 @@ EXTERN int elfstrsize; EXTERN char* elfstrdat; EXTERN int elftextsh; -#define UP (&undefp) - extern Optab optab[]; extern Optab* opindex[]; extern char* anames[]; @@ -387,8 +367,6 @@ vlong addsize(Sym*, Sym*); void asmb(void); void asmdyn(void); void asmins(Prog*); -void asmlc(void); -void asmsp(void); void asmsym(void); void asmelfsym(void); vlong atolwhex(char*); @@ -396,7 +374,6 @@ Prog* brchain(Prog*); Prog* brloop(Prog*); void buildop(void); void cflush(void); -void ckoff(Sym*, int32); Prog* copyp(Prog*); vlong cpos(void); double cputime(void); @@ -411,19 +388,16 @@ void domacho(void); void doprof1(void); void doprof2(void); void dostkoff(void); -void dynreloc(Sym*, uint32, int); vlong entryvalue(void); -void export(void); void follow(void); void gethunk(void); void gotypestrings(void); -void import(void); void listinit(void); Sym* lookup(char*, int); void lputb(int32); void lputl(int32); +void instinit(void); void main(int, char*[]); -void mkfwd(void); void* mysbrk(uint32); Prog* newdata(Sym*, int, int, int); Prog* newtext(Prog*, Sym*); @@ -444,8 +418,6 @@ void vputl(uint64); void wputb(uint16); void wputl(uint16); void xdefine(char*, int, vlong); -void xfol(Prog*); -void zaddr(char*, Biobuf*, Adr*, Sym*[]); void machseg(char*, vlong, vlong, vlong, vlong, uint32, uint32, uint32, uint32); void machsymseg(uint32, uint32); |