Elliott Hughes | 180edef | 2023-11-02 00:08:05 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is auto-generated. Modifications will be lost. |
| 3 | * |
| 4 | * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/ |
| 5 | * for more information. |
| 6 | */ |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 7 | #ifndef _UAPI_LINUX_ELF_H |
| 8 | #define _UAPI_LINUX_ELF_H |
| 9 | #include <linux/types.h> |
| 10 | #include <linux/elf-em.h> |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 11 | typedef __u32 Elf32_Addr; |
| 12 | typedef __u16 Elf32_Half; |
| 13 | typedef __u32 Elf32_Off; |
| 14 | typedef __s32 Elf32_Sword; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 15 | typedef __u32 Elf32_Word; |
| 16 | typedef __u64 Elf64_Addr; |
| 17 | typedef __u16 Elf64_Half; |
| 18 | typedef __s16 Elf64_SHalf; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 19 | typedef __u64 Elf64_Off; |
| 20 | typedef __s32 Elf64_Sword; |
| 21 | typedef __u32 Elf64_Word; |
| 22 | typedef __u64 Elf64_Xword; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 23 | typedef __s64 Elf64_Sxword; |
| 24 | #define PT_NULL 0 |
| 25 | #define PT_LOAD 1 |
| 26 | #define PT_DYNAMIC 2 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 27 | #define PT_INTERP 3 |
| 28 | #define PT_NOTE 4 |
| 29 | #define PT_SHLIB 5 |
| 30 | #define PT_PHDR 6 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 31 | #define PT_TLS 7 |
| 32 | #define PT_LOOS 0x60000000 |
| 33 | #define PT_HIOS 0x6fffffff |
| 34 | #define PT_LOPROC 0x70000000 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 35 | #define PT_HIPROC 0x7fffffff |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 36 | #define PT_GNU_EH_FRAME (PT_LOOS + 0x474e550) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 37 | #define PT_GNU_STACK (PT_LOOS + 0x474e551) |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 38 | #define PT_GNU_RELRO (PT_LOOS + 0x474e552) |
| 39 | #define PT_GNU_PROPERTY (PT_LOOS + 0x474e553) |
| 40 | #define PT_AARCH64_MEMTAG_MTE (PT_LOPROC + 0x2) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 41 | #define PN_XNUM 0xffff |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 42 | #define ET_NONE 0 |
| 43 | #define ET_REL 1 |
| 44 | #define ET_EXEC 2 |
| 45 | #define ET_DYN 3 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 46 | #define ET_CORE 4 |
| 47 | #define ET_LOPROC 0xff00 |
| 48 | #define ET_HIPROC 0xffff |
| 49 | #define DT_NULL 0 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 50 | #define DT_NEEDED 1 |
| 51 | #define DT_PLTRELSZ 2 |
| 52 | #define DT_PLTGOT 3 |
| 53 | #define DT_HASH 4 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 54 | #define DT_STRTAB 5 |
| 55 | #define DT_SYMTAB 6 |
| 56 | #define DT_RELA 7 |
| 57 | #define DT_RELASZ 8 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 58 | #define DT_RELAENT 9 |
| 59 | #define DT_STRSZ 10 |
| 60 | #define DT_SYMENT 11 |
| 61 | #define DT_INIT 12 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 62 | #define DT_FINI 13 |
| 63 | #define DT_SONAME 14 |
| 64 | #define DT_RPATH 15 |
| 65 | #define DT_SYMBOLIC 16 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 66 | #define DT_REL 17 |
| 67 | #define DT_RELSZ 18 |
| 68 | #define DT_RELENT 19 |
| 69 | #define DT_PLTREL 20 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 70 | #define DT_DEBUG 21 |
| 71 | #define DT_TEXTREL 22 |
| 72 | #define DT_JMPREL 23 |
| 73 | #define DT_ENCODING 32 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 74 | #define OLD_DT_LOOS 0x60000000 |
| 75 | #define DT_LOOS 0x6000000d |
| 76 | #define DT_HIOS 0x6ffff000 |
| 77 | #define DT_VALRNGLO 0x6ffffd00 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 78 | #define DT_VALRNGHI 0x6ffffdff |
| 79 | #define DT_ADDRRNGLO 0x6ffffe00 |
| 80 | #define DT_ADDRRNGHI 0x6ffffeff |
| 81 | #define DT_VERSYM 0x6ffffff0 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 82 | #define DT_RELACOUNT 0x6ffffff9 |
| 83 | #define DT_RELCOUNT 0x6ffffffa |
| 84 | #define DT_FLAGS_1 0x6ffffffb |
| 85 | #define DT_VERDEF 0x6ffffffc |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 86 | #define DT_VERDEFNUM 0x6ffffffd |
| 87 | #define DT_VERNEED 0x6ffffffe |
| 88 | #define DT_VERNEEDNUM 0x6fffffff |
| 89 | #define OLD_DT_HIOS 0x6fffffff |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 90 | #define DT_LOPROC 0x70000000 |
| 91 | #define DT_HIPROC 0x7fffffff |
| 92 | #define STB_LOCAL 0 |
| 93 | #define STB_GLOBAL 1 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 94 | #define STB_WEAK 2 |
| 95 | #define STT_NOTYPE 0 |
| 96 | #define STT_OBJECT 1 |
| 97 | #define STT_FUNC 2 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 98 | #define STT_SECTION 3 |
| 99 | #define STT_FILE 4 |
| 100 | #define STT_COMMON 5 |
| 101 | #define STT_TLS 6 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 102 | #define ELF_ST_BIND(x) ((x) >> 4) |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 103 | #define ELF_ST_TYPE(x) ((x) & 0xf) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 104 | #define ELF32_ST_BIND(x) ELF_ST_BIND(x) |
| 105 | #define ELF32_ST_TYPE(x) ELF_ST_TYPE(x) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 106 | #define ELF64_ST_BIND(x) ELF_ST_BIND(x) |
| 107 | #define ELF64_ST_TYPE(x) ELF_ST_TYPE(x) |
Christopher Ferris | 0f79521 | 2024-01-17 14:17:28 -0800 | [diff] [blame] | 108 | typedef struct { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 109 | Elf32_Sword d_tag; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 110 | union { |
| 111 | Elf32_Sword d_val; |
| 112 | Elf32_Addr d_ptr; |
| 113 | } d_un; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 114 | } Elf32_Dyn; |
| 115 | typedef struct { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 116 | Elf64_Sxword d_tag; |
| 117 | union { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 118 | Elf64_Xword d_val; |
| 119 | Elf64_Addr d_ptr; |
| 120 | } d_un; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 121 | } Elf64_Dyn; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 122 | #define ELF32_R_SYM(x) ((x) >> 8) |
| 123 | #define ELF32_R_TYPE(x) ((x) & 0xff) |
| 124 | #define ELF64_R_SYM(i) ((i) >> 32) |
| 125 | #define ELF64_R_TYPE(i) ((i) & 0xffffffff) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 126 | typedef struct elf32_rel { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 127 | Elf32_Addr r_offset; |
| 128 | Elf32_Word r_info; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 129 | } Elf32_Rel; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 130 | typedef struct elf64_rel { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 131 | Elf64_Addr r_offset; |
| 132 | Elf64_Xword r_info; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 133 | } Elf64_Rel; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 134 | typedef struct elf32_rela { |
| 135 | Elf32_Addr r_offset; |
| 136 | Elf32_Word r_info; |
| 137 | Elf32_Sword r_addend; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 138 | } Elf32_Rela; |
| 139 | typedef struct elf64_rela { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 140 | Elf64_Addr r_offset; |
| 141 | Elf64_Xword r_info; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 142 | Elf64_Sxword r_addend; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 143 | } Elf64_Rela; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 144 | typedef struct elf32_sym { |
| 145 | Elf32_Word st_name; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 146 | Elf32_Addr st_value; |
| 147 | Elf32_Word st_size; |
| 148 | unsigned char st_info; |
| 149 | unsigned char st_other; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 150 | Elf32_Half st_shndx; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 151 | } Elf32_Sym; |
| 152 | typedef struct elf64_sym { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 153 | Elf64_Word st_name; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 154 | unsigned char st_info; |
| 155 | unsigned char st_other; |
| 156 | Elf64_Half st_shndx; |
| 157 | Elf64_Addr st_value; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 158 | Elf64_Xword st_size; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 159 | } Elf64_Sym; |
| 160 | #define EI_NIDENT 16 |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 161 | typedef struct elf32_hdr { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 162 | unsigned char e_ident[EI_NIDENT]; |
| 163 | Elf32_Half e_type; |
| 164 | Elf32_Half e_machine; |
| 165 | Elf32_Word e_version; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 166 | Elf32_Addr e_entry; |
| 167 | Elf32_Off e_phoff; |
| 168 | Elf32_Off e_shoff; |
| 169 | Elf32_Word e_flags; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 170 | Elf32_Half e_ehsize; |
| 171 | Elf32_Half e_phentsize; |
| 172 | Elf32_Half e_phnum; |
| 173 | Elf32_Half e_shentsize; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 174 | Elf32_Half e_shnum; |
| 175 | Elf32_Half e_shstrndx; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 176 | } Elf32_Ehdr; |
| 177 | typedef struct elf64_hdr { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 178 | unsigned char e_ident[EI_NIDENT]; |
| 179 | Elf64_Half e_type; |
| 180 | Elf64_Half e_machine; |
| 181 | Elf64_Word e_version; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 182 | Elf64_Addr e_entry; |
| 183 | Elf64_Off e_phoff; |
| 184 | Elf64_Off e_shoff; |
| 185 | Elf64_Word e_flags; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 186 | Elf64_Half e_ehsize; |
| 187 | Elf64_Half e_phentsize; |
| 188 | Elf64_Half e_phnum; |
| 189 | Elf64_Half e_shentsize; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 190 | Elf64_Half e_shnum; |
| 191 | Elf64_Half e_shstrndx; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 192 | } Elf64_Ehdr; |
| 193 | #define PF_R 0x4 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 194 | #define PF_W 0x2 |
| 195 | #define PF_X 0x1 |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 196 | typedef struct elf32_phdr { |
| 197 | Elf32_Word p_type; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 198 | Elf32_Off p_offset; |
| 199 | Elf32_Addr p_vaddr; |
| 200 | Elf32_Addr p_paddr; |
| 201 | Elf32_Word p_filesz; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 202 | Elf32_Word p_memsz; |
| 203 | Elf32_Word p_flags; |
| 204 | Elf32_Word p_align; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 205 | } Elf32_Phdr; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 206 | typedef struct elf64_phdr { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 207 | Elf64_Word p_type; |
| 208 | Elf64_Word p_flags; |
| 209 | Elf64_Off p_offset; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 210 | Elf64_Addr p_vaddr; |
| 211 | Elf64_Addr p_paddr; |
| 212 | Elf64_Xword p_filesz; |
| 213 | Elf64_Xword p_memsz; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 214 | Elf64_Xword p_align; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 215 | } Elf64_Phdr; |
| 216 | #define SHT_NULL 0 |
| 217 | #define SHT_PROGBITS 1 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 218 | #define SHT_SYMTAB 2 |
| 219 | #define SHT_STRTAB 3 |
| 220 | #define SHT_RELA 4 |
| 221 | #define SHT_HASH 5 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 222 | #define SHT_DYNAMIC 6 |
| 223 | #define SHT_NOTE 7 |
| 224 | #define SHT_NOBITS 8 |
| 225 | #define SHT_REL 9 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 226 | #define SHT_SHLIB 10 |
| 227 | #define SHT_DYNSYM 11 |
| 228 | #define SHT_NUM 12 |
| 229 | #define SHT_LOPROC 0x70000000 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 230 | #define SHT_HIPROC 0x7fffffff |
| 231 | #define SHT_LOUSER 0x80000000 |
| 232 | #define SHT_HIUSER 0xffffffff |
| 233 | #define SHF_WRITE 0x1 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 234 | #define SHF_ALLOC 0x2 |
| 235 | #define SHF_EXECINSTR 0x4 |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 236 | #define SHF_RELA_LIVEPATCH 0x00100000 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 237 | #define SHF_RO_AFTER_INIT 0x00200000 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 238 | #define SHF_MASKPROC 0xf0000000 |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 239 | #define SHN_UNDEF 0 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 240 | #define SHN_LORESERVE 0xff00 |
| 241 | #define SHN_LOPROC 0xff00 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 242 | #define SHN_HIPROC 0xff1f |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 243 | #define SHN_LIVEPATCH 0xff20 |
| 244 | #define SHN_ABS 0xfff1 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 245 | #define SHN_COMMON 0xfff2 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 246 | #define SHN_HIRESERVE 0xffff |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 247 | typedef struct elf32_shdr { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 248 | Elf32_Word sh_name; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 249 | Elf32_Word sh_type; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 250 | Elf32_Word sh_flags; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 251 | Elf32_Addr sh_addr; |
| 252 | Elf32_Off sh_offset; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 253 | Elf32_Word sh_size; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 254 | Elf32_Word sh_link; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 255 | Elf32_Word sh_info; |
| 256 | Elf32_Word sh_addralign; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 257 | Elf32_Word sh_entsize; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 258 | } Elf32_Shdr; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 259 | typedef struct elf64_shdr { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 260 | Elf64_Word sh_name; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 261 | Elf64_Word sh_type; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 262 | Elf64_Xword sh_flags; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 263 | Elf64_Addr sh_addr; |
| 264 | Elf64_Off sh_offset; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 265 | Elf64_Xword sh_size; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 266 | Elf64_Word sh_link; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 267 | Elf64_Word sh_info; |
| 268 | Elf64_Xword sh_addralign; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 269 | Elf64_Xword sh_entsize; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 270 | } Elf64_Shdr; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 271 | #define EI_MAG0 0 |
| 272 | #define EI_MAG1 1 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 273 | #define EI_MAG2 2 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 274 | #define EI_MAG3 3 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 275 | #define EI_CLASS 4 |
| 276 | #define EI_DATA 5 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 277 | #define EI_VERSION 6 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 278 | #define EI_OSABI 7 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 279 | #define EI_PAD 8 |
| 280 | #define ELFMAG0 0x7f |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 281 | #define ELFMAG1 'E' |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 282 | #define ELFMAG2 'L' |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 283 | #define ELFMAG3 'F' |
| 284 | #define ELFMAG "\177ELF" |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 285 | #define SELFMAG 4 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 286 | #define ELFCLASSNONE 0 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 287 | #define ELFCLASS32 1 |
| 288 | #define ELFCLASS64 2 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 289 | #define ELFCLASSNUM 3 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 290 | #define ELFDATANONE 0 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 291 | #define ELFDATA2LSB 1 |
| 292 | #define ELFDATA2MSB 2 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 293 | #define EV_NONE 0 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 294 | #define EV_CURRENT 1 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 295 | #define EV_NUM 2 |
| 296 | #define ELFOSABI_NONE 0 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 297 | #define ELFOSABI_LINUX 3 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 298 | #ifndef ELF_OSABI |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 299 | #define ELF_OSABI ELFOSABI_NONE |
| 300 | #endif |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 301 | #define NT_PRSTATUS 1 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 302 | #define NT_PRFPREG 2 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 303 | #define NT_PRPSINFO 3 |
| 304 | #define NT_TASKSTRUCT 4 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 305 | #define NT_AUXV 6 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 306 | #define NT_SIGINFO 0x53494749 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 307 | #define NT_FILE 0x46494c45 |
| 308 | #define NT_PRXFPREG 0x46e62b7f |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 309 | #define NT_PPC_VMX 0x100 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 310 | #define NT_PPC_SPE 0x101 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 311 | #define NT_PPC_VSX 0x102 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 312 | #define NT_PPC_TAR 0x103 |
| 313 | #define NT_PPC_PPR 0x104 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 314 | #define NT_PPC_DSCR 0x105 |
| 315 | #define NT_PPC_EBB 0x106 |
| 316 | #define NT_PPC_PMU 0x107 |
| 317 | #define NT_PPC_TM_CGPR 0x108 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 318 | #define NT_PPC_TM_CFPR 0x109 |
| 319 | #define NT_PPC_TM_CVMX 0x10a |
| 320 | #define NT_PPC_TM_CVSX 0x10b |
| 321 | #define NT_PPC_TM_SPR 0x10c |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 322 | #define NT_PPC_TM_CTAR 0x10d |
| 323 | #define NT_PPC_TM_CPPR 0x10e |
| 324 | #define NT_PPC_TM_CDSCR 0x10f |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 325 | #define NT_PPC_PKEY 0x110 |
Christopher Ferris | 8666d04 | 2023-09-06 14:55:31 -0700 | [diff] [blame] | 326 | #define NT_PPC_DEXCR 0x111 |
| 327 | #define NT_PPC_HASHKEYR 0x112 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 328 | #define NT_386_TLS 0x200 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 329 | #define NT_386_IOPERM 0x201 |
| 330 | #define NT_X86_XSTATE 0x202 |
Christopher Ferris | 67d1e5e | 2023-10-31 13:36:37 -0700 | [diff] [blame] | 331 | #define NT_X86_SHSTK 0x204 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 332 | #define NT_S390_HIGH_GPRS 0x300 |
| 333 | #define NT_S390_TIMER 0x301 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 334 | #define NT_S390_TODCMP 0x302 |
| 335 | #define NT_S390_TODPREG 0x303 |
| 336 | #define NT_S390_CTRS 0x304 |
| 337 | #define NT_S390_PREFIX 0x305 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 338 | #define NT_S390_LAST_BREAK 0x306 |
| 339 | #define NT_S390_SYSTEM_CALL 0x307 |
| 340 | #define NT_S390_TDB 0x308 |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 341 | #define NT_S390_VXRS_LOW 0x309 |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 342 | #define NT_S390_VXRS_HIGH 0x30a |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 343 | #define NT_S390_GS_CB 0x30b |
| 344 | #define NT_S390_GS_BC 0x30c |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 345 | #define NT_S390_RI_CB 0x30d |
Christopher Ferris | 7447a1c | 2022-10-04 18:24:44 -0700 | [diff] [blame] | 346 | #define NT_S390_PV_CPU_DATA 0x30e |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 347 | #define NT_ARM_VFP 0x400 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 348 | #define NT_ARM_TLS 0x401 |
| 349 | #define NT_ARM_HW_BREAK 0x402 |
| 350 | #define NT_ARM_HW_WATCH 0x403 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 351 | #define NT_ARM_SYSTEM_CALL 0x404 |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 352 | #define NT_ARM_SVE 0x405 |
Christopher Ferris | d842e43 | 2019-03-07 10:21:59 -0800 | [diff] [blame] | 353 | #define NT_ARM_PAC_MASK 0x406 |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 354 | #define NT_ARM_PACA_KEYS 0x407 |
| 355 | #define NT_ARM_PACG_KEYS 0x408 |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 356 | #define NT_ARM_TAGGED_ADDR_CTRL 0x409 |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame] | 357 | #define NT_ARM_PAC_ENABLED_KEYS 0x40a |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 358 | #define NT_ARM_SSVE 0x40b |
| 359 | #define NT_ARM_ZA 0x40c |
Christopher Ferris | b7cef6d | 2023-05-09 19:04:15 +0000 | [diff] [blame] | 360 | #define NT_ARM_ZT 0x40d |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 361 | #define NT_ARC_V2 0x600 |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 362 | #define NT_VMCOREDD 0x700 |
| 363 | #define NT_MIPS_DSP 0x800 |
| 364 | #define NT_MIPS_FP_MODE 0x801 |
Christopher Ferris | d842e43 | 2019-03-07 10:21:59 -0800 | [diff] [blame] | 365 | #define NT_MIPS_MSA 0x802 |
Christopher Ferris | 67d1e5e | 2023-10-31 13:36:37 -0700 | [diff] [blame] | 366 | #define NT_RISCV_CSR 0x900 |
| 367 | #define NT_RISCV_VECTOR 0x901 |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 368 | #define NT_LOONGARCH_CPUCFG 0xa00 |
| 369 | #define NT_LOONGARCH_CSR 0xa01 |
| 370 | #define NT_LOONGARCH_LSX 0xa02 |
| 371 | #define NT_LOONGARCH_LASX 0xa03 |
| 372 | #define NT_LOONGARCH_LBT 0xa04 |
Christopher Ferris | b7cef6d | 2023-05-09 19:04:15 +0000 | [diff] [blame] | 373 | #define NT_LOONGARCH_HW_BREAK 0xa05 |
| 374 | #define NT_LOONGARCH_HW_WATCH 0xa06 |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 375 | #define NT_GNU_PROPERTY_TYPE_0 5 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 376 | typedef struct elf32_note { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 377 | Elf32_Word n_namesz; |
| 378 | Elf32_Word n_descsz; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 379 | Elf32_Word n_type; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 380 | } Elf32_Nhdr; |
| 381 | typedef struct elf64_note { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 382 | Elf64_Word n_namesz; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 383 | Elf64_Word n_descsz; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 384 | Elf64_Word n_type; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 385 | } Elf64_Nhdr; |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 386 | #define GNU_PROPERTY_AARCH64_FEATURE_1_AND 0xc0000000 |
| 387 | #define GNU_PROPERTY_AARCH64_FEATURE_1_BTI (1U << 0) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 388 | #endif |