shithub: scc

ref: a4f55bc2a984f51aa2afef82f7f6257dece7a09d
dir: /src/libmach/libmach.h/

View raw version
#define NBYTES 20
#define OBJ(format,arch,order) ((order) << 10 | (arch) << 5 | (format)) 
#define FORMAT(t) ((t) & 0x1f)
#define ARCH(t) (((t) >> 5) & 0x1f)
#define ORDER(t) (((t) >> 10) & 0x1f)

enum objformat {
	COFF16,
	COFF32,
	ELF32,
	ELF64,
	NFORMATS,
};

enum objarch {
	ARCH286,
	ARCH386,
	ARCHAMD64,
	ARCHZ80,
	ARCHARM32,
	ARCHARM64,
};

enum order {
	LITTLE_ENDIAN,
	BIG_ENDIAN,
};

extern int pack(int order, unsigned char *dst, char *fmt, ...);
extern int unpack(int order, unsigned char *src, char *fmt, ...);

/* coff32.c */
int coff32probe(unsigned char *buf, char **name);
int coff32open(FILE *fp, int type, Obj *obj);
int coff32read(Obj *obj, Symbol *sym);
void coff32close(Obj *obj);