dynld.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef __DYNLD_H
  2. #define __DYNLD_H
  3. #if !defined(_PLAN9_SOURCE)
  4. This header file is an extension to ANSI/POSIX
  5. #endif
  6. #pragma src "/sys/src/ape/lib/dynld"
  7. #pragma lib "/$M/lib/ape/libdynld.a"
  8. typedef struct Dynobj Dynobj;
  9. typedef struct Dynsym Dynsym;
  10. struct Dynobj
  11. {
  12. unsigned long size; /* total size in bytes */
  13. unsigned long text; /* bytes of text */
  14. unsigned long data; /* bytes of data */
  15. unsigned long bss; /* bytes of bss */
  16. unsigned char* base; /* start of text, data, bss */
  17. int nexport;
  18. Dynsym* export; /* export table */
  19. int nimport;
  20. Dynsym** import; /* import table */
  21. };
  22. /*
  23. * this structure is known to the linkers
  24. */
  25. struct Dynsym
  26. {
  27. unsigned long sig;
  28. unsigned long addr;
  29. char *name;
  30. };
  31. extern Dynsym* dynfindsym(char*, Dynsym*, int);
  32. extern void dynfreeimport(Dynobj*);
  33. extern void* dynimport(Dynobj*, char*, unsigned long);
  34. extern int dynloadable(void*, long (*r)(void*,void*,long), long long(*sk)(void*,long long,int));
  35. extern Dynobj* dynloadfd(int, Dynsym*, int, unsigned long);
  36. extern Dynobj* dynloadgen(void*, long (*r)(void*,void*,long), long long (*s)(void*,long long,int), void (*e)(char*), Dynsym*, int, unsigned long);
  37. extern long dynmagic(void);
  38. extern void dynobjfree(Dynobj*);
  39. extern char* dynreloc(unsigned char*, unsigned long, int, Dynsym**, int);
  40. extern int dyntabsize(Dynsym*);
  41. extern Dynsym _exporttab[]; /* created by linker -x (when desired) */
  42. #endif