link.h 914 B

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