elfn.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. /*++
  2. Copyright (c) 2016 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. elfn.h
  5. Abstract:
  6. This header contains definitions from "native" type names to 32-bit or
  7. 64-bit ELF definitions, depending on which one is selected.
  8. Author:
  9. Evan Green 8-Apr-2016
  10. --*/
  11. //
  12. // ------------------------------------------------------------------- Includes
  13. //
  14. //
  15. // ---------------------------------------------------------------- Definitions
  16. //
  17. #if defined(WANT_ELF64)
  18. //
  19. // Define macros
  20. //
  21. #define ELF_GET_RELOCATION_SYMBOL ELF64_GET_RELOCATION_SYMBOL
  22. #define ELF_GET_RELOCATION_TYPE ELF64_GET_RELOCATION_TYPE
  23. #define ELF_RELOCATION_INFORMATION ELF64_RELOCATION_INFORMATION
  24. //
  25. // Define other defines
  26. //
  27. #define ELF_WORD_SIZE_SHIFT ELF64_WORD_SIZE_SHIFT
  28. #define ELF_WORD_SIZE_MASK ELF64_WORD_SIZE_MASK
  29. //
  30. // Define integer types
  31. //
  32. #define ELF_ADDR ELF64_ADDR
  33. #define ELF_HALF ELF64_HALF
  34. #define ELF_OFF ELF64_OFF
  35. #define ELF_SWORD ELF64_SWORD
  36. #define ELF_WORD ELF64_SWORD
  37. #define ELF_XWORD ELF64_XWORD
  38. #define ELF_SXWORD ELF64_SXWORD
  39. #define PELF_ADDR PELF64_ADDR
  40. #define PELF_HALF PELF64_HALF
  41. #define PELF_OFF PELF64_OFF
  42. #define PELF_SWORD PELF64_SWORD
  43. #define PELF_WORD PELF64_SWORD
  44. #define PELF_XWORD PELF64_XWORD
  45. #define PELF_SXWORD PELF64_SXWORD
  46. //
  47. // Define structures
  48. //
  49. #define ELF_HEADER ELF64_HEADER
  50. #define ELF_SECTION_HEADER ELF64_SECTION_HEADER
  51. #define ELF_PROGRAM_HEADER ELF64_PROGRAM_HEADER
  52. #define ELF_RELOCATION_ENTRY ELF64_RELOCATION_ENTRY
  53. #define ELF_RELOCATION_ADDEND_ENTRY ELF64_RELOCATION_ADDEND_ENTRY
  54. #define ELF_SYMBOL ELF64_SYMBOL
  55. #define ELF_DYNAMIC_ENTRY ELF64_DYNAMIC_ENTRY
  56. #define PELF_HEADER PELF64_HEADER
  57. #define PELF_SECTION_HEADER PELF64_SECTION_HEADER
  58. #define PELF_PROGRAM_HEADER PELF64_PROGRAM_HEADER
  59. #define PELF_RELOCATION_ENTRY PELF64_RELOCATION_ENTRY
  60. #define PELF_RELOCATION_ADDEND_ENTRY PELF64_RELOCATION_ADDEND_ENTRY
  61. #define PELF_SYMBOL PELF64_SYMBOL
  62. #define PELF_DYNAMIC_ENTRY PELF64_DYNAMIC_ENTRY
  63. //
  64. // Define functions
  65. //
  66. #define ImpElfOpenLibrary ImpElf64OpenLibrary
  67. #define ImpElfGetImageSize ImpElf64GetImageSize
  68. #define ImpElfLoadImage ImpElf64LoadImage
  69. #define ImpElfAddImage ImpElf64AddImage
  70. #define ImpElfUnloadImage ImpElf64UnloadImage
  71. #define ImpElfGetHeader ImpElf64GetHeader
  72. #define ImpElfGetSection ImpElf64GetSection
  73. #define ImpElfLoadAllImports ImpElf64LoadAllImports
  74. #define ImpElfRelocateImages ImpElf64RelocateImages
  75. #define ImpElfRelocateSelf ImpElf64RelocateSelf
  76. #define ImpElfGetSymbolByName ImpElf64GetSymbolByName
  77. #define ImpElfGetSymbolByAddress ImpElf64GetSymbolByAddress
  78. #define ImpElfResolvePltEntry ImpElf64ResolvePltEntry
  79. #else
  80. //
  81. // Define macros
  82. //
  83. #define ELF_GET_RELOCATION_SYMBOL ELF32_GET_RELOCATION_SYMBOL
  84. #define ELF_GET_RELOCATION_TYPE ELF32_GET_RELOCATION_TYPE
  85. #define ELF_RELOCATION_INFORMATION ELF32_RELOCATION_INFORMATION
  86. //
  87. // Define other defines
  88. //
  89. #define ELF_WORD_SIZE_SHIFT ELF32_WORD_SIZE_SHIFT
  90. #define ELF_WORD_SIZE_MASK ELF32_WORD_SIZE_MASK
  91. //
  92. // Define integer types
  93. //
  94. #define ELF_ADDR ELF32_ADDR
  95. #define ELF_HALF ELF32_HALF
  96. #define ELF_OFF ELF32_OFF
  97. #define ELF_SWORD ELF32_SWORD
  98. #define ELF_WORD ELF32_SWORD
  99. #define ELF_XWORD ELF32_WORD
  100. #define ELF_SXWORD ELF32_SWORD
  101. #define PELF_ADDR PELF32_ADDR
  102. #define PELF_HALF PELF32_HALF
  103. #define PELF_OFF PELF32_OFF
  104. #define PELF_SWORD PELF32_SWORD
  105. #define PELF_WORD PELF32_SWORD
  106. #define PELF_XWORD PELF32_WORD
  107. #define PELF_SXWORD PELF32_SWORD
  108. //
  109. // Define structures
  110. //
  111. #define ELF_HEADER ELF32_HEADER
  112. #define ELF_SECTION_HEADER ELF32_SECTION_HEADER
  113. #define ELF_PROGRAM_HEADER ELF32_PROGRAM_HEADER
  114. #define ELF_RELOCATION_ENTRY ELF32_RELOCATION_ENTRY
  115. #define ELF_RELOCATION_ADDEND_ENTRY ELF32_RELOCATION_ADDEND_ENTRY
  116. #define ELF_SYMBOL ELF32_SYMBOL
  117. #define ELF_DYNAMIC_ENTRY ELF32_DYNAMIC_ENTRY
  118. #define PELF_HEADER PELF32_HEADER
  119. #define PELF_SECTION_HEADER PELF32_SECTION_HEADER
  120. #define PELF_PROGRAM_HEADER PELF32_PROGRAM_HEADER
  121. #define PELF_RELOCATION_ENTRY PELF32_RELOCATION_ENTRY
  122. #define PELF_RELOCATION_ADDEND_ENTRY PELF32_RELOCATION_ADDEND_ENTRY
  123. #define PELF_SYMBOL PELF32_SYMBOL
  124. #define PELF_DYNAMIC_ENTRY PELF32_DYNAMIC_ENTRY
  125. //
  126. // Define functions
  127. //
  128. #define ImpElfOpenLibrary ImpElf32OpenLibrary
  129. #define ImpElfGetImageSize ImpElf32GetImageSize
  130. #define ImpElfLoadImage ImpElf32LoadImage
  131. #define ImpElfAddImage ImpElf32AddImage
  132. #define ImpElfUnloadImage ImpElf32UnloadImage
  133. #define ImpElfGetHeader ImpElf32GetHeader
  134. #define ImpElfGetSection ImpElf32GetSection
  135. #define ImpElfLoadAllImports ImpElf32LoadAllImports
  136. #define ImpElfRelocateImages ImpElf32RelocateImages
  137. #define ImpElfRelocateSelf ImpElf32RelocateSelf
  138. #define ImpElfGetSymbolByName ImpElf32GetSymbolByName
  139. #define ImpElfGetSymbolByAddress ImpElf32GetSymbolByAddress
  140. #define ImpElfResolvePltEntry ImpElf32ResolvePltEntry
  141. #endif
  142. //
  143. // ------------------------------------------------------ Data Type Definitions
  144. //
  145. //
  146. // -------------------------------------------------------------------- Globals
  147. //
  148. //
  149. // -------------------------------------------------------- Function Prototypes
  150. //