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