elf_file_i.h 985 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. Elf32_Word size;
  16. size_t rel_count;
  17. Elf32_Off rel_offset;
  18. } ELFSection;
  19. DICT_DEF2(ELFSectionDict, const char*, M_CSTR_OPLIST, ELFSection, M_POD_OPLIST)
  20. struct ELFFile {
  21. size_t sections_count;
  22. off_t section_table;
  23. off_t section_table_strings;
  24. size_t symbol_count;
  25. off_t symbol_table;
  26. off_t symbol_table_strings;
  27. off_t entry;
  28. ELFSectionDict_t sections;
  29. AddressCache_t relocation_cache;
  30. AddressCache_t trampoline_cache;
  31. File* fd;
  32. const ElfApiInterface* api_interface;
  33. ELFDebugLinkInfo debug_link_info;
  34. ELFSection* preinit_array;
  35. ELFSection* init_array;
  36. ELFSection* fini_array;
  37. };
  38. #ifdef __cplusplus
  39. }
  40. #endif