code: 9ferno

ref: e81c54ba2ecc673a4d5f8aed0e9b52841fe07b0d
dir: /include/dynld.h/

View raw version
/* uncomment these lines when installed in /sys/include */
/*
#pragma src "/usr/inferno/libdynld"
#pragma	lib	"libdynld.a"
*/

typedef struct Dynobj Dynobj;
typedef struct Dynsym Dynsym;

struct Dynobj
{
	ulong	size;		/* total size in bytes */
	ulong	text;		/* bytes of text */
	ulong	data;		/* bytes of data */
	ulong	bss;		/* bytes of bss */
	uchar*	base;	/* start of text, data, bss */
	int	nexport;
	Dynsym*	export;	/* export table */
	int	nimport;
	Dynsym**	import;	/* import table */
};

/*
 * this structure is known to the linkers
 */
struct Dynsym
{
	ulong	sig;
	ulong	addr;
	char	*name;
};

extern Dynsym*	dynfindsym(char*, Dynsym*, int);
extern void	dynfreeimport(Dynobj*);
extern void*	dynimport(Dynobj*, char*, ulong);
extern int	dynloadable(void*, long (*r)(void*,void*,long), vlong(*sk)(void*,vlong,int));
extern Dynobj*	dynloadfd(int, Dynsym*, int, ulong);
extern Dynobj*	dynloadgen(void*, long (*r)(void*,void*,long), vlong (*s)(void*,vlong,int), void (*e)(char*), Dynsym*, int, ulong);
extern long	dynmagic(void);
extern void	dynobjfree(Dynobj*);
extern char*	dynreloc(uchar*, uintptr, int, Dynsym**, int);
extern int	dyntabsize(Dynsym*);

extern Dynsym	_exporttab[];	/* created by linker -x (when desired) */