scc

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

libmach.h (1975B)


      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 typedef int (*newfun_t)(Obj *obj);
     32 typedef int (*readfun_t)(Obj *obj, FILE *fp);
     33 typedef void (*delfun_t)(Obj *new);
     34 typedef void (*stripfun_t)(Obj *obj);
     35 typedef int (*probefun_t)(unsigned char *buf, char **name);
     36 typedef int (*writefun_t)(Obj *obj, FILE *fp);
     37 typedef long (*setidxfun_t)(int, long, Objsymdef *, FILE *);
     38 typedef int (*getidxfun_t)(int t, long *n, Objsymdef **def, FILE *fp);
     39 typedef int (*getsectfun_t)(Obj *obj, Objsect **secp);
     40 typedef char *(*namidxfun_t)(void);
     41 typedef int (*getsymsfun_t)(Obj *obj);
     42 
     43 /* common functions */
     44 extern int pack(int order, unsigned char *dst, char *fmt, ...);
     45 extern int unpack(int order, unsigned char *src, char *fmt, ...);
     46 extern int objpos(Obj *obj, FILE *fp, long pos);
     47 extern int objfree(Obj *obj, int what);
     48 
     49 /* coff32 functions */
     50 extern long coff32index(int type, long nsyms, Objsymdef *head, FILE *fp);
     51 extern int coff32new(Obj *obj);
     52 extern void coff32del(Obj *obj);
     53 extern int coff32read(Obj *obj, FILE *fp);
     54 extern int coff32write(Obj *obj, FILE *fp);
     55 extern void coff32strip(Obj *obj);
     56 extern int coff32probe(unsigned char *buf, char **name);
     57 
     58 extern long coff32setindex(int type, long nsymbols, Objsymdef *head, FILE *fp);
     59 extern long coff32setidx(int order, long nsyms, Objsymdef *head, FILE *fp);
     60 
     61 extern int coff32getindex(int type, long *nsyms, Objsymdef **def, FILE *fp);
     62 extern int coff32getidx(int order, long *nsyms, Objsymdef **def, FILE *fp);
     63 
     64 extern int coff32getsect(Obj *obj, Objsect **secp);
     65 
     66 extern char *coff32namidx(void);
     67 extern int coff32getsyms(Obj *obj);