2 * 7obj.c - identify and parse an alpha object file
11 typedef struct Addr Addr;
18 static Addr addr(Biobuf*);
19 static char type2char(int);
20 static void skip(Biobuf*, int);
25 return s[0] == ANAME /* ANAME */
26 && s[1] == D_FILE /* type */
27 && s[2] == 1 /* sym */
28 && s[3] == '<'; /* name of file */
32 _read7(Biobuf *bp, Prog *p)
37 as = Bgetc(bp); /* as */
42 if(as == ANAME || as == ASIGNAME){
44 Bread(bp, &p->sig, 4);
45 p->sig = leswal(p->sig);
48 p->type = type2char(Bgetc(bp)); /* type */
49 p->sym = Bgetc(bp); /* sym */
63 if(Bread(bp, p->id, n) != n)
71 skip(bp, 5); /* reg(1), lineno(4) */
74 if(a.type != D_OREG || a.name != D_STATIC && a.name != D_EXTERN)
86 a.type = Bgetc(bp); /* a.type */
88 a.sym = Bgetc(bp); /* sym index */
89 a.name = Bgetc(bp); /* sym type */
92 case D_NONE: case D_REG: case D_FREG: case D_PREG:
93 case D_FCREG: case D_PCC:
98 off = (uvlong)Bgetc(bp);
99 off |= (uvlong)Bgetc(bp) << 8;
100 off |= (uvlong)Bgetc(bp) << 16;
101 off |= (uvlong)Bgetc(bp) << 24;
102 off |= (uvlong)Bgetc(bp) << 32;
103 off |= (uvlong)Bgetc(bp) << 40;
104 off |= (uvlong)Bgetc(bp) << 48;
105 off |= (uvlong)Bgetc(bp) << 56;
108 if(a.sym && (a.name==D_PARAM || a.name==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)