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 38*4f0bfdfdSKees Cook #define PT_GNU_EH_FRAME (PT_LOOS + 0x474e550) 39607ca46eSDavid Howells #define PT_GNU_STACK (PT_LOOS + 0x474e551) 40*4f0bfdfdSKees Cook #define PT_GNU_RELRO (PT_LOOS + 0x474e552) 41*4f0bfdfdSKees Cook #define PT_GNU_PROPERTY (PT_LOOS + 0x474e553) 42*4f0bfdfdSKees Cook 43607ca46eSDavid Howells 44607ca46eSDavid Howells /* 45607ca46eSDavid Howells * Extended Numbering 46607ca46eSDavid Howells * 47607ca46eSDavid Howells * If the real number of program header table entries is larger than 48607ca46eSDavid Howells * or equal to PN_XNUM(0xffff), it is set to sh_info field of the 49607ca46eSDavid Howells * section header at index 0, and PN_XNUM is set to e_phnum 50607ca46eSDavid Howells * field. Otherwise, the section header at index 0 is zero 51607ca46eSDavid Howells * initialized, if it exists. 52607ca46eSDavid Howells * 53607ca46eSDavid Howells * Specifications are available in: 54607ca46eSDavid Howells * 55242260fbSChristian Kujau * - Oracle: Linker and Libraries. 56242260fbSChristian Kujau * Part No: 817–1984–19, August 2011. 577f317d34SAlexander A. Klimov * https://docs.oracle.com/cd/E18752_01/pdf/817-1984.pdf 58607ca46eSDavid Howells * 59607ca46eSDavid Howells * - System V ABI AMD64 Architecture Processor Supplement 60242260fbSChristian Kujau * Draft Version 0.99.4, 61242260fbSChristian Kujau * January 13, 2010. 62242260fbSChristian Kujau * http://www.cs.washington.edu/education/courses/cse351/12wi/supp-docs/abi.pdf 63607ca46eSDavid Howells */ 64607ca46eSDavid Howells #define PN_XNUM 0xffff 65607ca46eSDavid Howells 66607ca46eSDavid Howells /* These constants define the different elf file types */ 67607ca46eSDavid Howells #define ET_NONE 0 68607ca46eSDavid Howells #define ET_REL 1 69607ca46eSDavid Howells #define ET_EXEC 2 70607ca46eSDavid Howells #define ET_DYN 3 71607ca46eSDavid Howells #define ET_CORE 4 72607ca46eSDavid Howells #define ET_LOPROC 0xff00 73607ca46eSDavid Howells #define ET_HIPROC 0xffff 74607ca46eSDavid Howells 75607ca46eSDavid Howells /* This is the info that is needed to parse the dynamic section of the file */ 76607ca46eSDavid Howells #define DT_NULL 0 77607ca46eSDavid Howells #define DT_NEEDED 1 78607ca46eSDavid Howells #define DT_PLTRELSZ 2 79607ca46eSDavid Howells #define DT_PLTGOT 3 80607ca46eSDavid Howells #define DT_HASH 4 81607ca46eSDavid Howells #define DT_STRTAB 5 82607ca46eSDavid Howells #define DT_SYMTAB 6 83607ca46eSDavid Howells #define DT_RELA 7 84607ca46eSDavid Howells #define DT_RELASZ 8 85607ca46eSDavid Howells #define DT_RELAENT 9 86607ca46eSDavid Howells #define DT_STRSZ 10 87607ca46eSDavid Howells #define DT_SYMENT 11 88607ca46eSDavid Howells #define DT_INIT 12 89607ca46eSDavid Howells #define DT_FINI 13 90607ca46eSDavid Howells #define DT_SONAME 14 91607ca46eSDavid Howells #define DT_RPATH 15 92607ca46eSDavid Howells #define DT_SYMBOLIC 16 93607ca46eSDavid Howells #define DT_REL 17 94607ca46eSDavid Howells #define DT_RELSZ 18 95607ca46eSDavid Howells #define DT_RELENT 19 96607ca46eSDavid Howells #define DT_PLTREL 20 97607ca46eSDavid Howells #define DT_DEBUG 21 98607ca46eSDavid Howells #define DT_TEXTREL 22 99607ca46eSDavid Howells #define DT_JMPREL 23 100607ca46eSDavid Howells #define DT_ENCODING 32 101607ca46eSDavid Howells #define OLD_DT_LOOS 0x60000000 102607ca46eSDavid Howells #define DT_LOOS 0x6000000d 103607ca46eSDavid Howells #define DT_HIOS 0x6ffff000 104607ca46eSDavid Howells #define DT_VALRNGLO 0x6ffffd00 105607ca46eSDavid Howells #define DT_VALRNGHI 0x6ffffdff 106607ca46eSDavid Howells #define DT_ADDRRNGLO 0x6ffffe00 107607ca46eSDavid Howells #define DT_ADDRRNGHI 0x6ffffeff 108607ca46eSDavid Howells #define DT_VERSYM 0x6ffffff0 109607ca46eSDavid Howells #define DT_RELACOUNT 0x6ffffff9 110607ca46eSDavid Howells #define DT_RELCOUNT 0x6ffffffa 111607ca46eSDavid Howells #define DT_FLAGS_1 0x6ffffffb 112607ca46eSDavid Howells #define DT_VERDEF 0x6ffffffc 113607ca46eSDavid Howells #define DT_VERDEFNUM 0x6ffffffd 114607ca46eSDavid Howells #define DT_VERNEED 0x6ffffffe 115607ca46eSDavid Howells #define DT_VERNEEDNUM 0x6fffffff 116607ca46eSDavid Howells #define OLD_DT_HIOS 0x6fffffff 117607ca46eSDavid Howells #define DT_LOPROC 0x70000000 118607ca46eSDavid Howells #define DT_HIPROC 0x7fffffff 119607ca46eSDavid Howells 120607ca46eSDavid Howells /* This info is needed when parsing the symbol table */ 121607ca46eSDavid Howells #define STB_LOCAL 0 122607ca46eSDavid Howells #define STB_GLOBAL 1 123607ca46eSDavid Howells #define STB_WEAK 2 124607ca46eSDavid Howells 125607ca46eSDavid Howells #define STT_NOTYPE 0 126607ca46eSDavid Howells #define STT_OBJECT 1 127607ca46eSDavid Howells #define STT_FUNC 2 128607ca46eSDavid Howells #define STT_SECTION 3 129607ca46eSDavid Howells #define STT_FILE 4 130607ca46eSDavid Howells #define STT_COMMON 5 131607ca46eSDavid Howells #define STT_TLS 6 132607ca46eSDavid Howells 133607ca46eSDavid Howells #define ELF_ST_BIND(x) ((x) >> 4) 134607ca46eSDavid Howells #define ELF_ST_TYPE(x) (((unsigned int) x) & 0xf) 135607ca46eSDavid Howells #define ELF32_ST_BIND(x) ELF_ST_BIND(x) 136607ca46eSDavid Howells #define ELF32_ST_TYPE(x) ELF_ST_TYPE(x) 137607ca46eSDavid Howells #define ELF64_ST_BIND(x) ELF_ST_BIND(x) 138607ca46eSDavid Howells #define ELF64_ST_TYPE(x) ELF_ST_TYPE(x) 139607ca46eSDavid Howells 140607ca46eSDavid Howells typedef struct dynamic{ 141607ca46eSDavid Howells Elf32_Sword d_tag; 142607ca46eSDavid Howells union{ 143607ca46eSDavid Howells Elf32_Sword d_val; 144607ca46eSDavid Howells Elf32_Addr d_ptr; 145607ca46eSDavid Howells } d_un; 146607ca46eSDavid Howells } Elf32_Dyn; 147607ca46eSDavid Howells 148607ca46eSDavid Howells typedef struct { 149607ca46eSDavid Howells Elf64_Sxword d_tag; /* entry tag value */ 150607ca46eSDavid Howells union { 151607ca46eSDavid Howells Elf64_Xword d_val; 152607ca46eSDavid Howells Elf64_Addr d_ptr; 153607ca46eSDavid Howells } d_un; 154607ca46eSDavid Howells } Elf64_Dyn; 155607ca46eSDavid Howells 156607ca46eSDavid Howells /* The following are used with relocations */ 157607ca46eSDavid Howells #define ELF32_R_SYM(x) ((x) >> 8) 158607ca46eSDavid Howells #define ELF32_R_TYPE(x) ((x) & 0xff) 159607ca46eSDavid Howells 160607ca46eSDavid Howells #define ELF64_R_SYM(i) ((i) >> 32) 161607ca46eSDavid Howells #define ELF64_R_TYPE(i) ((i) & 0xffffffff) 162607ca46eSDavid Howells 163607ca46eSDavid Howells typedef struct elf32_rel { 164607ca46eSDavid Howells Elf32_Addr r_offset; 165607ca46eSDavid Howells Elf32_Word r_info; 166607ca46eSDavid Howells } Elf32_Rel; 167607ca46eSDavid Howells 168607ca46eSDavid Howells typedef struct elf64_rel { 169607ca46eSDavid Howells Elf64_Addr r_offset; /* Location at which to apply the action */ 170607ca46eSDavid Howells Elf64_Xword r_info; /* index and type of relocation */ 171607ca46eSDavid Howells } Elf64_Rel; 172607ca46eSDavid Howells 173607ca46eSDavid Howells typedef struct elf32_rela{ 174607ca46eSDavid Howells Elf32_Addr r_offset; 175607ca46eSDavid Howells Elf32_Word r_info; 176607ca46eSDavid Howells Elf32_Sword r_addend; 177607ca46eSDavid Howells } Elf32_Rela; 178607ca46eSDavid Howells 179607ca46eSDavid Howells typedef struct elf64_rela { 180607ca46eSDavid Howells Elf64_Addr r_offset; /* Location at which to apply the action */ 181607ca46eSDavid Howells Elf64_Xword r_info; /* index and type of relocation */ 182607ca46eSDavid Howells Elf64_Sxword r_addend; /* Constant addend used to compute value */ 183607ca46eSDavid Howells } Elf64_Rela; 184607ca46eSDavid Howells 185607ca46eSDavid Howells typedef struct elf32_sym{ 186607ca46eSDavid Howells Elf32_Word st_name; 187607ca46eSDavid Howells Elf32_Addr st_value; 188607ca46eSDavid Howells Elf32_Word st_size; 189607ca46eSDavid Howells unsigned char st_info; 190607ca46eSDavid Howells unsigned char st_other; 191607ca46eSDavid Howells Elf32_Half st_shndx; 192607ca46eSDavid Howells } Elf32_Sym; 193607ca46eSDavid Howells 194607ca46eSDavid Howells typedef struct elf64_sym { 195607ca46eSDavid Howells Elf64_Word st_name; /* Symbol name, index in string tbl */ 196607ca46eSDavid Howells unsigned char st_info; /* Type and binding attributes */ 197607ca46eSDavid Howells unsigned char st_other; /* No defined meaning, 0 */ 198607ca46eSDavid Howells Elf64_Half st_shndx; /* Associated section index */ 199607ca46eSDavid Howells Elf64_Addr st_value; /* Value of the symbol */ 200607ca46eSDavid Howells Elf64_Xword st_size; /* Associated symbol size */ 201607ca46eSDavid Howells } Elf64_Sym; 202607ca46eSDavid Howells 203607ca46eSDavid Howells 204607ca46eSDavid Howells #define EI_NIDENT 16 205607ca46eSDavid Howells 206607ca46eSDavid Howells typedef struct elf32_hdr{ 207607ca46eSDavid Howells unsigned char e_ident[EI_NIDENT]; 208607ca46eSDavid Howells Elf32_Half e_type; 209607ca46eSDavid Howells Elf32_Half e_machine; 210607ca46eSDavid Howells Elf32_Word e_version; 211607ca46eSDavid Howells Elf32_Addr e_entry; /* Entry point */ 212607ca46eSDavid Howells Elf32_Off e_phoff; 213607ca46eSDavid Howells Elf32_Off e_shoff; 214607ca46eSDavid Howells Elf32_Word e_flags; 215607ca46eSDavid Howells Elf32_Half e_ehsize; 216607ca46eSDavid Howells Elf32_Half e_phentsize; 217607ca46eSDavid Howells Elf32_Half e_phnum; 218607ca46eSDavid Howells Elf32_Half e_shentsize; 219607ca46eSDavid Howells Elf32_Half e_shnum; 220607ca46eSDavid Howells Elf32_Half e_shstrndx; 221607ca46eSDavid Howells } Elf32_Ehdr; 222607ca46eSDavid Howells 223607ca46eSDavid Howells typedef struct elf64_hdr { 224607ca46eSDavid Howells unsigned char e_ident[EI_NIDENT]; /* ELF "magic number" */ 225607ca46eSDavid Howells Elf64_Half e_type; 226607ca46eSDavid Howells Elf64_Half e_machine; 227607ca46eSDavid Howells Elf64_Word e_version; 228607ca46eSDavid Howells Elf64_Addr e_entry; /* Entry point virtual address */ 229607ca46eSDavid Howells Elf64_Off e_phoff; /* Program header table file offset */ 230607ca46eSDavid Howells Elf64_Off e_shoff; /* Section header table file offset */ 231607ca46eSDavid Howells Elf64_Word e_flags; 232607ca46eSDavid Howells Elf64_Half e_ehsize; 233607ca46eSDavid Howells Elf64_Half e_phentsize; 234607ca46eSDavid Howells Elf64_Half e_phnum; 235607ca46eSDavid Howells Elf64_Half e_shentsize; 236607ca46eSDavid Howells Elf64_Half e_shnum; 237607ca46eSDavid Howells Elf64_Half e_shstrndx; 238607ca46eSDavid Howells } Elf64_Ehdr; 239607ca46eSDavid Howells 240607ca46eSDavid Howells /* These constants define the permissions on sections in the program 241607ca46eSDavid Howells header, p_flags. */ 242607ca46eSDavid Howells #define PF_R 0x4 243607ca46eSDavid Howells #define PF_W 0x2 244607ca46eSDavid Howells #define PF_X 0x1 245607ca46eSDavid Howells 246607ca46eSDavid Howells typedef struct elf32_phdr{ 247607ca46eSDavid Howells Elf32_Word p_type; 248607ca46eSDavid Howells Elf32_Off p_offset; 249607ca46eSDavid Howells Elf32_Addr p_vaddr; 250607ca46eSDavid Howells Elf32_Addr p_paddr; 251607ca46eSDavid Howells Elf32_Word p_filesz; 252607ca46eSDavid Howells Elf32_Word p_memsz; 253607ca46eSDavid Howells Elf32_Word p_flags; 254607ca46eSDavid Howells Elf32_Word p_align; 255607ca46eSDavid Howells } Elf32_Phdr; 256607ca46eSDavid Howells 257607ca46eSDavid Howells typedef struct elf64_phdr { 258607ca46eSDavid Howells Elf64_Word p_type; 259607ca46eSDavid Howells Elf64_Word p_flags; 260607ca46eSDavid Howells Elf64_Off p_offset; /* Segment file offset */ 261607ca46eSDavid Howells Elf64_Addr p_vaddr; /* Segment virtual address */ 262607ca46eSDavid Howells Elf64_Addr p_paddr; /* Segment physical address */ 263607ca46eSDavid Howells Elf64_Xword p_filesz; /* Segment size in file */ 264607ca46eSDavid Howells Elf64_Xword p_memsz; /* Segment size in memory */ 265607ca46eSDavid Howells Elf64_Xword p_align; /* Segment alignment, file & memory */ 266607ca46eSDavid Howells } Elf64_Phdr; 267607ca46eSDavid Howells 268607ca46eSDavid Howells /* sh_type */ 269607ca46eSDavid Howells #define SHT_NULL 0 270607ca46eSDavid Howells #define SHT_PROGBITS 1 271607ca46eSDavid Howells #define SHT_SYMTAB 2 272607ca46eSDavid Howells #define SHT_STRTAB 3 273607ca46eSDavid Howells #define SHT_RELA 4 274607ca46eSDavid Howells #define SHT_HASH 5 275607ca46eSDavid Howells #define SHT_DYNAMIC 6 276607ca46eSDavid Howells #define SHT_NOTE 7 277607ca46eSDavid Howells #define SHT_NOBITS 8 278607ca46eSDavid Howells #define SHT_REL 9 279607ca46eSDavid Howells #define SHT_SHLIB 10 280607ca46eSDavid Howells #define SHT_DYNSYM 11 281607ca46eSDavid Howells #define SHT_NUM 12 282607ca46eSDavid Howells #define SHT_LOPROC 0x70000000 283607ca46eSDavid Howells #define SHT_HIPROC 0x7fffffff 284607ca46eSDavid Howells #define SHT_LOUSER 0x80000000 285607ca46eSDavid Howells #define SHT_HIUSER 0xffffffff 286607ca46eSDavid Howells 287607ca46eSDavid Howells /* sh_flags */ 288607ca46eSDavid Howells #define SHF_WRITE 0x1 289607ca46eSDavid Howells #define SHF_ALLOC 0x2 290607ca46eSDavid Howells #define SHF_EXECINSTR 0x4 2918d98e96bSJessica Yu #define SHF_RELA_LIVEPATCH 0x00100000 292444d13ffSJessica Yu #define SHF_RO_AFTER_INIT 0x00200000 293607ca46eSDavid Howells #define SHF_MASKPROC 0xf0000000 294607ca46eSDavid Howells 295607ca46eSDavid Howells /* special section indexes */ 296607ca46eSDavid Howells #define SHN_UNDEF 0 297607ca46eSDavid Howells #define SHN_LORESERVE 0xff00 298607ca46eSDavid Howells #define SHN_LOPROC 0xff00 299607ca46eSDavid Howells #define SHN_HIPROC 0xff1f 3008d98e96bSJessica Yu #define SHN_LIVEPATCH 0xff20 301607ca46eSDavid Howells #define SHN_ABS 0xfff1 302607ca46eSDavid Howells #define SHN_COMMON 0xfff2 303607ca46eSDavid Howells #define SHN_HIRESERVE 0xffff 304607ca46eSDavid Howells 305607ca46eSDavid Howells typedef struct elf32_shdr { 306607ca46eSDavid Howells Elf32_Word sh_name; 307607ca46eSDavid Howells Elf32_Word sh_type; 308607ca46eSDavid Howells Elf32_Word sh_flags; 309607ca46eSDavid Howells Elf32_Addr sh_addr; 310607ca46eSDavid Howells Elf32_Off sh_offset; 311607ca46eSDavid Howells Elf32_Word sh_size; 312607ca46eSDavid Howells Elf32_Word sh_link; 313607ca46eSDavid Howells Elf32_Word sh_info; 314607ca46eSDavid Howells Elf32_Word sh_addralign; 315607ca46eSDavid Howells Elf32_Word sh_entsize; 316607ca46eSDavid Howells } Elf32_Shdr; 317607ca46eSDavid Howells 318607ca46eSDavid Howells typedef struct elf64_shdr { 319607ca46eSDavid Howells Elf64_Word sh_name; /* Section name, index in string tbl */ 320607ca46eSDavid Howells Elf64_Word sh_type; /* Type of section */ 321607ca46eSDavid Howells Elf64_Xword sh_flags; /* Miscellaneous section attributes */ 322607ca46eSDavid Howells Elf64_Addr sh_addr; /* Section virtual addr at execution */ 323607ca46eSDavid Howells Elf64_Off sh_offset; /* Section file offset */ 324607ca46eSDavid Howells Elf64_Xword sh_size; /* Size of section in bytes */ 325607ca46eSDavid Howells Elf64_Word sh_link; /* Index of another section */ 326607ca46eSDavid Howells Elf64_Word sh_info; /* Additional section information */ 327607ca46eSDavid Howells Elf64_Xword sh_addralign; /* Section alignment */ 328607ca46eSDavid Howells Elf64_Xword sh_entsize; /* Entry size if section holds table */ 329607ca46eSDavid Howells } Elf64_Shdr; 330607ca46eSDavid Howells 331607ca46eSDavid Howells #define EI_MAG0 0 /* e_ident[] indexes */ 332607ca46eSDavid Howells #define EI_MAG1 1 333607ca46eSDavid Howells #define EI_MAG2 2 334607ca46eSDavid Howells #define EI_MAG3 3 335607ca46eSDavid Howells #define EI_CLASS 4 336607ca46eSDavid Howells #define EI_DATA 5 337607ca46eSDavid Howells #define EI_VERSION 6 338607ca46eSDavid Howells #define EI_OSABI 7 339607ca46eSDavid Howells #define EI_PAD 8 340607ca46eSDavid Howells 341607ca46eSDavid Howells #define ELFMAG0 0x7f /* EI_MAG */ 342607ca46eSDavid Howells #define ELFMAG1 'E' 343607ca46eSDavid Howells #define ELFMAG2 'L' 344607ca46eSDavid Howells #define ELFMAG3 'F' 345607ca46eSDavid Howells #define ELFMAG "\177ELF" 346607ca46eSDavid Howells #define SELFMAG 4 347607ca46eSDavid Howells 348607ca46eSDavid Howells #define ELFCLASSNONE 0 /* EI_CLASS */ 349607ca46eSDavid Howells #define ELFCLASS32 1 350607ca46eSDavid Howells #define ELFCLASS64 2 351607ca46eSDavid Howells #define ELFCLASSNUM 3 352607ca46eSDavid Howells 353607ca46eSDavid Howells #define ELFDATANONE 0 /* e_ident[EI_DATA] */ 354607ca46eSDavid Howells #define ELFDATA2LSB 1 355607ca46eSDavid Howells #define ELFDATA2MSB 2 356607ca46eSDavid Howells 357607ca46eSDavid Howells #define EV_NONE 0 /* e_version, EI_VERSION */ 358607ca46eSDavid Howells #define EV_CURRENT 1 359607ca46eSDavid Howells #define EV_NUM 2 360607ca46eSDavid Howells 361607ca46eSDavid Howells #define ELFOSABI_NONE 0 362607ca46eSDavid Howells #define ELFOSABI_LINUX 3 363607ca46eSDavid Howells 364607ca46eSDavid Howells #ifndef ELF_OSABI 365607ca46eSDavid Howells #define ELF_OSABI ELFOSABI_NONE 366607ca46eSDavid Howells #endif 367607ca46eSDavid Howells 368607ca46eSDavid Howells /* 369607ca46eSDavid Howells * Notes used in ET_CORE. Architectures export some of the arch register sets 370607ca46eSDavid Howells * using the corresponding note types via the PTRACE_GETREGSET and 371607ca46eSDavid Howells * PTRACE_SETREGSET requests. 37200e19ceeSDave Martin * The note name for all these is "LINUX". 373607ca46eSDavid Howells */ 374607ca46eSDavid Howells #define NT_PRSTATUS 1 375607ca46eSDavid Howells #define NT_PRFPREG 2 376607ca46eSDavid Howells #define NT_PRPSINFO 3 377607ca46eSDavid Howells #define NT_TASKSTRUCT 4 378607ca46eSDavid Howells #define NT_AUXV 6 379607ca46eSDavid Howells /* 380607ca46eSDavid Howells * Note to userspace developers: size of NT_SIGINFO note may increase 381607ca46eSDavid Howells * in the future to accomodate more fields, don't assume it is fixed! 382607ca46eSDavid Howells */ 383607ca46eSDavid Howells #define NT_SIGINFO 0x53494749 384607ca46eSDavid Howells #define NT_FILE 0x46494c45 385607ca46eSDavid Howells #define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */ 386607ca46eSDavid Howells #define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ 387607ca46eSDavid Howells #define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ 388607ca46eSDavid Howells #define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ 3890dc696bcSAnshuman Khandual #define NT_PPC_TAR 0x103 /* Target Address Register */ 3900dc696bcSAnshuman Khandual #define NT_PPC_PPR 0x104 /* Program Priority Register */ 3910dc696bcSAnshuman Khandual #define NT_PPC_DSCR 0x105 /* Data Stream Control Register */ 3920dc696bcSAnshuman Khandual #define NT_PPC_EBB 0x106 /* Event Based Branch Registers */ 3930dc696bcSAnshuman Khandual #define NT_PPC_PMU 0x107 /* Performance Monitor Registers */ 3940dc696bcSAnshuman Khandual #define NT_PPC_TM_CGPR 0x108 /* TM checkpointed GPR Registers */ 3950dc696bcSAnshuman Khandual #define NT_PPC_TM_CFPR 0x109 /* TM checkpointed FPR Registers */ 3960dc696bcSAnshuman Khandual #define NT_PPC_TM_CVMX 0x10a /* TM checkpointed VMX Registers */ 3970dc696bcSAnshuman Khandual #define NT_PPC_TM_CVSX 0x10b /* TM checkpointed VSX Registers */ 3980dc696bcSAnshuman Khandual #define NT_PPC_TM_SPR 0x10c /* TM Special Purpose Registers */ 3990dc696bcSAnshuman Khandual #define NT_PPC_TM_CTAR 0x10d /* TM checkpointed Target Address Register */ 4000dc696bcSAnshuman Khandual #define NT_PPC_TM_CPPR 0x10e /* TM checkpointed Program Priority Register */ 4010dc696bcSAnshuman Khandual #define NT_PPC_TM_CDSCR 0x10f /* TM checkpointed Data Stream Control Register */ 402c5cc1f4dSThiago Jung Bauermann #define NT_PPC_PKEY 0x110 /* Memory Protection Keys registers */ 403607ca46eSDavid Howells #define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ 404607ca46eSDavid Howells #define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ 405607ca46eSDavid Howells #define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */ 406607ca46eSDavid Howells #define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */ 407607ca46eSDavid Howells #define NT_S390_TIMER 0x301 /* s390 timer register */ 408607ca46eSDavid Howells #define NT_S390_TODCMP 0x302 /* s390 TOD clock comparator register */ 409607ca46eSDavid Howells #define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */ 410607ca46eSDavid Howells #define NT_S390_CTRS 0x304 /* s390 control registers */ 411607ca46eSDavid Howells #define NT_S390_PREFIX 0x305 /* s390 prefix register */ 412607ca46eSDavid Howells #define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */ 413607ca46eSDavid Howells #define NT_S390_SYSTEM_CALL 0x307 /* s390 system call restart data */ 414607ca46eSDavid Howells #define NT_S390_TDB 0x308 /* s390 transaction diagnostic block */ 41580703617SMartin Schwidefsky #define NT_S390_VXRS_LOW 0x309 /* s390 vector registers 0-15 upper half */ 41680703617SMartin Schwidefsky #define NT_S390_VXRS_HIGH 0x30a /* s390 vector registers 16-31 */ 417916cda1aSMartin Schwidefsky #define NT_S390_GS_CB 0x30b /* s390 guarded storage registers */ 418e525f8a6SMartin Schwidefsky #define NT_S390_GS_BC 0x30c /* s390 guarded storage broadcast control block */ 419262832bcSAlice Frosi #define NT_S390_RI_CB 0x30d /* s390 runtime instrumentation */ 420607ca46eSDavid Howells #define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */ 421607ca46eSDavid Howells #define NT_ARM_TLS 0x401 /* ARM TLS register */ 422607ca46eSDavid Howells #define NT_ARM_HW_BREAK 0x402 /* ARM hardware breakpoint registers */ 423607ca46eSDavid Howells #define NT_ARM_HW_WATCH 0x403 /* ARM hardware watchpoint registers */ 424766a85d7SAKASHI Takahiro #define NT_ARM_SYSTEM_CALL 0x404 /* ARM system call number */ 42543d4da2cSDave Martin #define NT_ARM_SVE 0x405 /* ARM Scalable Vector Extension registers */ 426ec6e822dSMark Rutland #define NT_ARM_PAC_MASK 0x406 /* ARM pointer authentication code masks */ 427d0a060beSKristina Martsenko #define NT_ARM_PACA_KEYS 0x407 /* ARM pointer authentication address keys */ 428d0a060beSKristina Martsenko #define NT_ARM_PACG_KEYS 0x408 /* ARM pointer authentication generic key */ 4292200aa71SCatalin Marinas #define NT_ARM_TAGGED_ADDR_CTRL 0x409 /* arm64 tagged address control (prctl()) */ 43020169862SPeter Collingbourne #define NT_ARM_PAC_ENABLED_KEYS 0x40a /* arm64 ptr auth enabled keys (prctl()) */ 431991c7ed6SVineet Gupta #define NT_ARC_V2 0x600 /* ARCv2 accumulator/extra registers */ 4322724273eSRahul Lakkireddy #define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note */ 43344109c60SMaciej W. Rozycki #define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers */ 4341ae22a0eSMaciej W. Rozycki #define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode */ 4353cd64083SPaul Burton #define NT_MIPS_MSA 0x802 /* MIPS SIMD registers */ 436607ca46eSDavid Howells 43700e19ceeSDave Martin /* Note types with note name "GNU" */ 43800e19ceeSDave Martin #define NT_GNU_PROPERTY_TYPE_0 5 43900e19ceeSDave Martin 440607ca46eSDavid Howells /* Note header in a PT_NOTE section */ 441607ca46eSDavid Howells typedef struct elf32_note { 442607ca46eSDavid Howells Elf32_Word n_namesz; /* Name size */ 443607ca46eSDavid Howells Elf32_Word n_descsz; /* Content size */ 444607ca46eSDavid Howells Elf32_Word n_type; /* Content type */ 445607ca46eSDavid Howells } Elf32_Nhdr; 446607ca46eSDavid Howells 447607ca46eSDavid Howells /* Note header in a PT_NOTE section */ 448607ca46eSDavid Howells typedef struct elf64_note { 449607ca46eSDavid Howells Elf64_Word n_namesz; /* Name size */ 450607ca46eSDavid Howells Elf64_Word n_descsz; /* Content size */ 451607ca46eSDavid Howells Elf64_Word n_type; /* Content type */ 452607ca46eSDavid Howells } Elf64_Nhdr; 453607ca46eSDavid Howells 454ab7876a9SDave Martin /* .note.gnu.property types for EM_AARCH64: */ 455ab7876a9SDave Martin #define GNU_PROPERTY_AARCH64_FEATURE_1_AND 0xc0000000 456ab7876a9SDave Martin 457ab7876a9SDave Martin /* Bits for GNU_PROPERTY_AARCH64_FEATURE_1_BTI */ 458ab7876a9SDave Martin #define GNU_PROPERTY_AARCH64_FEATURE_1_BTI (1U << 0) 459ab7876a9SDave Martin 460607ca46eSDavid Howells #endif /* _UAPI_LINUX_ELF_H */ 461