elf.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. /* ----------------------------------------------------------------------- *
  2. *
  3. * Copyright 1996-2018 The NASM Authors - All Rights Reserved
  4. * See the file AUTHORS included with the NASM distribution for
  5. * the specific copyright holders.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following
  9. * conditions are met:
  10. *
  11. * * Redistributions of source code must retain the above copyright
  12. * notice, this list of conditions and the following disclaimer.
  13. * * Redistributions in binary form must reproduce the above
  14. * copyright notice, this list of conditions and the following
  15. * disclaimer in the documentation and/or other materials provided
  16. * with the distribution.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
  19. * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
  20. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  21. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  22. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  23. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  24. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  25. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  26. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  27. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  28. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  29. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  30. * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. *
  32. * ----------------------------------------------------------------------- */
  33. #ifndef OUTPUT_ELF_H
  34. #define OUTPUT_ELF_H
  35. /*
  36. * Since NASM support both Elf32/64 file formats
  37. * we need to cover all types, structures, typedefs and etc
  38. */
  39. #include "compiler.h"
  40. /* Segment types */
  41. #define PT_NULL 0
  42. #define PT_LOAD 1
  43. #define PT_DYNAMIC 2
  44. #define PT_INTERP 3
  45. #define PT_NOTE 4
  46. #define PT_SHLIB 5
  47. #define PT_PHDR 6
  48. #define PT_LOOS 0x60000000
  49. #define PT_HIOS 0x6fffffff
  50. #define PT_LOPROC 0x70000000
  51. #define PT_HIPROC 0x7fffffff
  52. #define PT_GNU_EH_FRAME 0x6474e550 /* Extension, eh? */
  53. /* ELF file types */
  54. #define ET_NONE 0
  55. #define ET_REL 1
  56. #define ET_EXEC 2
  57. #define ET_DYN 3
  58. #define ET_CORE 4
  59. #define ET_LOPROC 0xff00
  60. #define ET_HIPROC 0xffff
  61. /* ELF machine types */
  62. #define EM_NONE 0
  63. #define EM_M32 1
  64. #define EM_SPARC 2
  65. #define EM_386 3
  66. #define EM_68K 4
  67. #define EM_88K 5
  68. #define EM_486 6 /* Not used in Linux at least */
  69. #define EM_860 7
  70. #define EM_MIPS 8 /* R3k, bigendian(?) */
  71. #define EM_MIPS_RS4_BE 10 /* R4k BE */
  72. #define EM_PARISC 15
  73. #define EM_SPARC32PLUS 18
  74. #define EM_PPC 20
  75. #define EM_PPC64 21
  76. #define EM_S390 22
  77. #define EM_SH 42
  78. #define EM_SPARCV9 43 /* v9 = SPARC64 */
  79. #define EM_H8_300H 47
  80. #define EM_H8S 48
  81. #define EM_IA_64 50
  82. #define EM_X86_64 62
  83. #define EM_CRIS 76
  84. #define EM_V850 87
  85. #define EM_ALPHA 0x9026 /* Interrim Alpha that stuck around */
  86. #define EM_CYGNUS_V850 0x9080 /* Old v850 ID used by Cygnus */
  87. #define EM_S390_OLD 0xA390 /* Obsolete interrim value for S/390 */
  88. /* Dynamic type values */
  89. #define DT_NULL 0
  90. #define DT_NEEDED 1
  91. #define DT_PLTRELSZ 2
  92. #define DT_PLTGOT 3
  93. #define DT_HASH 4
  94. #define DT_STRTAB 5
  95. #define DT_SYMTAB 6
  96. #define DT_RELA 7
  97. #define DT_RELASZ 8
  98. #define DT_RELAENT 9
  99. #define DT_STRSZ 10
  100. #define DT_SYMENT 11
  101. #define DT_INIT 12
  102. #define DT_FINI 13
  103. #define DT_SONAME 14
  104. #define DT_RPATH 15
  105. #define DT_SYMBOLIC 16
  106. #define DT_REL 17
  107. #define DT_RELSZ 18
  108. #define DT_RELENT 19
  109. #define DT_PLTREL 20
  110. #define DT_DEBUG 21
  111. #define DT_TEXTREL 22
  112. #define DT_JMPREL 23
  113. #define DT_LOPROC 0x70000000
  114. #define DT_HIPROC 0x7fffffff
  115. /* Auxilliary table entries */
  116. #define AT_NULL 0 /* end of vector */
  117. #define AT_IGNORE 1 /* entry should be ignored */
  118. #define AT_EXECFD 2 /* file descriptor of program */
  119. #define AT_PHDR 3 /* program headers for program */
  120. #define AT_PHENT 4 /* size of program header entry */
  121. #define AT_PHNUM 5 /* number of program headers */
  122. #define AT_PAGESZ 6 /* system page size */
  123. #define AT_BASE 7 /* base address of interpreter */
  124. #define AT_FLAGS 8 /* flags */
  125. #define AT_ENTRY 9 /* entry point of program */
  126. #define AT_NOTELF 10 /* program is not ELF */
  127. #define AT_UID 11 /* real uid */
  128. #define AT_EUID 12 /* effective uid */
  129. #define AT_GID 13 /* real gid */
  130. #define AT_EGID 14 /* effective gid */
  131. #define AT_PLATFORM 15 /* string identifying CPU for optimizations */
  132. #define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */
  133. #define AT_CLKTCK 17 /* frequency at which times() increments */
  134. /* 18..22 = ? */
  135. #define AT_SECURE 23 /* secure mode boolean */
  136. /* Program header permission flags */
  137. #define PF_X 0x1
  138. #define PF_W 0x2
  139. #define PF_R 0x4
  140. /* Section header types */
  141. #define SHT_NULL 0
  142. #define SHT_PROGBITS 1
  143. #define SHT_SYMTAB 2
  144. #define SHT_STRTAB 3
  145. #define SHT_RELA 4
  146. #define SHT_HASH 5
  147. #define SHT_DYNAMIC 6
  148. #define SHT_NOTE 7
  149. #define SHT_NOBITS 8
  150. #define SHT_REL 9
  151. #define SHT_SHLIB 10
  152. #define SHT_DYNSYM 11
  153. #define SHT_NUM 12
  154. #define SHT_LOPROC 0x70000000
  155. #define SHT_HIPROC 0x7fffffff
  156. #define SHT_LOUSER 0x80000000
  157. #define SHT_HIUSER 0xffffffff
  158. /* Section header flags */
  159. #define SHF_WRITE (1 << 0) /* Writable */
  160. #define SHF_ALLOC (1 << 1) /* Occupies memory during execution */
  161. #define SHF_EXECINSTR (1 << 2) /* Executable */
  162. #define SHF_MERGE (1 << 4) /* Might be merged */
  163. #define SHF_STRINGS (1 << 5) /* Contains nul-terminated strings */
  164. #define SHF_INFO_LINK (1 << 6) /* `sh_info' contains SHT index */
  165. #define SHF_LINK_ORDER (1 << 7) /* Preserve order after combining */
  166. #define SHF_OS_NONCONFORMING (1 << 8) /* Non-standard OS specific handling required */
  167. #define SHF_GROUP (1 << 9) /* Section is member of a group */
  168. #define SHF_TLS (1 << 10) /* Section hold thread-local data */
  169. /* Special section numbers */
  170. #define SHN_UNDEF 0
  171. #define SHN_LORESERVE 0xff00
  172. #define SHN_LOPROC 0xff00
  173. #define SHN_HIPROC 0xff1f
  174. #define SHN_ABS 0xfff1
  175. #define SHN_COMMON 0xfff2
  176. #define SHN_HIRESERVE 0xffff
  177. /* Section align flag */
  178. #define SHA_ANY 1 /* No alignment constraint */
  179. /* Lenght of magic at the start of a file */
  180. #define EI_NIDENT 16
  181. /* Magic number constants... */
  182. #define EI_MAG0 0 /* e_ident[] indexes */
  183. #define EI_MAG1 1
  184. #define EI_MAG2 2
  185. #define EI_MAG3 3
  186. #define EI_CLASS 4
  187. #define EI_DATA 5
  188. #define EI_VERSION 6
  189. #define EI_OSABI 7
  190. #define EI_ABIVERSION 8
  191. #define EI_NINDENT 16
  192. #define ELFMAG0 0x7f /* EI_MAG */
  193. #define ELFMAG1 'E'
  194. #define ELFMAG2 'L'
  195. #define ELFMAG3 'F'
  196. #define ELFMAG "\177ELF"
  197. #define SELFMAG 4
  198. #define ELFCLASSNONE 0 /* EI_CLASS */
  199. #define ELFCLASS32 1
  200. #define ELFCLASS64 2
  201. #define ELFCLASSNUM 3
  202. #define ELFDATANONE 0 /* e_ident[EI_DATA] */
  203. #define ELFDATA2LSB 1
  204. #define ELFDATA2MSB 2
  205. #define EV_NONE 0 /* e_version, EI_VERSION */
  206. #define EV_CURRENT 1
  207. #define EV_NUM 2
  208. #define ELFOSABI_NONE 0
  209. #define ELFOSABI_LINUX 3
  210. /* Legal values for ST_BIND subfield of st_info (symbol binding) */
  211. #define STB_LOCAL 0 /* Local symbol */
  212. #define STB_GLOBAL 1 /* Global symbol */
  213. #define STB_WEAK 2 /* Weak symbol */
  214. #define STB_NUM 3 /* Number of defined types */
  215. #define STB_LOOS 10 /* Start of OS-specific */
  216. #define STB_HIOS 12 /* End of OS-specific */
  217. #define STB_LOPROC 13 /* Start of processor-specific */
  218. #define STB_HIPROC 15 /* End of processor-specific */
  219. /* Symbol types */
  220. #define STT_NOTYPE 0 /* Symbol type is unspecified */
  221. #define STT_OBJECT 1 /* Symbol is a data object */
  222. #define STT_FUNC 2 /* Symbol is a code object */
  223. #define STT_SECTION 3 /* Symbol associated with a section */
  224. #define STT_FILE 4 /* Symbol's name is file name */
  225. #define STT_COMMON 5 /* Symbol is a common data object */
  226. #define STT_TLS 6 /* Symbol is thread-local data object */
  227. #define STT_NUM 7 /* Number of defined types */
  228. /* Symbol visibilities */
  229. #define STV_DEFAULT 0 /* Default symbol visibility rules */
  230. #define STV_INTERNAL 1 /* Processor specific hidden class */
  231. #define STV_HIDDEN 2 /* Sym unavailable in other modules */
  232. #define STV_PROTECTED 3 /* Not preemptible, not exported */
  233. /* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field */
  234. #define ELF32_ST_BIND(i) ((i) >> 4)
  235. #define ELF32_ST_MKBIND(i) ((i) << 4) /* just a helper */
  236. #define ELF32_ST_TYPE(i) ((i) & 0xf)
  237. #define ELF32_ST_INFO(b, i) (ELF32_ST_MKBIND(b) + ELF32_ST_TYPE(i))
  238. #define ELF64_ST_BIND(i) ELF32_ST_BIND(i)
  239. #define ELF64_ST_MKBIND(i) ELF32_ST_MKBIND(i)
  240. #define ELF64_ST_TYPE(i) ELF32_ST_TYPE(i)
  241. #define ELF64_ST_INFO(b, i) ELF32_ST_INFO(b, i)
  242. /*
  243. * ELF standard typedefs (yet more proof that <stdint.h> was way overdue)
  244. */
  245. typedef uint16_t Elf32_Half;
  246. typedef int16_t Elf32_SHalf;
  247. typedef uint32_t Elf32_Word;
  248. typedef int32_t Elf32_Sword;
  249. typedef uint64_t Elf32_Xword;
  250. typedef int64_t Elf32_Sxword;
  251. typedef uint32_t Elf32_Off;
  252. typedef uint32_t Elf32_Addr;
  253. typedef uint16_t Elf32_Section;
  254. typedef uint16_t Elf64_Half;
  255. typedef int16_t Elf64_SHalf;
  256. typedef uint32_t Elf64_Word;
  257. typedef int32_t Elf64_Sword;
  258. typedef uint64_t Elf64_Xword;
  259. typedef int64_t Elf64_Sxword;
  260. typedef uint64_t Elf64_Off;
  261. typedef uint64_t Elf64_Addr;
  262. typedef uint16_t Elf64_Section;
  263. /*
  264. * Dynamic header
  265. */
  266. typedef struct elf32_dyn {
  267. Elf32_Sword d_tag;
  268. union {
  269. Elf32_Sword d_val;
  270. Elf32_Addr d_ptr;
  271. } d_un;
  272. } Elf32_Dyn;
  273. typedef struct elf64_dyn {
  274. Elf64_Sxword d_tag;
  275. union {
  276. Elf64_Xword d_val;
  277. Elf64_Addr d_ptr;
  278. } d_un;
  279. } Elf64_Dyn;
  280. /*
  281. * Relocations
  282. */
  283. #define ELF32_R_SYM(x) ((x) >> 8)
  284. #define ELF32_R_TYPE(x) ((x) & 0xff)
  285. #define ELF32_R_INFO(s,t) (((Elf32_Word)(s) << 8) + ELF32_R_TYPE(t))
  286. typedef struct elf32_rel {
  287. Elf32_Addr r_offset;
  288. Elf32_Word r_info;
  289. } Elf32_Rel;
  290. typedef struct elf32_rela {
  291. Elf32_Addr r_offset;
  292. Elf32_Word r_info;
  293. Elf32_Sword r_addend;
  294. } Elf32_Rela;
  295. enum reloc32_type {
  296. R_386_32 = 1, /* ordinary absolute relocation */
  297. R_386_PC32 = 2, /* PC-relative relocation */
  298. R_386_GOT32 = 3, /* an offset into GOT */
  299. R_386_PLT32 = 4, /* a PC-relative offset into PLT */
  300. R_386_COPY = 5, /* ??? */
  301. R_386_GLOB_DAT = 6, /* ??? */
  302. R_386_JUMP_SLOT = 7, /* ??? */
  303. R_386_RELATIVE = 8, /* ??? */
  304. R_386_GOTOFF = 9, /* an offset from GOT base */
  305. R_386_GOTPC = 10, /* a PC-relative offset _to_ GOT */
  306. R_386_TLS_TPOFF = 14, /* Offset in static TLS block */
  307. R_386_TLS_IE = 15, /* Address of GOT entry for static TLS block offset */
  308. /* These are GNU extensions, but useful */
  309. R_386_16 = 20, /* A 16-bit absolute relocation */
  310. R_386_PC16 = 21, /* A 16-bit PC-relative relocation */
  311. R_386_8 = 22, /* An 8-bit absolute relocation */
  312. R_386_PC8 = 23 /* An 8-bit PC-relative relocation */
  313. };
  314. #define ELF64_R_SYM(x) ((x) >> 32)
  315. #define ELF64_R_TYPE(x) ((x) & 0xffffffff)
  316. #define ELF64_R_INFO(s,t) (((Elf64_Xword)(s) << 32) + ELF64_R_TYPE(t))
  317. typedef struct elf64_rel {
  318. Elf64_Addr r_offset;
  319. Elf64_Xword r_info;
  320. } Elf64_Rel;
  321. typedef struct elf64_rela {
  322. Elf64_Addr r_offset;
  323. Elf64_Xword r_info;
  324. Elf64_Sxword r_addend;
  325. } Elf64_Rela;
  326. enum reloc64_type {
  327. R_X86_64_NONE = 0, /* No reloc */
  328. R_X86_64_64 = 1, /* Direct 64 bit */
  329. R_X86_64_PC32 = 2, /* PC relative 32 bit signed */
  330. R_X86_64_GOT32 = 3, /* 32 bit GOT entry */
  331. R_X86_64_PLT32 = 4, /* 32 bit PLT address */
  332. R_X86_64_COPY = 5, /* Copy symbol at runtime */
  333. R_X86_64_GLOB_DAT = 6, /* Create GOT entry */
  334. R_X86_64_JUMP_SLOT = 7, /* Create PLT entry */
  335. R_X86_64_RELATIVE = 8, /* Adjust by program base */
  336. R_X86_64_GOTPCREL = 9, /* 32 bit signed PC relative offset to GOT */
  337. R_X86_64_32 = 10, /* Direct 32 bit zero extended */
  338. R_X86_64_32S = 11, /* Direct 32 bit sign extended */
  339. R_X86_64_16 = 12, /* Direct 16 bit zero extended */
  340. R_X86_64_PC16 = 13, /* 16 bit sign extended pc relative */
  341. R_X86_64_8 = 14, /* Direct 8 bit sign extended */
  342. R_X86_64_PC8 = 15, /* 8 bit sign extended pc relative */
  343. R_X86_64_DTPMOD64 = 16, /* ID of module containing symbol */
  344. R_X86_64_DTPOFF64 = 17, /* Offset in module's TLS block */
  345. R_X86_64_TPOFF64 = 18, /* Offset in initial TLS block */
  346. R_X86_64_TLSGD = 19, /* 32 bit signed PC relative offset to two GOT entries for GD symbol */
  347. R_X86_64_TLSLD = 20, /* 32 bit signed PC relative offset to two GOT entries for LD symbol */
  348. R_X86_64_DTPOFF32 = 21, /* Offset in TLS block */
  349. R_X86_64_GOTTPOFF = 22, /* 32 bit signed PC relative offset to GOT entry for IE symbol */
  350. R_X86_64_TPOFF32 = 23, /* Offset in initial TLS block */
  351. R_X86_64_PC64 = 24, /* word64 S + A - P */
  352. R_X86_64_GOTOFF64 = 25, /* word64 S + A - GOT */
  353. R_X86_64_GOTPC32 = 26, /* word32 GOT + A - P */
  354. R_X86_64_GOT64 = 27, /* word64 G + A */
  355. R_X86_64_GOTPCREL64 = 28, /* word64 G + GOT - P + A */
  356. R_X86_64_GOTPC64 = 29, /* word64 GOT - P + A */
  357. R_X86_64_GOTPLT64 = 30, /* word64 G + A */
  358. R_X86_64_PLTOFF64 = 31, /* word64 L - GOT + A */
  359. R_X86_64_SIZE32 = 32, /* word32 Z + A */
  360. R_X86_64_SIZE64 = 33, /* word64 Z + A */
  361. R_X86_64_GOTPC32_TLSDESC= 34, /* word32 */
  362. R_X86_64_TLSDESC_CALL = 35, /* none */
  363. R_X86_64_TLSDESC = 36 /* word64?2 */
  364. };
  365. /*
  366. * Symbol
  367. */
  368. typedef struct elf32_sym {
  369. Elf32_Word st_name;
  370. Elf32_Addr st_value;
  371. Elf32_Word st_size;
  372. unsigned char st_info;
  373. unsigned char st_other;
  374. Elf32_Half st_shndx;
  375. } Elf32_Sym;
  376. typedef struct elf64_sym {
  377. Elf64_Word st_name;
  378. unsigned char st_info;
  379. unsigned char st_other;
  380. Elf64_Half st_shndx;
  381. Elf64_Addr st_value;
  382. Elf64_Xword st_size;
  383. } Elf64_Sym;
  384. /*
  385. * Main file header
  386. */
  387. typedef struct elf32_hdr {
  388. unsigned char e_ident[EI_NIDENT];
  389. Elf32_Half e_type;
  390. Elf32_Half e_machine;
  391. Elf32_Word e_version;
  392. Elf32_Addr e_entry;
  393. Elf32_Off e_phoff;
  394. Elf32_Off e_shoff;
  395. Elf32_Word e_flags;
  396. Elf32_Half e_ehsize;
  397. Elf32_Half e_phentsize;
  398. Elf32_Half e_phnum;
  399. Elf32_Half e_shentsize;
  400. Elf32_Half e_shnum;
  401. Elf32_Half e_shstrndx;
  402. } Elf32_Ehdr;
  403. typedef struct elf64_hdr {
  404. unsigned char e_ident[EI_NIDENT];
  405. Elf64_Half e_type;
  406. Elf64_Half e_machine;
  407. Elf64_Word e_version;
  408. Elf64_Addr e_entry;
  409. Elf64_Off e_phoff;
  410. Elf64_Off e_shoff;
  411. Elf64_Word e_flags;
  412. Elf64_Half e_ehsize;
  413. Elf64_Half e_phentsize;
  414. Elf64_Half e_phnum;
  415. Elf64_Half e_shentsize;
  416. Elf64_Half e_shnum;
  417. Elf64_Half e_shstrndx;
  418. } Elf64_Ehdr;
  419. /*
  420. * Program header
  421. */
  422. typedef struct elf32_phdr {
  423. Elf32_Word p_type;
  424. Elf32_Off p_offset;
  425. Elf32_Addr p_vaddr;
  426. Elf32_Addr p_paddr;
  427. Elf32_Word p_filesz;
  428. Elf32_Word p_memsz;
  429. Elf32_Word p_flags;
  430. Elf32_Word p_align;
  431. } Elf32_Phdr;
  432. typedef struct elf64_phdr {
  433. Elf64_Word p_type;
  434. Elf64_Word p_flags;
  435. Elf64_Off p_offset;
  436. Elf64_Addr p_vaddr;
  437. Elf64_Addr p_paddr;
  438. Elf64_Xword p_filesz;
  439. Elf64_Xword p_memsz;
  440. Elf64_Xword p_align;
  441. } Elf64_Phdr;
  442. /*
  443. * Section header
  444. */
  445. typedef struct elf32_shdr {
  446. Elf32_Word sh_name;
  447. Elf32_Word sh_type;
  448. Elf32_Word sh_flags;
  449. Elf32_Addr sh_addr;
  450. Elf32_Off sh_offset;
  451. Elf32_Word sh_size;
  452. Elf32_Word sh_link;
  453. Elf32_Word sh_info;
  454. Elf32_Word sh_addralign;
  455. Elf32_Word sh_entsize;
  456. } Elf32_Shdr;
  457. typedef struct elf64_shdr {
  458. Elf64_Word sh_name;
  459. Elf64_Word sh_type;
  460. Elf64_Xword sh_flags;
  461. Elf64_Addr sh_addr;
  462. Elf64_Off sh_offset;
  463. Elf64_Xword sh_size;
  464. Elf64_Word sh_link;
  465. Elf64_Word sh_info;
  466. Elf64_Xword sh_addralign;
  467. Elf64_Xword sh_entsize;
  468. } Elf64_Shdr;
  469. /*
  470. * Note header
  471. */
  472. typedef struct elf32_note {
  473. Elf32_Word n_namesz; /* Name size */
  474. Elf32_Word n_descsz; /* Content size */
  475. Elf32_Word n_type; /* Content type */
  476. } Elf32_Nhdr;
  477. typedef struct elf64_note {
  478. Elf64_Word n_namesz; /* Name size */
  479. Elf64_Word n_descsz; /* Content size */
  480. Elf64_Word n_type; /* Content type */
  481. } Elf64_Nhdr;
  482. #endif /* OUTPUT_ELF_H */