2 * 8obj.c - identify and parse a 386 object file
11 typedef struct Addr Addr;
17 static Addr addr(Biobuf*);
18 static char type2char(int);
19 static void skip(Biobuf*, int);
26 return s[0] == (ANAME&0xff) /* aslo = ANAME */
27 && s[1] == ((ANAME>>8)&0xff)
28 && s[2] == D_FILE /* type */
29 && s[3] == 1 /* sym */
30 && s[4] == '<'; /* name of file */
34 _read8(Biobuf *bp, Prog* p)
39 as = Bgetc(bp); /* as(low) */
42 c = Bgetc(bp); /* as(high) */
45 as |= ((c & 0xff) << 8);
48 if(as == ANAME || as == ASIGNAME){
50 Bread(bp, &p->sig, 4);
51 p->sig = leswal(p->sig);
54 p->type = type2char(Bgetc(bp)); /* type */
55 p->sym = Bgetc(bp); /* sym */
69 if(Bread(bp, p->id, n) != n)
77 skip(bp, 4); /* lineno(4) */
80 if(!(a.flags & T_SYM))
95 a.flags = Bgetc(bp); /* flags */
98 if(a.flags & T_OFFSET){
100 off |= Bgetc(bp) << 8;
101 off |= Bgetc(bp) << 16;
102 off |= Bgetc(bp) << 24;
108 if(a.flags & T_FCONST)
111 if(a.flags & T_SCONST)
113 if(a.flags & T_TYPE) {
115 if(a.sym > 0 && (t==D_PARAM || t==D_AUTO))
125 case D_EXTERN: return 'U';
126 case D_STATIC: return 'b';
127 case D_AUTO: return 'a';
128 case D_PARAM: return 'p';
129 default: return UNKNOWN;
134 skip(Biobuf *bp, int n)