1
0

dynld.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #pragma src "/sys/src/libdynld"
  2. #pragma lib "libdynld.a"
  3. typedef struct Dynobj Dynobj;
  4. typedef struct Dynsym Dynsym;
  5. struct Dynobj
  6. {
  7. ulong size; /* total size in bytes */
  8. ulong text; /* bytes of text */
  9. ulong data; /* bytes of data */
  10. ulong bss; /* bytes of bss */
  11. uchar* base; /* start of text, data, bss */
  12. int nexport;
  13. Dynsym* export; /* export table */
  14. int nimport;
  15. Dynsym** import; /* import table */
  16. };
  17. /*
  18. * this structure is known to the linkers
  19. */
  20. struct Dynsym
  21. {
  22. ulong sig;
  23. ulong addr;
  24. char *name;
  25. };
  26. extern Dynsym* dynfindsym(char*, Dynsym*, int);
  27. extern void dynfreeimport(Dynobj*);
  28. extern void* dynimport(Dynobj*, char*, ulong);
  29. extern int dynloadable(void*, long (*r)(void*,void*,long), vlong(*sk)(void*,vlong,int));
  30. extern Dynobj* dynloadfd(int, Dynsym*, int, ulong);
  31. extern Dynobj* dynloadgen(void*, long (*r)(void*,void*,long), vlong (*s)(void*,vlong,int), void (*e)(char*), Dynsym*, int, ulong);
  32. extern long dynmagic(void);
  33. extern void dynobjfree(Dynobj*);
  34. extern char* dynreloc(uchar*, ulong, int, Dynsym**, int);
  35. extern int dyntabsize(Dynsym*);
  36. extern Dynsym _exporttab[]; /* created by linker -x (when desired) */