elf_file_i.h 874 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #pragma once
  2. #include "elf_file.h"
  3. #include <m-dict.h>
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. DICT_DEF2(AddressCache, int, M_DEFAULT_OPLIST, Elf32_Addr, M_DEFAULT_OPLIST)
  8. /**
  9. * Callable elf entry type
  10. */
  11. typedef int32_t(entry_t)(void*);
  12. typedef struct {
  13. void* data;
  14. uint16_t sec_idx;
  15. uint16_t rel_sec_idx;
  16. Elf32_Word size;
  17. } ELFSection;
  18. DICT_DEF2(ELFSectionDict, const char*, M_CSTR_OPLIST, ELFSection, M_POD_OPLIST)
  19. struct ELFFile {
  20. size_t sections_count;
  21. off_t section_table;
  22. off_t section_table_strings;
  23. size_t symbol_count;
  24. off_t symbol_table;
  25. off_t symbol_table_strings;
  26. off_t entry;
  27. ELFSectionDict_t sections;
  28. AddressCache_t relocation_cache;
  29. AddressCache_t trampoline_cache;
  30. File* fd;
  31. const ElfApiInterface* api_interface;
  32. ELFDebugLinkInfo debug_link_info;
  33. };
  34. #ifdef __cplusplus
  35. }
  36. #endif