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