elf.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. #ifndef _LINUX_ELF_H
  3. #define _LINUX_ELF_H
  4. #include <linux/types.h>
  5. #include <linux/elf-em.h>
  6. /* 32-bit ELF base types. */
  7. typedef __u32 Elf32_Addr;
  8. typedef __u16 Elf32_Half;
  9. typedef __u32 Elf32_Off;
  10. typedef __s32 Elf32_Sword;
  11. typedef __u32 Elf32_Word;
  12. typedef __u16 Elf32_Versym;
  13. /* 64-bit ELF base types. */
  14. typedef __u64 Elf64_Addr;
  15. typedef __u16 Elf64_Half;
  16. typedef __s16 Elf64_SHalf;
  17. typedef __u64 Elf64_Off;
  18. typedef __s32 Elf64_Sword;
  19. typedef __u32 Elf64_Word;
  20. typedef __u64 Elf64_Xword;
  21. typedef __s64 Elf64_Sxword;
  22. typedef __u16 Elf64_Versym;
  23. /* These constants are for the segment types stored in the image headers */
  24. #define PT_NULL 0
  25. #define PT_LOAD 1
  26. #define PT_DYNAMIC 2
  27. #define PT_INTERP 3
  28. #define PT_NOTE 4
  29. #define PT_SHLIB 5
  30. #define PT_PHDR 6
  31. #define PT_TLS 7 /* Thread local storage segment */
  32. #define PT_LOOS 0x60000000 /* OS-specific */
  33. #define PT_HIOS 0x6fffffff /* OS-specific */
  34. #define PT_LOPROC 0x70000000
  35. #define PT_HIPROC 0x7fffffff
  36. #define PT_GNU_EH_FRAME (PT_LOOS + 0x474e550)
  37. #define PT_GNU_STACK (PT_LOOS + 0x474e551)
  38. #define PT_GNU_RELRO (PT_LOOS + 0x474e552)
  39. #define PT_GNU_PROPERTY (PT_LOOS + 0x474e553)
  40. /* ARM MTE memory tag segment type */
  41. #define PT_AARCH64_MEMTAG_MTE (PT_LOPROC + 0x2)
  42. /*
  43. * Extended Numbering
  44. *
  45. * If the real number of program header table entries is larger than
  46. * or equal to PN_XNUM(0xffff), it is set to sh_info field of the
  47. * section header at index 0, and PN_XNUM is set to e_phnum
  48. * field. Otherwise, the section header at index 0 is zero
  49. * initialized, if it exists.
  50. *
  51. * Specifications are available in:
  52. *
  53. * - Oracle: Linker and Libraries.
  54. * Part No: 817–1984–19, August 2011.
  55. * https://docs.oracle.com/cd/E18752_01/pdf/817-1984.pdf
  56. *
  57. * - System V ABI AMD64 Architecture Processor Supplement
  58. * Draft Version 0.99.4,
  59. * January 13, 2010.
  60. * http://www.cs.washington.edu/education/courses/cse351/12wi/supp-docs/abi.pdf
  61. */
  62. #define PN_XNUM 0xffff
  63. /* These constants define the different elf file types */
  64. #define ET_NONE 0
  65. #define ET_REL 1
  66. #define ET_EXEC 2
  67. #define ET_DYN 3
  68. #define ET_CORE 4
  69. #define ET_LOPROC 0xff00
  70. #define ET_HIPROC 0xffff
  71. /* This is the info that is needed to parse the dynamic section of the file */
  72. #define DT_NULL 0
  73. #define DT_NEEDED 1
  74. #define DT_PLTRELSZ 2
  75. #define DT_PLTGOT 3
  76. #define DT_HASH 4
  77. #define DT_STRTAB 5
  78. #define DT_SYMTAB 6
  79. #define DT_RELA 7
  80. #define DT_RELASZ 8
  81. #define DT_RELAENT 9
  82. #define DT_STRSZ 10
  83. #define DT_SYMENT 11
  84. #define DT_INIT 12
  85. #define DT_FINI 13
  86. #define DT_SONAME 14
  87. #define DT_RPATH 15
  88. #define DT_SYMBOLIC 16
  89. #define DT_REL 17
  90. #define DT_RELSZ 18
  91. #define DT_RELENT 19
  92. #define DT_PLTREL 20
  93. #define DT_DEBUG 21
  94. #define DT_TEXTREL 22
  95. #define DT_JMPREL 23
  96. #define DT_ENCODING 32
  97. #define OLD_DT_LOOS 0x60000000
  98. #define DT_LOOS 0x6000000d
  99. #define DT_HIOS 0x6ffff000
  100. #define DT_VALRNGLO 0x6ffffd00
  101. #define DT_VALRNGHI 0x6ffffdff
  102. #define DT_ADDRRNGLO 0x6ffffe00
  103. #define DT_GNU_HASH 0x6ffffef5
  104. #define DT_ADDRRNGHI 0x6ffffeff
  105. #define DT_VERSYM 0x6ffffff0
  106. #define DT_RELACOUNT 0x6ffffff9
  107. #define DT_RELCOUNT 0x6ffffffa
  108. #define DT_FLAGS_1 0x6ffffffb
  109. #define DT_VERDEF 0x6ffffffc
  110. #define DT_VERDEFNUM 0x6ffffffd
  111. #define DT_VERNEED 0x6ffffffe
  112. #define DT_VERNEEDNUM 0x6fffffff
  113. #define OLD_DT_HIOS 0x6fffffff
  114. #define DT_LOPROC 0x70000000
  115. #define DT_HIPROC 0x7fffffff
  116. /* This info is needed when parsing the symbol table */
  117. #define STB_LOCAL 0
  118. #define STB_GLOBAL 1
  119. #define STB_WEAK 2
  120. #define STN_UNDEF 0
  121. #define STT_NOTYPE 0
  122. #define STT_OBJECT 1
  123. #define STT_FUNC 2
  124. #define STT_SECTION 3
  125. #define STT_FILE 4
  126. #define STT_COMMON 5
  127. #define STT_TLS 6
  128. #define VER_FLG_BASE 0x1
  129. #define VER_FLG_WEAK 0x2
  130. #define ELF_ST_BIND(x) ((x) >> 4)
  131. #define ELF_ST_TYPE(x) ((x) & 0xf)
  132. #define ELF32_ST_BIND(x) ELF_ST_BIND(x)
  133. #define ELF32_ST_TYPE(x) ELF_ST_TYPE(x)
  134. #define ELF64_ST_BIND(x) ELF_ST_BIND(x)
  135. #define ELF64_ST_TYPE(x) ELF_ST_TYPE(x)
  136. typedef struct {
  137. Elf32_Sword d_tag;
  138. union {
  139. Elf32_Sword d_val;
  140. Elf32_Addr d_ptr;
  141. } d_un;
  142. } Elf32_Dyn;
  143. typedef struct {
  144. Elf64_Sxword d_tag; /* entry tag value */
  145. union {
  146. Elf64_Xword d_val;
  147. Elf64_Addr d_ptr;
  148. } d_un;
  149. } Elf64_Dyn;
  150. /* The following are used with relocations */
  151. #define ELF32_R_SYM(x) ((x) >> 8)
  152. #define ELF32_R_TYPE(x) ((x) & 0xff)
  153. #define ELF64_R_SYM(i) ((i) >> 32)
  154. #define ELF64_R_TYPE(i) ((i) & 0xffffffff)
  155. typedef struct elf32_rel {
  156. Elf32_Addr r_offset;
  157. Elf32_Word r_info;
  158. } Elf32_Rel;
  159. typedef struct elf64_rel {
  160. Elf64_Addr r_offset; /* Location at which to apply the action */
  161. Elf64_Xword r_info; /* index and type of relocation */
  162. } Elf64_Rel;
  163. typedef struct elf32_rela {
  164. Elf32_Addr r_offset;
  165. Elf32_Word r_info;
  166. Elf32_Sword r_addend;
  167. } Elf32_Rela;
  168. typedef struct elf64_rela {
  169. Elf64_Addr r_offset; /* Location at which to apply the action */
  170. Elf64_Xword r_info; /* index and type of relocation */
  171. Elf64_Sxword r_addend; /* Constant addend used to compute value */
  172. } Elf64_Rela;
  173. typedef struct elf32_sym {
  174. Elf32_Word st_name;
  175. Elf32_Addr st_value;
  176. Elf32_Word st_size;
  177. unsigned char st_info;
  178. unsigned char st_other;
  179. Elf32_Half st_shndx;
  180. } Elf32_Sym;
  181. typedef struct elf64_sym {
  182. Elf64_Word st_name; /* Symbol name, index in string tbl */
  183. unsigned char st_info; /* Type and binding attributes */
  184. unsigned char st_other; /* No defined meaning, 0 */
  185. Elf64_Half st_shndx; /* Associated section index */
  186. Elf64_Addr st_value; /* Value of the symbol */
  187. Elf64_Xword st_size; /* Associated symbol size */
  188. } Elf64_Sym;
  189. #define EI_NIDENT 16
  190. typedef struct elf32_hdr {
  191. unsigned char e_ident[EI_NIDENT];
  192. Elf32_Half e_type;
  193. Elf32_Half e_machine;
  194. Elf32_Word e_version;
  195. Elf32_Addr e_entry; /* Entry point */
  196. Elf32_Off e_phoff;
  197. Elf32_Off e_shoff;
  198. Elf32_Word e_flags;
  199. Elf32_Half e_ehsize;
  200. Elf32_Half e_phentsize;
  201. Elf32_Half e_phnum;
  202. Elf32_Half e_shentsize;
  203. Elf32_Half e_shnum;
  204. Elf32_Half e_shstrndx;
  205. } Elf32_Ehdr;
  206. typedef struct elf64_hdr {
  207. unsigned char e_ident[EI_NIDENT]; /* ELF "magic number" */
  208. Elf64_Half e_type;
  209. Elf64_Half e_machine;
  210. Elf64_Word e_version;
  211. Elf64_Addr e_entry; /* Entry point virtual address */
  212. Elf64_Off e_phoff; /* Program header table file offset */
  213. Elf64_Off e_shoff; /* Section header table file offset */
  214. Elf64_Word e_flags;
  215. Elf64_Half e_ehsize;
  216. Elf64_Half e_phentsize;
  217. Elf64_Half e_phnum;
  218. Elf64_Half e_shentsize;
  219. Elf64_Half e_shnum;
  220. Elf64_Half e_shstrndx;
  221. } Elf64_Ehdr;
  222. /* These constants define the permissions on sections in the program
  223. header, p_flags. */
  224. #define PF_R 0x4
  225. #define PF_W 0x2
  226. #define PF_X 0x1
  227. typedef struct elf32_phdr {
  228. Elf32_Word p_type;
  229. Elf32_Off p_offset;
  230. Elf32_Addr p_vaddr;
  231. Elf32_Addr p_paddr;
  232. Elf32_Word p_filesz;
  233. Elf32_Word p_memsz;
  234. Elf32_Word p_flags;
  235. Elf32_Word p_align;
  236. } Elf32_Phdr;
  237. typedef struct elf64_phdr {
  238. Elf64_Word p_type;
  239. Elf64_Word p_flags;
  240. Elf64_Off p_offset; /* Segment file offset */
  241. Elf64_Addr p_vaddr; /* Segment virtual address */
  242. Elf64_Addr p_paddr; /* Segment physical address */
  243. Elf64_Xword p_filesz; /* Segment size in file */
  244. Elf64_Xword p_memsz; /* Segment size in memory */
  245. Elf64_Xword p_align; /* Segment alignment, file & memory */
  246. } Elf64_Phdr;
  247. /* sh_type */
  248. #define SHT_NULL 0
  249. #define SHT_PROGBITS 1
  250. #define SHT_SYMTAB 2
  251. #define SHT_STRTAB 3
  252. #define SHT_RELA 4
  253. #define SHT_HASH 5
  254. #define SHT_DYNAMIC 6
  255. #define SHT_NOTE 7
  256. #define SHT_NOBITS 8
  257. #define SHT_REL 9
  258. #define SHT_SHLIB 10
  259. #define SHT_DYNSYM 11
  260. #define SHT_NUM 12
  261. #define SHT_LOPROC 0x70000000
  262. #define SHT_HIPROC 0x7fffffff
  263. #define SHT_LOUSER 0x80000000
  264. #define SHT_HIUSER 0xffffffff
  265. /* sh_flags */
  266. #define SHF_WRITE 0x1
  267. #define SHF_ALLOC 0x2
  268. #define SHF_EXECINSTR 0x4
  269. #define SHF_RELA_LIVEPATCH 0x00100000
  270. #define SHF_RO_AFTER_INIT 0x00200000
  271. #define SHF_MASKPROC 0xf0000000
  272. /* special section indexes */
  273. #define SHN_UNDEF 0
  274. #define SHN_LORESERVE 0xff00
  275. #define SHN_LOPROC 0xff00
  276. #define SHN_HIPROC 0xff1f
  277. #define SHN_LIVEPATCH 0xff20
  278. #define SHN_ABS 0xfff1
  279. #define SHN_COMMON 0xfff2
  280. #define SHN_HIRESERVE 0xffff
  281. typedef struct elf32_shdr {
  282. Elf32_Word sh_name;
  283. Elf32_Word sh_type;
  284. Elf32_Word sh_flags;
  285. Elf32_Addr sh_addr;
  286. Elf32_Off sh_offset;
  287. Elf32_Word sh_size;
  288. Elf32_Word sh_link;
  289. Elf32_Word sh_info;
  290. Elf32_Word sh_addralign;
  291. Elf32_Word sh_entsize;
  292. } Elf32_Shdr;
  293. typedef struct elf64_shdr {
  294. Elf64_Word sh_name; /* Section name, index in string tbl */
  295. Elf64_Word sh_type; /* Type of section */
  296. Elf64_Xword sh_flags; /* Miscellaneous section attributes */
  297. Elf64_Addr sh_addr; /* Section virtual addr at execution */
  298. Elf64_Off sh_offset; /* Section file offset */
  299. Elf64_Xword sh_size; /* Size of section in bytes */
  300. Elf64_Word sh_link; /* Index of another section */
  301. Elf64_Word sh_info; /* Additional section information */
  302. Elf64_Xword sh_addralign; /* Section alignment */
  303. Elf64_Xword sh_entsize; /* Entry size if section holds table */
  304. } Elf64_Shdr;
  305. #define EI_MAG0 0 /* e_ident[] indexes */
  306. #define EI_MAG1 1
  307. #define EI_MAG2 2
  308. #define EI_MAG3 3
  309. #define EI_CLASS 4
  310. #define EI_DATA 5
  311. #define EI_VERSION 6
  312. #define EI_OSABI 7
  313. #define EI_PAD 8
  314. #define ELFMAG0 0x7f /* EI_MAG */
  315. #define ELFMAG1 'E'
  316. #define ELFMAG2 'L'
  317. #define ELFMAG3 'F'
  318. #define ELFMAG "\177ELF"
  319. #define SELFMAG 4
  320. #define ELFCLASSNONE 0 /* EI_CLASS */
  321. #define ELFCLASS32 1
  322. #define ELFCLASS64 2
  323. #define ELFCLASSNUM 3
  324. #define ELFDATANONE 0 /* e_ident[EI_DATA] */
  325. #define ELFDATA2LSB 1
  326. #define ELFDATA2MSB 2
  327. #define EV_NONE 0 /* e_version, EI_VERSION */
  328. #define EV_CURRENT 1
  329. #define EV_NUM 2
  330. #define ELFOSABI_NONE 0
  331. #define ELFOSABI_LINUX 3
  332. #ifndef ELF_OSABI
  333. #define ELF_OSABI ELFOSABI_NONE
  334. #endif
  335. /*
  336. * Notes used in ET_CORE. Architectures export some of the arch register sets
  337. * using the corresponding note types via the PTRACE_GETREGSET and
  338. * PTRACE_SETREGSET requests.
  339. * The note name for these types is "LINUX", except NT_PRFPREG that is named
  340. * "CORE".
  341. */
  342. #define NT_PRSTATUS 1
  343. #define NT_PRFPREG 2
  344. #define NT_PRPSINFO 3
  345. #define NT_TASKSTRUCT 4
  346. #define NT_AUXV 6
  347. /*
  348. * Note to userspace developers: size of NT_SIGINFO note may increase
  349. * in the future to accomodate more fields, don't assume it is fixed!
  350. */
  351. #define NT_SIGINFO 0x53494749
  352. #define NT_FILE 0x46494c45
  353. #define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */
  354. #define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */
  355. #define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */
  356. #define NT_PPC_VSX 0x102 /* PowerPC VSX registers */
  357. #define NT_PPC_TAR 0x103 /* Target Address Register */
  358. #define NT_PPC_PPR 0x104 /* Program Priority Register */
  359. #define NT_PPC_DSCR 0x105 /* Data Stream Control Register */
  360. #define NT_PPC_EBB 0x106 /* Event Based Branch Registers */
  361. #define NT_PPC_PMU 0x107 /* Performance Monitor Registers */
  362. #define NT_PPC_TM_CGPR 0x108 /* TM checkpointed GPR Registers */
  363. #define NT_PPC_TM_CFPR 0x109 /* TM checkpointed FPR Registers */
  364. #define NT_PPC_TM_CVMX 0x10a /* TM checkpointed VMX Registers */
  365. #define NT_PPC_TM_CVSX 0x10b /* TM checkpointed VSX Registers */
  366. #define NT_PPC_TM_SPR 0x10c /* TM Special Purpose Registers */
  367. #define NT_PPC_TM_CTAR 0x10d /* TM checkpointed Target Address Register */
  368. #define NT_PPC_TM_CPPR 0x10e /* TM checkpointed Program Priority Register */
  369. #define NT_PPC_TM_CDSCR 0x10f /* TM checkpointed Data Stream Control Register */
  370. #define NT_PPC_PKEY 0x110 /* Memory Protection Keys registers */
  371. #define NT_PPC_DEXCR 0x111 /* PowerPC DEXCR registers */
  372. #define NT_PPC_HASHKEYR 0x112 /* PowerPC HASHKEYR register */
  373. #define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
  374. #define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */
  375. #define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */
  376. /* Old binutils treats 0x203 as a CET state */
  377. #define NT_X86_SHSTK 0x204 /* x86 SHSTK state */
  378. #define NT_X86_XSAVE_LAYOUT 0x205 /* XSAVE layout description */
  379. #define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */
  380. #define NT_S390_TIMER 0x301 /* s390 timer register */
  381. #define NT_S390_TODCMP 0x302 /* s390 TOD clock comparator register */
  382. #define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */
  383. #define NT_S390_CTRS 0x304 /* s390 control registers */
  384. #define NT_S390_PREFIX 0x305 /* s390 prefix register */
  385. #define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */
  386. #define NT_S390_SYSTEM_CALL 0x307 /* s390 system call restart data */
  387. #define NT_S390_TDB 0x308 /* s390 transaction diagnostic block */
  388. #define NT_S390_VXRS_LOW 0x309 /* s390 vector registers 0-15 upper half */
  389. #define NT_S390_VXRS_HIGH 0x30a /* s390 vector registers 16-31 */
  390. #define NT_S390_GS_CB 0x30b /* s390 guarded storage registers */
  391. #define NT_S390_GS_BC 0x30c /* s390 guarded storage broadcast control block */
  392. #define NT_S390_RI_CB 0x30d /* s390 runtime instrumentation */
  393. #define NT_S390_PV_CPU_DATA 0x30e /* s390 protvirt cpu dump data */
  394. #define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */
  395. #define NT_ARM_TLS 0x401 /* ARM TLS register */
  396. #define NT_ARM_HW_BREAK 0x402 /* ARM hardware breakpoint registers */
  397. #define NT_ARM_HW_WATCH 0x403 /* ARM hardware watchpoint registers */
  398. #define NT_ARM_SYSTEM_CALL 0x404 /* ARM system call number */
  399. #define NT_ARM_SVE 0x405 /* ARM Scalable Vector Extension registers */
  400. #define NT_ARM_PAC_MASK 0x406 /* ARM pointer authentication code masks */
  401. #define NT_ARM_PACA_KEYS 0x407 /* ARM pointer authentication address keys */
  402. #define NT_ARM_PACG_KEYS 0x408 /* ARM pointer authentication generic key */
  403. #define NT_ARM_TAGGED_ADDR_CTRL 0x409 /* arm64 tagged address control (prctl()) */
  404. #define NT_ARM_PAC_ENABLED_KEYS 0x40a /* arm64 ptr auth enabled keys (prctl()) */
  405. #define NT_ARM_SSVE 0x40b /* ARM Streaming SVE registers */
  406. #define NT_ARM_ZA 0x40c /* ARM SME ZA registers */
  407. #define NT_ARM_ZT 0x40d /* ARM SME ZT registers */
  408. #define NT_ARM_FPMR 0x40e /* ARM floating point mode register */
  409. #define NT_ARM_POE 0x40f /* ARM POE registers */
  410. #define NT_ARM_GCS 0x410 /* ARM GCS state */
  411. #define NT_ARC_V2 0x600 /* ARCv2 accumulator/extra registers */
  412. #define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note */
  413. #define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers */
  414. #define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode */
  415. #define NT_MIPS_MSA 0x802 /* MIPS SIMD registers */
  416. #define NT_RISCV_CSR 0x900 /* RISC-V Control and Status Registers */
  417. #define NT_RISCV_VECTOR 0x901 /* RISC-V vector registers */
  418. #define NT_RISCV_TAGGED_ADDR_CTRL 0x902 /* RISC-V tagged address control (prctl()) */
  419. #define NT_LOONGARCH_CPUCFG 0xa00 /* LoongArch CPU config registers */
  420. #define NT_LOONGARCH_CSR 0xa01 /* LoongArch control and status registers */
  421. #define NT_LOONGARCH_LSX 0xa02 /* LoongArch Loongson SIMD Extension registers */
  422. #define NT_LOONGARCH_LASX 0xa03 /* LoongArch Loongson Advanced SIMD Extension registers */
  423. #define NT_LOONGARCH_LBT 0xa04 /* LoongArch Loongson Binary Translation registers */
  424. #define NT_LOONGARCH_HW_BREAK 0xa05 /* LoongArch hardware breakpoint registers */
  425. #define NT_LOONGARCH_HW_WATCH 0xa06 /* LoongArch hardware watchpoint registers */
  426. /* Note types with note name "GNU" */
  427. #define NT_GNU_PROPERTY_TYPE_0 5
  428. /* Note header in a PT_NOTE section */
  429. typedef struct elf32_note {
  430. Elf32_Word n_namesz; /* Name size */
  431. Elf32_Word n_descsz; /* Content size */
  432. Elf32_Word n_type; /* Content type */
  433. } Elf32_Nhdr;
  434. /* Note header in a PT_NOTE section */
  435. typedef struct elf64_note {
  436. Elf64_Word n_namesz; /* Name size */
  437. Elf64_Word n_descsz; /* Content size */
  438. Elf64_Word n_type; /* Content type */
  439. } Elf64_Nhdr;
  440. /* .note.gnu.property types for EM_AARCH64: */
  441. #define GNU_PROPERTY_AARCH64_FEATURE_1_AND 0xc0000000
  442. /* Bits for GNU_PROPERTY_AARCH64_FEATURE_1_BTI */
  443. #define GNU_PROPERTY_AARCH64_FEATURE_1_BTI (1U << 0)
  444. typedef struct {
  445. Elf32_Half vd_version;
  446. Elf32_Half vd_flags;
  447. Elf32_Half vd_ndx;
  448. Elf32_Half vd_cnt;
  449. Elf32_Word vd_hash;
  450. Elf32_Word vd_aux;
  451. Elf32_Word vd_next;
  452. } Elf32_Verdef;
  453. typedef struct {
  454. Elf64_Half vd_version;
  455. Elf64_Half vd_flags;
  456. Elf64_Half vd_ndx;
  457. Elf64_Half vd_cnt;
  458. Elf64_Word vd_hash;
  459. Elf64_Word vd_aux;
  460. Elf64_Word vd_next;
  461. } Elf64_Verdef;
  462. typedef struct {
  463. Elf32_Word vda_name;
  464. Elf32_Word vda_next;
  465. } Elf32_Verdaux;
  466. typedef struct {
  467. Elf64_Word vda_name;
  468. Elf64_Word vda_next;
  469. } Elf64_Verdaux;
  470. #endif /* _LINUX_ELF_H */