link.h 921 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef _LINK_H
  2. #define _LINK_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include <elf.h>
  7. #define __NEED_size_t
  8. #define __NEED_uint32_t
  9. #include <bits/alltypes.h>
  10. #if UINTPTR_MAX > 0xffffffff
  11. #define ElfW(type) Elf64_ ## type
  12. #else
  13. #define ElfW(type) Elf32_ ## type
  14. #endif
  15. #include <bits/link.h>
  16. struct dl_phdr_info {
  17. ElfW(Addr) dlpi_addr;
  18. const char *dlpi_name;
  19. const ElfW(Phdr) *dlpi_phdr;
  20. ElfW(Half) dlpi_phnum;
  21. unsigned long long int dlpi_adds;
  22. unsigned long long int dlpi_subs;
  23. size_t dlpi_tls_modid;
  24. void *dlpi_tls_data;
  25. };
  26. struct link_map {
  27. ElfW(Addr) l_addr;
  28. char *l_name;
  29. ElfW(Dyn) *l_ld;
  30. struct link_map *l_next, *l_prev;
  31. };
  32. struct r_debug {
  33. int r_version;
  34. struct link_map *r_map;
  35. ElfW(Addr) r_brk;
  36. enum { RT_CONSISTENT, RT_ADD, RT_DELETE } r_state;
  37. ElfW(Addr) r_ldbase;
  38. };
  39. int dl_iterate_phdr(int (*)(struct dl_phdr_info *, size_t, void *), void *);
  40. #ifdef __cplusplus
  41. }
  42. #endif
  43. #endif