pe.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  1. /*
  2. * Copyright 2011 Red Hat, Inc.
  3. * All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; version 2 of the License.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. *
  17. * Author(s): Peter Jones <pjones@redhat.com>
  18. */
  19. #ifndef __LINUX_PE_H
  20. #define __LINUX_PE_H
  21. #include <linux/types.h>
  22. #define MZ_MAGIC 0x5a4d /* "MZ" */
  23. struct mz_hdr {
  24. uint16_t magic; /* MZ_MAGIC */
  25. uint16_t lbsize; /* size of last used block */
  26. uint16_t blocks; /* pages in file, 0x3 */
  27. uint16_t relocs; /* relocations */
  28. uint16_t hdrsize; /* header size in "paragraphs" */
  29. uint16_t min_extra_pps; /* .bss */
  30. uint16_t max_extra_pps; /* runtime limit for the arena size */
  31. uint16_t ss; /* relative stack segment */
  32. uint16_t sp; /* initial %sp register */
  33. uint16_t checksum; /* word checksum */
  34. uint16_t ip; /* initial %ip register */
  35. uint16_t cs; /* initial %cs relative to load segment */
  36. uint16_t reloc_table_offset; /* offset of the first relocation */
  37. uint16_t overlay_num; /* overlay number. set to 0. */
  38. uint16_t reserved0[4]; /* reserved */
  39. uint16_t oem_id; /* oem identifier */
  40. uint16_t oem_info; /* oem specific */
  41. uint16_t reserved1[10]; /* reserved */
  42. uint32_t peaddr; /* address of pe header */
  43. char message[64]; /* message to print */
  44. };
  45. struct mz_reloc {
  46. uint16_t offset;
  47. uint16_t segment;
  48. };
  49. #define PE_MAGIC 0x00004550 /* "PE\0\0" */
  50. #define PE_OPT_MAGIC_PE32 0x010b
  51. #define PE_OPT_MAGIC_PE32_ROM 0x0107
  52. #define PE_OPT_MAGIC_PE32PLUS 0x020b
  53. /* machine type */
  54. #define IMAGE_FILE_MACHINE_UNKNOWN 0x0000
  55. #define IMAGE_FILE_MACHINE_AM33 0x01d3
  56. #define IMAGE_FILE_MACHINE_AMD64 0x8664
  57. #define IMAGE_FILE_MACHINE_ARM 0x01c0
  58. #define IMAGE_FILE_MACHINE_ARMV7 0x01c4
  59. #define IMAGE_FILE_MACHINE_EBC 0x0ebc
  60. #define IMAGE_FILE_MACHINE_I386 0x014c
  61. #define IMAGE_FILE_MACHINE_IA64 0x0200
  62. #define IMAGE_FILE_MACHINE_M32R 0x9041
  63. #define IMAGE_FILE_MACHINE_MIPS16 0x0266
  64. #define IMAGE_FILE_MACHINE_MIPSFPU 0x0366
  65. #define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466
  66. #define IMAGE_FILE_MACHINE_POWERPC 0x01f0
  67. #define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1
  68. #define IMAGE_FILE_MACHINE_R4000 0x0166
  69. #define IMAGE_FILE_MACHINE_SH3 0x01a2
  70. #define IMAGE_FILE_MACHINE_SH3DSP 0x01a3
  71. #define IMAGE_FILE_MACHINE_SH3E 0x01a4
  72. #define IMAGE_FILE_MACHINE_SH4 0x01a6
  73. #define IMAGE_FILE_MACHINE_SH5 0x01a8
  74. #define IMAGE_FILE_MACHINE_THUMB 0x01c2
  75. #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
  76. /* flags */
  77. #define IMAGE_FILE_RELOCS_STRIPPED 0x0001
  78. #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
  79. #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
  80. #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
  81. #define IMAGE_FILE_AGGRESSIVE_WS_TRIM 0x0010
  82. #define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
  83. #define IMAGE_FILE_16BIT_MACHINE 0x0040
  84. #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
  85. #define IMAGE_FILE_32BIT_MACHINE 0x0100
  86. #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
  87. #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
  88. #define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
  89. #define IMAGE_FILE_SYSTEM 0x1000
  90. #define IMAGE_FILE_DLL 0x2000
  91. #define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
  92. #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
  93. struct pe_hdr {
  94. uint32_t magic; /* PE magic */
  95. uint16_t machine; /* machine type */
  96. uint16_t sections; /* number of sections */
  97. uint32_t timestamp; /* time_t */
  98. uint32_t symbol_table; /* symbol table offset */
  99. uint32_t symbols; /* number of symbols */
  100. uint16_t opt_hdr_size; /* size of optional header */
  101. uint16_t flags; /* flags */
  102. };
  103. #define IMAGE_FILE_OPT_ROM_MAGIC 0x107
  104. #define IMAGE_FILE_OPT_PE32_MAGIC 0x10b
  105. #define IMAGE_FILE_OPT_PE32_PLUS_MAGIC 0x20b
  106. #define IMAGE_SUBSYSTEM_UNKNOWN 0
  107. #define IMAGE_SUBSYSTEM_NATIVE 1
  108. #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2
  109. #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3
  110. #define IMAGE_SUBSYSTEM_POSIX_CUI 7
  111. #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9
  112. #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
  113. #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
  114. #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
  115. #define IMAGE_SUBSYSTEM_EFI_ROM_IMAGE 13
  116. #define IMAGE_SUBSYSTEM_XBOX 14
  117. #define IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE 0x0040
  118. #define IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY 0x0080
  119. #define IMAGE_DLL_CHARACTERISTICS_NX_COMPAT 0x0100
  120. #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
  121. #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
  122. #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
  123. #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
  124. #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
  125. /* the fact that pe32 isn't padded where pe32+ is 64-bit means union won't
  126. * work right. vomit. */
  127. struct pe32_opt_hdr {
  128. /* "standard" header */
  129. uint16_t magic; /* file type */
  130. uint8_t ld_major; /* linker major version */
  131. uint8_t ld_minor; /* linker minor version */
  132. uint32_t text_size; /* size of text section(s) */
  133. uint32_t data_size; /* size of data section(s) */
  134. uint32_t bss_size; /* size of bss section(s) */
  135. uint32_t entry_point; /* file offset of entry point */
  136. uint32_t code_base; /* relative code addr in ram */
  137. uint32_t data_base; /* relative data addr in ram */
  138. /* "windows" header */
  139. uint32_t image_base; /* preferred load address */
  140. uint32_t section_align; /* alignment in bytes */
  141. uint32_t file_align; /* file alignment in bytes */
  142. uint16_t os_major; /* major OS version */
  143. uint16_t os_minor; /* minor OS version */
  144. uint16_t image_major; /* major image version */
  145. uint16_t image_minor; /* minor image version */
  146. uint16_t subsys_major; /* major subsystem version */
  147. uint16_t subsys_minor; /* minor subsystem version */
  148. uint32_t win32_version; /* reserved, must be 0 */
  149. uint32_t image_size; /* image size */
  150. uint32_t header_size; /* header size rounded up to
  151. file_align */
  152. uint32_t csum; /* checksum */
  153. uint16_t subsys; /* subsystem */
  154. uint16_t dll_flags; /* more flags! */
  155. uint32_t stack_size_req;/* amt of stack requested */
  156. uint32_t stack_size; /* amt of stack required */
  157. uint32_t heap_size_req; /* amt of heap requested */
  158. uint32_t heap_size; /* amt of heap required */
  159. uint32_t loader_flags; /* reserved, must be 0 */
  160. uint32_t data_dirs; /* number of data dir entries */
  161. };
  162. struct pe32plus_opt_hdr {
  163. uint16_t magic; /* file type */
  164. uint8_t ld_major; /* linker major version */
  165. uint8_t ld_minor; /* linker minor version */
  166. uint32_t text_size; /* size of text section(s) */
  167. uint32_t data_size; /* size of data section(s) */
  168. uint32_t bss_size; /* size of bss section(s) */
  169. uint32_t entry_point; /* file offset of entry point */
  170. uint32_t code_base; /* relative code addr in ram */
  171. /* "windows" header */
  172. uint64_t image_base; /* preferred load address */
  173. uint32_t section_align; /* alignment in bytes */
  174. uint32_t file_align; /* file alignment in bytes */
  175. uint16_t os_major; /* major OS version */
  176. uint16_t os_minor; /* minor OS version */
  177. uint16_t image_major; /* major image version */
  178. uint16_t image_minor; /* minor image version */
  179. uint16_t subsys_major; /* major subsystem version */
  180. uint16_t subsys_minor; /* minor subsystem version */
  181. uint32_t win32_version; /* reserved, must be 0 */
  182. uint32_t image_size; /* image size */
  183. uint32_t header_size; /* header size rounded up to
  184. file_align */
  185. uint32_t csum; /* checksum */
  186. uint16_t subsys; /* subsystem */
  187. uint16_t dll_flags; /* more flags! */
  188. uint64_t stack_size_req;/* amt of stack requested */
  189. uint64_t stack_size; /* amt of stack required */
  190. uint64_t heap_size_req; /* amt of heap requested */
  191. uint64_t heap_size; /* amt of heap required */
  192. uint32_t loader_flags; /* reserved, must be 0 */
  193. uint32_t data_dirs; /* number of data dir entries */
  194. };
  195. struct data_dirent {
  196. uint32_t virtual_address; /* relative to load address */
  197. uint32_t size;
  198. };
  199. struct data_directory {
  200. struct data_dirent exports; /* .edata */
  201. struct data_dirent imports; /* .idata */
  202. struct data_dirent resources; /* .rsrc */
  203. struct data_dirent exceptions; /* .pdata */
  204. struct data_dirent certs; /* certs */
  205. struct data_dirent base_relocations; /* .reloc */
  206. struct data_dirent debug; /* .debug */
  207. struct data_dirent arch; /* reservered */
  208. struct data_dirent global_ptr; /* global pointer reg. Size=0 */
  209. struct data_dirent tls; /* .tls */
  210. struct data_dirent load_config; /* load configuration structure */
  211. struct data_dirent bound_imports; /* no idea */
  212. struct data_dirent import_addrs; /* import address table */
  213. struct data_dirent delay_imports; /* delay-load import table */
  214. struct data_dirent clr_runtime_hdr; /* .cor (object only) */
  215. struct data_dirent reserved;
  216. };
  217. struct section_header {
  218. char name[8]; /* name or "/12\0" string tbl offset */
  219. uint32_t virtual_size; /* size of loaded section in ram */
  220. uint32_t virtual_address; /* relative virtual address */
  221. uint32_t raw_data_size; /* size of the section */
  222. uint32_t data_addr; /* file pointer to first page of sec */
  223. uint32_t relocs; /* file pointer to relocation entries */
  224. uint32_t line_numbers; /* line numbers! */
  225. uint16_t num_relocs; /* number of relocations */
  226. uint16_t num_lin_numbers; /* srsly. */
  227. uint32_t flags;
  228. };
  229. /* they actually defined 0x00000000 as well, but I think we'll skip that one. */
  230. #define IMAGE_SCN_RESERVED_0 0x00000001
  231. #define IMAGE_SCN_RESERVED_1 0x00000002
  232. #define IMAGE_SCN_RESERVED_2 0x00000004
  233. #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* don't pad - obsolete */
  234. #define IMAGE_SCN_RESERVED_3 0x00000010
  235. #define IMAGE_SCN_CNT_CODE 0x00000020 /* .text */
  236. #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 /* .data */
  237. #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 /* .bss */
  238. #define IMAGE_SCN_LNK_OTHER 0x00000100 /* reserved */
  239. #define IMAGE_SCN_LNK_INFO 0x00000200 /* .drectve comments */
  240. #define IMAGE_SCN_RESERVED_4 0x00000400
  241. #define IMAGE_SCN_LNK_REMOVE 0x00000800 /* .o only - scn to be rm'd*/
  242. #define IMAGE_SCN_LNK_COMDAT 0x00001000 /* .o only - COMDAT data */
  243. #define IMAGE_SCN_RESERVED_5 0x00002000 /* spec omits this */
  244. #define IMAGE_SCN_RESERVED_6 0x00004000 /* spec omits this */
  245. #define IMAGE_SCN_GPREL 0x00008000 /* global pointer referenced data */
  246. /* spec lists 0x20000 twice, I suspect they meant 0x10000 for one of them */
  247. #define IMAGE_SCN_MEM_PURGEABLE 0x00010000 /* reserved for "future" use */
  248. #define IMAGE_SCN_16BIT 0x00020000 /* reserved for "future" use */
  249. #define IMAGE_SCN_LOCKED 0x00040000 /* reserved for "future" use */
  250. #define IMAGE_SCN_PRELOAD 0x00080000 /* reserved for "future" use */
  251. /* and here they just stuck a 1-byte integer in the middle of a bitfield */
  252. #define IMAGE_SCN_ALIGN_1BYTES 0x00100000 /* it does what it says on the box */
  253. #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
  254. #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
  255. #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
  256. #define IMAGE_SCN_ALIGN_16BYTES 0x00500000
  257. #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
  258. #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
  259. #define IMAGE_SCN_ALIGN_128BYTES 0x00800000
  260. #define IMAGE_SCN_ALIGN_256BYTES 0x00900000
  261. #define IMAGE_SCN_ALIGN_512BYTES 0x00a00000
  262. #define IMAGE_SCN_ALIGN_1024BYTES 0x00b00000
  263. #define IMAGE_SCN_ALIGN_2048BYTES 0x00c00000
  264. #define IMAGE_SCN_ALIGN_4096BYTES 0x00d00000
  265. #define IMAGE_SCN_ALIGN_8192BYTES 0x00e00000
  266. #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 /* extended relocations */
  267. #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 /* scn can be discarded */
  268. #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 /* cannot be cached */
  269. #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 /* not pageable */
  270. #define IMAGE_SCN_MEM_SHARED 0x10000000 /* can be shared */
  271. #define IMAGE_SCN_MEM_EXECUTE 0x20000000 /* can be executed as code */
  272. #define IMAGE_SCN_MEM_READ 0x40000000 /* readable */
  273. #define IMAGE_SCN_MEM_WRITE 0x80000000 /* writeable */
  274. enum x64_coff_reloc_type {
  275. IMAGE_REL_AMD64_ABSOLUTE = 0,
  276. IMAGE_REL_AMD64_ADDR64,
  277. IMAGE_REL_AMD64_ADDR32,
  278. IMAGE_REL_AMD64_ADDR32N,
  279. IMAGE_REL_AMD64_REL32,
  280. IMAGE_REL_AMD64_REL32_1,
  281. IMAGE_REL_AMD64_REL32_2,
  282. IMAGE_REL_AMD64_REL32_3,
  283. IMAGE_REL_AMD64_REL32_4,
  284. IMAGE_REL_AMD64_REL32_5,
  285. IMAGE_REL_AMD64_SECTION,
  286. IMAGE_REL_AMD64_SECREL,
  287. IMAGE_REL_AMD64_SECREL7,
  288. IMAGE_REL_AMD64_TOKEN,
  289. IMAGE_REL_AMD64_SREL32,
  290. IMAGE_REL_AMD64_PAIR,
  291. IMAGE_REL_AMD64_SSPAN32,
  292. };
  293. enum arm_coff_reloc_type {
  294. IMAGE_REL_ARM_ABSOLUTE,
  295. IMAGE_REL_ARM_ADDR32,
  296. IMAGE_REL_ARM_ADDR32N,
  297. IMAGE_REL_ARM_BRANCH2,
  298. IMAGE_REL_ARM_BRANCH1,
  299. IMAGE_REL_ARM_SECTION,
  300. IMAGE_REL_ARM_SECREL,
  301. };
  302. enum sh_coff_reloc_type {
  303. IMAGE_REL_SH3_ABSOLUTE,
  304. IMAGE_REL_SH3_DIRECT16,
  305. IMAGE_REL_SH3_DIRECT32,
  306. IMAGE_REL_SH3_DIRECT8,
  307. IMAGE_REL_SH3_DIRECT8_WORD,
  308. IMAGE_REL_SH3_DIRECT8_LONG,
  309. IMAGE_REL_SH3_DIRECT4,
  310. IMAGE_REL_SH3_DIRECT4_WORD,
  311. IMAGE_REL_SH3_DIRECT4_LONG,
  312. IMAGE_REL_SH3_PCREL8_WORD,
  313. IMAGE_REL_SH3_PCREL8_LONG,
  314. IMAGE_REL_SH3_PCREL12_WORD,
  315. IMAGE_REL_SH3_STARTOF_SECTION,
  316. IMAGE_REL_SH3_SIZEOF_SECTION,
  317. IMAGE_REL_SH3_SECTION,
  318. IMAGE_REL_SH3_SECREL,
  319. IMAGE_REL_SH3_DIRECT32_NB,
  320. IMAGE_REL_SH3_GPREL4_LONG,
  321. IMAGE_REL_SH3_TOKEN,
  322. IMAGE_REL_SHM_PCRELPT,
  323. IMAGE_REL_SHM_REFLO,
  324. IMAGE_REL_SHM_REFHALF,
  325. IMAGE_REL_SHM_RELLO,
  326. IMAGE_REL_SHM_RELHALF,
  327. IMAGE_REL_SHM_PAIR,
  328. IMAGE_REL_SHM_NOMODE,
  329. };
  330. enum ppc_coff_reloc_type {
  331. IMAGE_REL_PPC_ABSOLUTE,
  332. IMAGE_REL_PPC_ADDR64,
  333. IMAGE_REL_PPC_ADDR32,
  334. IMAGE_REL_PPC_ADDR24,
  335. IMAGE_REL_PPC_ADDR16,
  336. IMAGE_REL_PPC_ADDR14,
  337. IMAGE_REL_PPC_REL24,
  338. IMAGE_REL_PPC_REL14,
  339. IMAGE_REL_PPC_ADDR32N,
  340. IMAGE_REL_PPC_SECREL,
  341. IMAGE_REL_PPC_SECTION,
  342. IMAGE_REL_PPC_SECREL16,
  343. IMAGE_REL_PPC_REFHI,
  344. IMAGE_REL_PPC_REFLO,
  345. IMAGE_REL_PPC_PAIR,
  346. IMAGE_REL_PPC_SECRELLO,
  347. IMAGE_REL_PPC_GPREL,
  348. IMAGE_REL_PPC_TOKEN,
  349. };
  350. enum x86_coff_reloc_type {
  351. IMAGE_REL_I386_ABSOLUTE,
  352. IMAGE_REL_I386_DIR16,
  353. IMAGE_REL_I386_REL16,
  354. IMAGE_REL_I386_DIR32,
  355. IMAGE_REL_I386_DIR32NB,
  356. IMAGE_REL_I386_SEG12,
  357. IMAGE_REL_I386_SECTION,
  358. IMAGE_REL_I386_SECREL,
  359. IMAGE_REL_I386_TOKEN,
  360. IMAGE_REL_I386_SECREL7,
  361. IMAGE_REL_I386_REL32,
  362. };
  363. enum ia64_coff_reloc_type {
  364. IMAGE_REL_IA64_ABSOLUTE,
  365. IMAGE_REL_IA64_IMM14,
  366. IMAGE_REL_IA64_IMM22,
  367. IMAGE_REL_IA64_IMM64,
  368. IMAGE_REL_IA64_DIR32,
  369. IMAGE_REL_IA64_DIR64,
  370. IMAGE_REL_IA64_PCREL21B,
  371. IMAGE_REL_IA64_PCREL21M,
  372. IMAGE_REL_IA64_PCREL21F,
  373. IMAGE_REL_IA64_GPREL22,
  374. IMAGE_REL_IA64_LTOFF22,
  375. IMAGE_REL_IA64_SECTION,
  376. IMAGE_REL_IA64_SECREL22,
  377. IMAGE_REL_IA64_SECREL64I,
  378. IMAGE_REL_IA64_SECREL32,
  379. IMAGE_REL_IA64_DIR32NB,
  380. IMAGE_REL_IA64_SREL14,
  381. IMAGE_REL_IA64_SREL22,
  382. IMAGE_REL_IA64_SREL32,
  383. IMAGE_REL_IA64_UREL32,
  384. IMAGE_REL_IA64_PCREL60X,
  385. IMAGE_REL_IA64_PCREL60B,
  386. IMAGE_REL_IA64_PCREL60F,
  387. IMAGE_REL_IA64_PCREL60I,
  388. IMAGE_REL_IA64_PCREL60M,
  389. IMAGE_REL_IA64_IMMGPREL6,
  390. IMAGE_REL_IA64_TOKEN,
  391. IMAGE_REL_IA64_GPREL32,
  392. IMAGE_REL_IA64_ADDEND,
  393. };
  394. struct coff_reloc {
  395. uint32_t virtual_address;
  396. uint32_t symbol_table_index;
  397. union {
  398. enum x64_coff_reloc_type x64_type;
  399. enum arm_coff_reloc_type arm_type;
  400. enum sh_coff_reloc_type sh_type;
  401. enum ppc_coff_reloc_type ppc_type;
  402. enum x86_coff_reloc_type x86_type;
  403. enum ia64_coff_reloc_type ia64_type;
  404. uint16_t data;
  405. };
  406. };
  407. /*
  408. * Definitions for the contents of the certs data block
  409. */
  410. #define WIN_CERT_TYPE_PKCS_SIGNED_DATA 0x0002
  411. #define WIN_CERT_TYPE_EFI_OKCS115 0x0EF0
  412. #define WIN_CERT_TYPE_EFI_GUID 0x0EF1
  413. #define WIN_CERT_REVISION_1_0 0x0100
  414. #define WIN_CERT_REVISION_2_0 0x0200
  415. struct win_certificate {
  416. uint32_t length;
  417. uint16_t revision;
  418. uint16_t cert_type;
  419. };
  420. #endif /* __LINUX_PE_H */