16f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2607ca46eSDavid Howells #ifndef _UAPI_LINUX_ELF_H 3607ca46eSDavid Howells #define _UAPI_LINUX_ELF_H 4607ca46eSDavid Howells 5607ca46eSDavid Howells #include <linux/types.h> 6607ca46eSDavid Howells #include <linux/elf-em.h> 7607ca46eSDavid Howells 8607ca46eSDavid Howells /* 32-bit ELF base types. */ 9607ca46eSDavid Howells typedef __u32 Elf32_Addr; 10607ca46eSDavid Howells typedef __u16 Elf32_Half; 11607ca46eSDavid Howells typedef __u32 Elf32_Off; 12607ca46eSDavid Howells typedef __s32 Elf32_Sword; 13607ca46eSDavid Howells typedef __u32 Elf32_Word; 14607ca46eSDavid Howells 15607ca46eSDavid Howells /* 64-bit ELF base types. */ 16607ca46eSDavid Howells typedef __u64 Elf64_Addr; 17607ca46eSDavid Howells typedef __u16 Elf64_Half; 18607ca46eSDavid Howells typedef __s16 Elf64_SHalf; 19607ca46eSDavid Howells typedef __u64 Elf64_Off; 20607ca46eSDavid Howells typedef __s32 Elf64_Sword; 21607ca46eSDavid Howells typedef __u32 Elf64_Word; 22607ca46eSDavid Howells typedef __u64 Elf64_Xword; 23607ca46eSDavid Howells typedef __s64 Elf64_Sxword; 24607ca46eSDavid Howells 25607ca46eSDavid Howells /* These constants are for the segment types stored in the image headers */ 26607ca46eSDavid Howells #define PT_NULL 0 27607ca46eSDavid Howells #define PT_LOAD 1 28607ca46eSDavid Howells #define PT_DYNAMIC 2 29607ca46eSDavid Howells #define PT_INTERP 3 30607ca46eSDavid Howells #define PT_NOTE 4 31607ca46eSDavid Howells #define PT_SHLIB 5 32607ca46eSDavid Howells #define PT_PHDR 6 33607ca46eSDavid Howells #define PT_TLS 7 /* Thread local storage segment */ 34607ca46eSDavid Howells #define PT_LOOS 0x60000000 /* OS-specific */ 35607ca46eSDavid Howells #define PT_HIOS 0x6fffffff /* OS-specific */ 36607ca46eSDavid Howells #define PT_LOPROC 0x70000000 37607ca46eSDavid Howells #define PT_HIPROC 0x7fffffff 384f0bfdfdSKees Cook #define PT_GNU_EH_FRAME (PT_LOOS + 0x474e550) 39607ca46eSDavid Howells #define PT_GNU_STACK (PT_LOOS + 0x474e551) 404f0bfdfdSKees Cook #define PT_GNU_RELRO (PT_LOOS + 0x474e552) 414f0bfdfdSKees Cook #define PT_GNU_PROPERTY (PT_LOOS + 0x474e553) 424f0bfdfdSKees Cook 43607ca46eSDavid Howells 44761b9b36SCatalin Marinas /* ARM MTE memory tag segment type */ 45c35fe2a6SCatalin Marinas #define PT_AARCH64_MEMTAG_MTE (PT_LOPROC + 0x2) 46761b9b36SCatalin Marinas 47607ca46eSDavid Howells /* 48607ca46eSDavid Howells * Extended Numbering 49607ca46eSDavid Howells * 50607ca46eSDavid Howells * If the real number of program header table entries is larger than 51607ca46eSDavid Howells * or equal to PN_XNUM(0xffff), it is set to sh_info field of the 52607ca46eSDavid Howells * section header at index 0, and PN_XNUM is set to e_phnum 53607ca46eSDavid Howells * field. Otherwise, the section header at index 0 is zero 54607ca46eSDavid Howells * initialized, if it exists. 55607ca46eSDavid Howells * 56607ca46eSDavid Howells * Specifications are available in: 57607ca46eSDavid Howells * 58242260fbSChristian Kujau * - Oracle: Linker and Libraries. 59242260fbSChristian Kujau * Part No: 817–1984–19, August 2011. 607f317d34SAlexander A. Klimov * https://docs.oracle.com/cd/E18752_01/pdf/817-1984.pdf 61607ca46eSDavid Howells * 62607ca46eSDavid Howells * - System V ABI AMD64 Architecture Processor Supplement 63242260fbSChristian Kujau * Draft Version 0.99.4, 64242260fbSChristian Kujau * January 13, 2010. 65242260fbSChristian Kujau * http://www.cs.washington.edu/education/courses/cse351/12wi/supp-docs/abi.pdf 66607ca46eSDavid Howells */ 67607ca46eSDavid Howells #define PN_XNUM 0xffff 68607ca46eSDavid Howells 69607ca46eSDavid Howells /* These constants define the different elf file types */ 70607ca46eSDavid Howells #define ET_NONE 0 71607ca46eSDavid Howells #define ET_REL 1 72607ca46eSDavid Howells #define ET_EXEC 2 73607ca46eSDavid Howells #define ET_DYN 3 74607ca46eSDavid Howells #define ET_CORE 4 75607ca46eSDavid Howells #define ET_LOPROC 0xff00 76607ca46eSDavid Howells #define ET_HIPROC 0xffff 77607ca46eSDavid Howells 78607ca46eSDavid Howells /* This is the info that is needed to parse the dynamic section of the file */ 79607ca46eSDavid Howells #define DT_NULL 0 80607ca46eSDavid Howells #define DT_NEEDED 1 81607ca46eSDavid Howells #define DT_PLTRELSZ 2 82607ca46eSDavid Howells #define DT_PLTGOT 3 83607ca46eSDavid Howells #define DT_HASH 4 84607ca46eSDavid Howells #define DT_STRTAB 5 85607ca46eSDavid Howells #define DT_SYMTAB 6 86607ca46eSDavid Howells #define DT_RELA 7 87607ca46eSDavid Howells #define DT_RELASZ 8 88607ca46eSDavid Howells #define DT_RELAENT 9 89607ca46eSDavid Howells #define DT_STRSZ 10 90607ca46eSDavid Howells #define DT_SYMENT 11 91607ca46eSDavid Howells #define DT_INIT 12 92607ca46eSDavid Howells #define DT_FINI 13 93607ca46eSDavid Howells #define DT_SONAME 14 94607ca46eSDavid Howells #define DT_RPATH 15 95607ca46eSDavid Howells #define DT_SYMBOLIC 16 96607ca46eSDavid Howells #define DT_REL 17 97607ca46eSDavid Howells #define DT_RELSZ 18 98607ca46eSDavid Howells #define DT_RELENT 19 99607ca46eSDavid Howells #define DT_PLTREL 20 100607ca46eSDavid Howells #define DT_DEBUG 21 101607ca46eSDavid Howells #define DT_TEXTREL 22 102607ca46eSDavid Howells #define DT_JMPREL 23 103607ca46eSDavid Howells #define DT_ENCODING 32 104607ca46eSDavid Howells #define OLD_DT_LOOS 0x60000000 105607ca46eSDavid Howells #define DT_LOOS 0x6000000d 106607ca46eSDavid Howells #define DT_HIOS 0x6ffff000 107607ca46eSDavid Howells #define DT_VALRNGLO 0x6ffffd00 108607ca46eSDavid Howells #define DT_VALRNGHI 0x6ffffdff 109607ca46eSDavid Howells #define DT_ADDRRNGLO 0x6ffffe00 110607ca46eSDavid Howells #define DT_ADDRRNGHI 0x6ffffeff 111607ca46eSDavid Howells #define DT_VERSYM 0x6ffffff0 112607ca46eSDavid Howells #define DT_RELACOUNT 0x6ffffff9 113607ca46eSDavid Howells #define DT_RELCOUNT 0x6ffffffa 114607ca46eSDavid Howells #define DT_FLAGS_1 0x6ffffffb 115607ca46eSDavid Howells #define DT_VERDEF 0x6ffffffc 116607ca46eSDavid Howells #define DT_VERDEFNUM 0x6ffffffd 117607ca46eSDavid Howells #define DT_VERNEED 0x6ffffffe 118607ca46eSDavid Howells #define DT_VERNEEDNUM 0x6fffffff 119607ca46eSDavid Howells #define OLD_DT_HIOS 0x6fffffff 120607ca46eSDavid Howells #define DT_LOPROC 0x70000000 121607ca46eSDavid Howells #define DT_HIPROC 0x7fffffff 122607ca46eSDavid Howells 123607ca46eSDavid Howells /* This info is needed when parsing the symbol table */ 124607ca46eSDavid Howells #define STB_LOCAL 0 125607ca46eSDavid Howells #define STB_GLOBAL 1 126607ca46eSDavid Howells #define STB_WEAK 2 127607ca46eSDavid Howells 128607ca46eSDavid Howells #define STT_NOTYPE 0 129607ca46eSDavid Howells #define STT_OBJECT 1 130607ca46eSDavid Howells #define STT_FUNC 2 131607ca46eSDavid Howells #define STT_SECTION 3 132607ca46eSDavid Howells #define STT_FILE 4 133607ca46eSDavid Howells #define STT_COMMON 5 134607ca46eSDavid Howells #define STT_TLS 6 135607ca46eSDavid Howells 136607ca46eSDavid Howells #define ELF_ST_BIND(x) ((x) >> 4) 137c9b516f1SAlexey Dobriyan #define ELF_ST_TYPE(x) ((x) & 0xf) 138607ca46eSDavid Howells #define ELF32_ST_BIND(x) ELF_ST_BIND(x) 139607ca46eSDavid Howells #define ELF32_ST_TYPE(x) ELF_ST_TYPE(x) 140607ca46eSDavid Howells #define ELF64_ST_BIND(x) ELF_ST_BIND(x) 141607ca46eSDavid Howells #define ELF64_ST_TYPE(x) ELF_ST_TYPE(x) 142607ca46eSDavid Howells 143607ca46eSDavid Howells typedef struct dynamic { 144607ca46eSDavid Howells Elf32_Sword d_tag; 145607ca46eSDavid Howells union { 146607ca46eSDavid Howells Elf32_Sword d_val; 147607ca46eSDavid Howells Elf32_Addr d_ptr; 148607ca46eSDavid Howells } d_un; 149607ca46eSDavid Howells } Elf32_Dyn; 150607ca46eSDavid Howells 151607ca46eSDavid Howells typedef struct { 152607ca46eSDavid Howells Elf64_Sxword d_tag; /* entry tag value */ 153607ca46eSDavid Howells union { 154607ca46eSDavid Howells Elf64_Xword d_val; 155607ca46eSDavid Howells Elf64_Addr d_ptr; 156607ca46eSDavid Howells } d_un; 157607ca46eSDavid Howells } Elf64_Dyn; 158607ca46eSDavid Howells 159607ca46eSDavid Howells /* The following are used with relocations */ 160607ca46eSDavid Howells #define ELF32_R_SYM(x) ((x) >> 8) 161607ca46eSDavid Howells #define ELF32_R_TYPE(x) ((x) & 0xff) 162607ca46eSDavid Howells 163607ca46eSDavid Howells #define ELF64_R_SYM(i) ((i) >> 32) 164607ca46eSDavid Howells #define ELF64_R_TYPE(i) ((i) & 0xffffffff) 165607ca46eSDavid Howells 166607ca46eSDavid Howells typedef struct elf32_rel { 167607ca46eSDavid Howells Elf32_Addr r_offset; 168607ca46eSDavid Howells Elf32_Word r_info; 169607ca46eSDavid Howells } Elf32_Rel; 170607ca46eSDavid Howells 171607ca46eSDavid Howells typedef struct elf64_rel { 172607ca46eSDavid Howells Elf64_Addr r_offset; /* Location at which to apply the action */ 173607ca46eSDavid Howells Elf64_Xword r_info; /* index and type of relocation */ 174607ca46eSDavid Howells } Elf64_Rel; 175607ca46eSDavid Howells 176607ca46eSDavid Howells typedef struct elf32_rela { 177607ca46eSDavid Howells Elf32_Addr r_offset; 178607ca46eSDavid Howells Elf32_Word r_info; 179607ca46eSDavid Howells Elf32_Sword r_addend; 180607ca46eSDavid Howells } Elf32_Rela; 181607ca46eSDavid Howells 182607ca46eSDavid Howells typedef struct elf64_rela { 183607ca46eSDavid Howells Elf64_Addr r_offset; /* Location at which to apply the action */ 184607ca46eSDavid Howells Elf64_Xword r_info; /* index and type of relocation */ 185607ca46eSDavid Howells Elf64_Sxword r_addend; /* Constant addend used to compute value */ 186607ca46eSDavid Howells } Elf64_Rela; 187607ca46eSDavid Howells 188607ca46eSDavid Howells typedef struct elf32_sym { 189607ca46eSDavid Howells Elf32_Word st_name; 190607ca46eSDavid Howells Elf32_Addr st_value; 191607ca46eSDavid Howells Elf32_Word st_size; 192607ca46eSDavid Howells unsigned char st_info; 193607ca46eSDavid Howells unsigned char st_other; 194607ca46eSDavid Howells Elf32_Half st_shndx; 195607ca46eSDavid Howells } Elf32_Sym; 196607ca46eSDavid Howells 197607ca46eSDavid Howells typedef struct elf64_sym { 198607ca46eSDavid Howells Elf64_Word st_name; /* Symbol name, index in string tbl */ 199607ca46eSDavid Howells unsigned char st_info; /* Type and binding attributes */ 200607ca46eSDavid Howells unsigned char st_other; /* No defined meaning, 0 */ 201607ca46eSDavid Howells Elf64_Half st_shndx; /* Associated section index */ 202607ca46eSDavid Howells Elf64_Addr st_value; /* Value of the symbol */ 203607ca46eSDavid Howells Elf64_Xword st_size; /* Associated symbol size */ 204607ca46eSDavid Howells } Elf64_Sym; 205607ca46eSDavid Howells 206607ca46eSDavid Howells 207607ca46eSDavid Howells #define EI_NIDENT 16 208607ca46eSDavid Howells 209607ca46eSDavid Howells typedef struct elf32_hdr { 210607ca46eSDavid Howells unsigned char e_ident[EI_NIDENT]; 211607ca46eSDavid Howells Elf32_Half e_type; 212607ca46eSDavid Howells Elf32_Half e_machine; 213607ca46eSDavid Howells Elf32_Word e_version; 214607ca46eSDavid Howells Elf32_Addr e_entry; /* Entry point */ 215607ca46eSDavid Howells Elf32_Off e_phoff; 216607ca46eSDavid Howells Elf32_Off e_shoff; 217607ca46eSDavid Howells Elf32_Word e_flags; 218607ca46eSDavid Howells Elf32_Half e_ehsize; 219607ca46eSDavid Howells Elf32_Half e_phentsize; 220607ca46eSDavid Howells Elf32_Half e_phnum; 221607ca46eSDavid Howells Elf32_Half e_shentsize; 222607ca46eSDavid Howells Elf32_Half e_shnum; 223607ca46eSDavid Howells Elf32_Half e_shstrndx; 224607ca46eSDavid Howells } Elf32_Ehdr; 225607ca46eSDavid Howells 226607ca46eSDavid Howells typedef struct elf64_hdr { 227607ca46eSDavid Howells unsigned char e_ident[EI_NIDENT]; /* ELF "magic number" */ 228607ca46eSDavid Howells Elf64_Half e_type; 229607ca46eSDavid Howells Elf64_Half e_machine; 230607ca46eSDavid Howells Elf64_Word e_version; 231607ca46eSDavid Howells Elf64_Addr e_entry; /* Entry point virtual address */ 232607ca46eSDavid Howells Elf64_Off e_phoff; /* Program header table file offset */ 233607ca46eSDavid Howells Elf64_Off e_shoff; /* Section header table file offset */ 234607ca46eSDavid Howells Elf64_Word e_flags; 235607ca46eSDavid Howells Elf64_Half e_ehsize; 236607ca46eSDavid Howells Elf64_Half e_phentsize; 237607ca46eSDavid Howells Elf64_Half e_phnum; 238607ca46eSDavid Howells Elf64_Half e_shentsize; 239607ca46eSDavid Howells Elf64_Half e_shnum; 240607ca46eSDavid Howells Elf64_Half e_shstrndx; 241607ca46eSDavid Howells } Elf64_Ehdr; 242607ca46eSDavid Howells 243607ca46eSDavid Howells /* These constants define the permissions on sections in the program 244607ca46eSDavid Howells header, p_flags. */ 245607ca46eSDavid Howells #define PF_R 0x4 246607ca46eSDavid Howells #define PF_W 0x2 247607ca46eSDavid Howells #define PF_X 0x1 248607ca46eSDavid Howells 249607ca46eSDavid Howells typedef struct elf32_phdr { 250607ca46eSDavid Howells Elf32_Word p_type; 251607ca46eSDavid Howells Elf32_Off p_offset; 252607ca46eSDavid Howells Elf32_Addr p_vaddr; 253607ca46eSDavid Howells Elf32_Addr p_paddr; 254607ca46eSDavid Howells Elf32_Word p_filesz; 255607ca46eSDavid Howells Elf32_Word p_memsz; 256607ca46eSDavid Howells Elf32_Word p_flags; 257607ca46eSDavid Howells Elf32_Word p_align; 258607ca46eSDavid Howells } Elf32_Phdr; 259607ca46eSDavid Howells 260607ca46eSDavid Howells typedef struct elf64_phdr { 261607ca46eSDavid Howells Elf64_Word p_type; 262607ca46eSDavid Howells Elf64_Word p_flags; 263607ca46eSDavid Howells Elf64_Off p_offset; /* Segment file offset */ 264607ca46eSDavid Howells Elf64_Addr p_vaddr; /* Segment virtual address */ 265607ca46eSDavid Howells Elf64_Addr p_paddr; /* Segment physical address */ 266607ca46eSDavid Howells Elf64_Xword p_filesz; /* Segment size in file */ 267607ca46eSDavid Howells Elf64_Xword p_memsz; /* Segment size in memory */ 268607ca46eSDavid Howells Elf64_Xword p_align; /* Segment alignment, file & memory */ 269607ca46eSDavid Howells } Elf64_Phdr; 270607ca46eSDavid Howells 271607ca46eSDavid Howells /* sh_type */ 272607ca46eSDavid Howells #define SHT_NULL 0 273607ca46eSDavid Howells #define SHT_PROGBITS 1 274607ca46eSDavid Howells #define SHT_SYMTAB 2 275607ca46eSDavid Howells #define SHT_STRTAB 3 276607ca46eSDavid Howells #define SHT_RELA 4 277607ca46eSDavid Howells #define SHT_HASH 5 278607ca46eSDavid Howells #define SHT_DYNAMIC 6 279607ca46eSDavid Howells #define SHT_NOTE 7 280607ca46eSDavid Howells #define SHT_NOBITS 8 281607ca46eSDavid Howells #define SHT_REL 9 282607ca46eSDavid Howells #define SHT_SHLIB 10 283607ca46eSDavid Howells #define SHT_DYNSYM 11 284607ca46eSDavid Howells #define SHT_NUM 12 285607ca46eSDavid Howells #define SHT_LOPROC 0x70000000 286607ca46eSDavid Howells #define SHT_HIPROC 0x7fffffff 287607ca46eSDavid Howells #define SHT_LOUSER 0x80000000 288607ca46eSDavid Howells #define SHT_HIUSER 0xffffffff 289607ca46eSDavid Howells 290607ca46eSDavid Howells /* sh_flags */ 291607ca46eSDavid Howells #define SHF_WRITE 0x1 292607ca46eSDavid Howells #define SHF_ALLOC 0x2 293607ca46eSDavid Howells #define SHF_EXECINSTR 0x4 2948d98e96bSJessica Yu #define SHF_RELA_LIVEPATCH 0x00100000 295444d13ffSJessica Yu #define SHF_RO_AFTER_INIT 0x00200000 296607ca46eSDavid Howells #define SHF_MASKPROC 0xf0000000 297607ca46eSDavid Howells 298607ca46eSDavid Howells /* special section indexes */ 299607ca46eSDavid Howells #define SHN_UNDEF 0 300607ca46eSDavid Howells #define SHN_LORESERVE 0xff00 301607ca46eSDavid Howells #define SHN_LOPROC 0xff00 302607ca46eSDavid Howells #define SHN_HIPROC 0xff1f 3038d98e96bSJessica Yu #define SHN_LIVEPATCH 0xff20 304607ca46eSDavid Howells #define SHN_ABS 0xfff1 305607ca46eSDavid Howells #define SHN_COMMON 0xfff2 306607ca46eSDavid Howells #define SHN_HIRESERVE 0xffff 307607ca46eSDavid Howells 308607ca46eSDavid Howells typedef struct elf32_shdr { 309607ca46eSDavid Howells Elf32_Word sh_name; 310607ca46eSDavid Howells Elf32_Word sh_type; 311607ca46eSDavid Howells Elf32_Word sh_flags; 312607ca46eSDavid Howells Elf32_Addr sh_addr; 313607ca46eSDavid Howells Elf32_Off sh_offset; 314607ca46eSDavid Howells Elf32_Word sh_size; 315607ca46eSDavid Howells Elf32_Word sh_link; 316607ca46eSDavid Howells Elf32_Word sh_info; 317607ca46eSDavid Howells Elf32_Word sh_addralign; 318607ca46eSDavid Howells Elf32_Word sh_entsize; 319607ca46eSDavid Howells } Elf32_Shdr; 320607ca46eSDavid Howells 321607ca46eSDavid Howells typedef struct elf64_shdr { 322607ca46eSDavid Howells Elf64_Word sh_name; /* Section name, index in string tbl */ 323607ca46eSDavid Howells Elf64_Word sh_type; /* Type of section */ 324607ca46eSDavid Howells Elf64_Xword sh_flags; /* Miscellaneous section attributes */ 325607ca46eSDavid Howells Elf64_Addr sh_addr; /* Section virtual addr at execution */ 326607ca46eSDavid Howells Elf64_Off sh_offset; /* Section file offset */ 327607ca46eSDavid Howells Elf64_Xword sh_size; /* Size of section in bytes */ 328607ca46eSDavid Howells Elf64_Word sh_link; /* Index of another section */ 329607ca46eSDavid Howells Elf64_Word sh_info; /* Additional section information */ 330607ca46eSDavid Howells Elf64_Xword sh_addralign; /* Section alignment */ 331607ca46eSDavid Howells Elf64_Xword sh_entsize; /* Entry size if section holds table */ 332607ca46eSDavid Howells } Elf64_Shdr; 333607ca46eSDavid Howells 334607ca46eSDavid Howells #define EI_MAG0 0 /* e_ident[] indexes */ 335607ca46eSDavid Howells #define EI_MAG1 1 336607ca46eSDavid Howells #define EI_MAG2 2 337607ca46eSDavid Howells #define EI_MAG3 3 338607ca46eSDavid Howells #define EI_CLASS 4 339607ca46eSDavid Howells #define EI_DATA 5 340607ca46eSDavid Howells #define EI_VERSION 6 341607ca46eSDavid Howells #define EI_OSABI 7 342607ca46eSDavid Howells #define EI_PAD 8 343607ca46eSDavid Howells 344607ca46eSDavid Howells #define ELFMAG0 0x7f /* EI_MAG */ 345607ca46eSDavid Howells #define ELFMAG1 'E' 346607ca46eSDavid Howells #define ELFMAG2 'L' 347607ca46eSDavid Howells #define ELFMAG3 'F' 348607ca46eSDavid Howells #define ELFMAG "\177ELF" 349607ca46eSDavid Howells #define SELFMAG 4 350607ca46eSDavid Howells 351607ca46eSDavid Howells #define ELFCLASSNONE 0 /* EI_CLASS */ 352607ca46eSDavid Howells #define ELFCLASS32 1 353607ca46eSDavid Howells #define ELFCLASS64 2 354607ca46eSDavid Howells #define ELFCLASSNUM 3 355607ca46eSDavid Howells 356607ca46eSDavid Howells #define ELFDATANONE 0 /* e_ident[EI_DATA] */ 357607ca46eSDavid Howells #define ELFDATA2LSB 1 358607ca46eSDavid Howells #define ELFDATA2MSB 2 359607ca46eSDavid Howells 360607ca46eSDavid Howells #define EV_NONE 0 /* e_version, EI_VERSION */ 361607ca46eSDavid Howells #define EV_CURRENT 1 362607ca46eSDavid Howells #define EV_NUM 2 363607ca46eSDavid Howells 364607ca46eSDavid Howells #define ELFOSABI_NONE 0 365607ca46eSDavid Howells #define ELFOSABI_LINUX 3 366607ca46eSDavid Howells 367607ca46eSDavid Howells #ifndef ELF_OSABI 368607ca46eSDavid Howells #define ELF_OSABI ELFOSABI_NONE 369607ca46eSDavid Howells #endif 370607ca46eSDavid Howells 371607ca46eSDavid Howells /* 372607ca46eSDavid Howells * Notes used in ET_CORE. Architectures export some of the arch register sets 373607ca46eSDavid Howells * using the corresponding note types via the PTRACE_GETREGSET and 374607ca46eSDavid Howells * PTRACE_SETREGSET requests. 3750b3d4127SBaruch Siach * The note name for these types is "LINUX", except NT_PRFPREG that is named 3760b3d4127SBaruch Siach * "CORE". 377607ca46eSDavid Howells */ 378607ca46eSDavid Howells #define NT_PRSTATUS 1 379607ca46eSDavid Howells #define NT_PRFPREG 2 380607ca46eSDavid Howells #define NT_PRPSINFO 3 381607ca46eSDavid Howells #define NT_TASKSTRUCT 4 382607ca46eSDavid Howells #define NT_AUXV 6 383607ca46eSDavid Howells /* 384607ca46eSDavid Howells * Note to userspace developers: size of NT_SIGINFO note may increase 385607ca46eSDavid Howells * in the future to accomodate more fields, don't assume it is fixed! 386607ca46eSDavid Howells */ 387607ca46eSDavid Howells #define NT_SIGINFO 0x53494749 388607ca46eSDavid Howells #define NT_FILE 0x46494c45 389607ca46eSDavid Howells #define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */ 390607ca46eSDavid Howells #define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ 391607ca46eSDavid Howells #define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ 392607ca46eSDavid Howells #define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ 3930dc696bcSAnshuman Khandual #define NT_PPC_TAR 0x103 /* Target Address Register */ 3940dc696bcSAnshuman Khandual #define NT_PPC_PPR 0x104 /* Program Priority Register */ 3950dc696bcSAnshuman Khandual #define NT_PPC_DSCR 0x105 /* Data Stream Control Register */ 3960dc696bcSAnshuman Khandual #define NT_PPC_EBB 0x106 /* Event Based Branch Registers */ 3970dc696bcSAnshuman Khandual #define NT_PPC_PMU 0x107 /* Performance Monitor Registers */ 3980dc696bcSAnshuman Khandual #define NT_PPC_TM_CGPR 0x108 /* TM checkpointed GPR Registers */ 3990dc696bcSAnshuman Khandual #define NT_PPC_TM_CFPR 0x109 /* TM checkpointed FPR Registers */ 4000dc696bcSAnshuman Khandual #define NT_PPC_TM_CVMX 0x10a /* TM checkpointed VMX Registers */ 4010dc696bcSAnshuman Khandual #define NT_PPC_TM_CVSX 0x10b /* TM checkpointed VSX Registers */ 4020dc696bcSAnshuman Khandual #define NT_PPC_TM_SPR 0x10c /* TM Special Purpose Registers */ 4030dc696bcSAnshuman Khandual #define NT_PPC_TM_CTAR 0x10d /* TM checkpointed Target Address Register */ 4040dc696bcSAnshuman Khandual #define NT_PPC_TM_CPPR 0x10e /* TM checkpointed Program Priority Register */ 4050dc696bcSAnshuman Khandual #define NT_PPC_TM_CDSCR 0x10f /* TM checkpointed Data Stream Control Register */ 406c5cc1f4dSThiago Jung Bauermann #define NT_PPC_PKEY 0x110 /* Memory Protection Keys registers */ 407884ad5c5SBenjamin Gray #define NT_PPC_DEXCR 0x111 /* PowerPC DEXCR registers */ 40897228ca3SBenjamin Gray #define NT_PPC_HASHKEYR 0x112 /* PowerPC HASHKEYR register */ 409607ca46eSDavid Howells #define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ 410607ca46eSDavid Howells #define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ 411607ca46eSDavid Howells #define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */ 4122fab02b2SRick Edgecombe /* Old binutils treats 0x203 as a CET state */ 4132fab02b2SRick Edgecombe #define NT_X86_SHSTK 0x204 /* x86 SHSTK state */ 414607ca46eSDavid Howells #define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */ 415607ca46eSDavid Howells #define NT_S390_TIMER 0x301 /* s390 timer register */ 416607ca46eSDavid Howells #define NT_S390_TODCMP 0x302 /* s390 TOD clock comparator register */ 417607ca46eSDavid Howells #define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */ 418607ca46eSDavid Howells #define NT_S390_CTRS 0x304 /* s390 control registers */ 419607ca46eSDavid Howells #define NT_S390_PREFIX 0x305 /* s390 prefix register */ 420607ca46eSDavid Howells #define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */ 421607ca46eSDavid Howells #define NT_S390_SYSTEM_CALL 0x307 /* s390 system call restart data */ 422607ca46eSDavid Howells #define NT_S390_TDB 0x308 /* s390 transaction diagnostic block */ 42380703617SMartin Schwidefsky #define NT_S390_VXRS_LOW 0x309 /* s390 vector registers 0-15 upper half */ 42480703617SMartin Schwidefsky #define NT_S390_VXRS_HIGH 0x30a /* s390 vector registers 16-31 */ 425916cda1aSMartin Schwidefsky #define NT_S390_GS_CB 0x30b /* s390 guarded storage registers */ 426e525f8a6SMartin Schwidefsky #define NT_S390_GS_BC 0x30c /* s390 guarded storage broadcast control block */ 427262832bcSAlice Frosi #define NT_S390_RI_CB 0x30d /* s390 runtime instrumentation */ 428a0c0c44eSJanosch Frank #define NT_S390_PV_CPU_DATA 0x30e /* s390 protvirt cpu dump data */ 429607ca46eSDavid Howells #define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */ 430607ca46eSDavid Howells #define NT_ARM_TLS 0x401 /* ARM TLS register */ 431607ca46eSDavid Howells #define NT_ARM_HW_BREAK 0x402 /* ARM hardware breakpoint registers */ 432607ca46eSDavid Howells #define NT_ARM_HW_WATCH 0x403 /* ARM hardware watchpoint registers */ 433766a85d7SAKASHI Takahiro #define NT_ARM_SYSTEM_CALL 0x404 /* ARM system call number */ 43443d4da2cSDave Martin #define NT_ARM_SVE 0x405 /* ARM Scalable Vector Extension registers */ 435ec6e822dSMark Rutland #define NT_ARM_PAC_MASK 0x406 /* ARM pointer authentication code masks */ 436d0a060beSKristina Martsenko #define NT_ARM_PACA_KEYS 0x407 /* ARM pointer authentication address keys */ 437d0a060beSKristina Martsenko #define NT_ARM_PACG_KEYS 0x408 /* ARM pointer authentication generic key */ 4382200aa71SCatalin Marinas #define NT_ARM_TAGGED_ADDR_CTRL 0x409 /* arm64 tagged address control (prctl()) */ 43920169862SPeter Collingbourne #define NT_ARM_PAC_ENABLED_KEYS 0x40a /* arm64 ptr auth enabled keys (prctl()) */ 440e12310a0SMark Brown #define NT_ARM_SSVE 0x40b /* ARM Streaming SVE registers */ 441776b4a1cSMark Brown #define NT_ARM_ZA 0x40c /* ARM SME ZA registers */ 442f90b529bSMark Brown #define NT_ARM_ZT 0x40d /* ARM SME ZT registers */ 443991c7ed6SVineet Gupta #define NT_ARC_V2 0x600 /* ARCv2 accumulator/extra registers */ 4442724273eSRahul Lakkireddy #define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note */ 44544109c60SMaciej W. Rozycki #define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers */ 4461ae22a0eSMaciej W. Rozycki #define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode */ 4473cd64083SPaul Burton #define NT_MIPS_MSA 0x802 /* MIPS SIMD registers */ 448*9300f004SAndy Chiu #define NT_RISCV_CSR 0x900 /* RISC-V Control and Status Registers */ 449*9300f004SAndy Chiu #define NT_RISCV_VECTOR 0x901 /* RISC-V vector registers */ 45008145b08SHuacai Chen #define NT_LOONGARCH_CPUCFG 0xa00 /* LoongArch CPU config registers */ 45108145b08SHuacai Chen #define NT_LOONGARCH_CSR 0xa01 /* LoongArch control and status registers */ 45208145b08SHuacai Chen #define NT_LOONGARCH_LSX 0xa02 /* LoongArch Loongson SIMD Extension registers */ 45308145b08SHuacai Chen #define NT_LOONGARCH_LASX 0xa03 /* LoongArch Loongson Advanced SIMD Extension registers */ 45408145b08SHuacai Chen #define NT_LOONGARCH_LBT 0xa04 /* LoongArch Loongson Binary Translation registers */ 4551a69f7a1SQing Zhang #define NT_LOONGARCH_HW_BREAK 0xa05 /* LoongArch hardware breakpoint registers */ 4561a69f7a1SQing Zhang #define NT_LOONGARCH_HW_WATCH 0xa06 /* LoongArch hardware watchpoint registers */ 457607ca46eSDavid Howells 45800e19ceeSDave Martin /* Note types with note name "GNU" */ 45900e19ceeSDave Martin #define NT_GNU_PROPERTY_TYPE_0 5 46000e19ceeSDave Martin 461607ca46eSDavid Howells /* Note header in a PT_NOTE section */ 462607ca46eSDavid Howells typedef struct elf32_note { 463607ca46eSDavid Howells Elf32_Word n_namesz; /* Name size */ 464607ca46eSDavid Howells Elf32_Word n_descsz; /* Content size */ 465607ca46eSDavid Howells Elf32_Word n_type; /* Content type */ 466607ca46eSDavid Howells } Elf32_Nhdr; 467607ca46eSDavid Howells 468607ca46eSDavid Howells /* Note header in a PT_NOTE section */ 469607ca46eSDavid Howells typedef struct elf64_note { 470607ca46eSDavid Howells Elf64_Word n_namesz; /* Name size */ 471607ca46eSDavid Howells Elf64_Word n_descsz; /* Content size */ 472607ca46eSDavid Howells Elf64_Word n_type; /* Content type */ 473607ca46eSDavid Howells } Elf64_Nhdr; 474607ca46eSDavid Howells 475ab7876a9SDave Martin /* .note.gnu.property types for EM_AARCH64: */ 476ab7876a9SDave Martin #define GNU_PROPERTY_AARCH64_FEATURE_1_AND 0xc0000000 477ab7876a9SDave Martin 478ab7876a9SDave Martin /* Bits for GNU_PROPERTY_AARCH64_FEATURE_1_BTI */ 479ab7876a9SDave Martin #define GNU_PROPERTY_AARCH64_FEATURE_1_BTI (1U << 0) 480ab7876a9SDave Martin 481607ca46eSDavid Howells #endif /* _UAPI_LINUX_ELF_H */ 482