2 * uobj.c - identify and parse a sparc64 object file
11 typedef struct Addr Addr;
18 static Addr addr(Biobuf*);
19 static char type2char(int);
20 static void skip(Biobuf*, int);
26 return s[0] == ANAME /* ANAME */
27 && s[1] == D_FILE /* type */
28 && s[2] == 1 /* sym */
29 && s[3] == '<'; /* name of file */
34 _readu(Biobuf *bp, Prog *p)
39 as = Bgetc(bp); /* as */
44 if(as == ANAME || as == ASIGNAME){
46 Bread(bp, &p->sig, 4);
47 p->sig = beswal(p->sig);
50 p->type = type2char(Bgetc(bp)); /* type */
51 p->sym = Bgetc(bp); /* sym */
65 if(Bread(bp, p->id, n) != n)
73 skip(bp, 5); /* reg (1 byte); lineno (4 bytes) */
76 if(a.type != D_OREG || a.name != D_STATIC && a.name != D_EXTERN)
88 a.type = Bgetc(bp); /* a.type */
89 skip(bp, 1); /* reg */
90 a.sym = Bgetc(bp); /* sym index */
91 a.name = Bgetc(bp); /* sym type */
94 case D_NONE: case D_REG: case D_FREG: case D_CREG: case D_PREG:
101 off |= Bgetc(bp) << 8;
102 off |= Bgetc(bp) << 16;
103 off |= Bgetc(bp) << 24;
106 if(a.sym!=0 && (a.name==D_PARAM || a.name==D_AUTO))
124 case D_EXTERN: return 'U';
125 case D_STATIC: return 'b';
126 case D_AUTO: return 'a';
127 case D_PARAM: return 'p';
128 default: return UNKNOWN;
133 skip(Biobuf *bp, int n)