2 * 6obj.c - identify and parse an amd64 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 _read6(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))
96 a.flags = Bgetc(bp); /* flags */
99 if(a.flags & T_OFFSET){
102 l |= Bgetc(bp) << 16;
103 l |= Bgetc(bp) << 24;
108 l |= Bgetc(bp) << 16;
109 l |= Bgetc(bp) << 24;
110 off = ((vlong)l << 32) | (off & 0xFFFFFFFF);
117 if(a.flags & T_FCONST)
120 if(a.flags & T_SCONST)
122 if(a.flags & T_TYPE) {
124 if(a.sym > 0 && (t==D_PARAM || t==D_AUTO))
134 case D_EXTERN: return 'U';
135 case D_STATIC: return 'b';
136 case D_AUTO: return 'a';
137 case D_PARAM: return 'p';
138 default: return UNKNOWN;
143 skip(Biobuf *bp, int n)