scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

libmach.h (1434B)


      1 #define NBYTES 20
      2 #define OBJ(format,arch,order) ((order) << 10 | (arch) << 5 | (format)) 
      3 #define FORMAT(t) ((t) & 0x1f)
      4 #define ARCH(t) (((t) >> 5) & 0x1f)
      5 #define ORDER(t) (((t) >> 10) & 0x1f)
      6 
      7 enum objformat {
      8 	COFF32,
      9 	NFORMATS,
     10 };
     11 
     12 enum objarch {
     13 	ARCH286,
     14 	ARCH386,
     15 	ARCHAMD64,
     16 	ARCHZ80,
     17 	ARCHARM32,
     18 	ARCHARM64,
     19 };
     20 
     21 enum order {
     22 	LITTLE_ENDIAN,
     23 	BIG_ENDIAN,
     24 };
     25 
     26 enum deltype {
     27 	GENERICDEL = 1 << 0,
     28 	TARGETDEL  = 1 << 1,
     29 };
     30 
     31 /* common functions */
     32 extern int pack(int order, unsigned char *dst, char *fmt, ...);
     33 extern int unpack(int order, unsigned char *src, char *fmt, ...);
     34 extern int objpos(Obj *obj, FILE *fp, long pos);
     35 extern int objfree(Obj *obj, int what);
     36 
     37 /* coff32 functions */
     38 extern long coff32index(int type, long nsyms, Objsymdef *head, FILE *fp);
     39 extern int coff32new(Obj *obj);
     40 extern void coff32del(Obj *obj);
     41 extern int coff32read(Obj *obj, FILE *fp);
     42 extern int coff32write(Obj *obj, FILE *fp);
     43 extern void coff32strip(Obj *obj);
     44 extern int coff32probe(unsigned char *buf, char **name);
     45 
     46 extern long coff32setindex(int type, long nsymbols, Objsymdef *head, FILE *fp);
     47 extern long coff32setidx(int order, long nsyms, Objsymdef *head, FILE *fp);
     48 
     49 extern int coff32getindex(int type, long *nsyms, Objsymdef **def, FILE *fp);
     50 extern int coff32getidx(int order, long *nsyms, Objsymdef **def, FILE *fp);
     51 
     52 extern int coff32getsect(Obj *obj);
     53 
     54 extern char *coff32namidx(void);
     55 extern int coff32getsyms(Obj *obj);