elf: add elf define of Note Section
Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
parent
627eb08942
commit
f33c46af21
134
include/elf.h
134
include/elf.h
@ -103,13 +103,20 @@
|
||||
#define EI_CLASS 4 /* File class */
|
||||
#define EI_DATA 5 /* Data encoding */
|
||||
#define EI_VERSION 6 /* File version */
|
||||
#define EI_PAD 7 /* Start of padding bytes */
|
||||
#define EI_OSABI 7 /* OS ABI */
|
||||
#define EI_PAD 8 /* Start of padding bytes */
|
||||
|
||||
/* EI_NIDENT is defined in "Included Files" section */
|
||||
|
||||
#define EI_MAGIC_SIZE 4
|
||||
#define EI_MAGIC {0x7f, 'E', 'L', 'F'}
|
||||
|
||||
#define ELFMAG0 0x7f /* EI_MAG */
|
||||
#define ELFMAG1 'E'
|
||||
#define ELFMAG2 'L'
|
||||
#define ELFMAG3 'F'
|
||||
#define ELFMAG "\177ELF"
|
||||
|
||||
/* Table 3. Values for EI_CLASS */
|
||||
|
||||
#define ELFCLASSNONE 0 /* Invalid class */
|
||||
@ -122,6 +129,30 @@
|
||||
#define ELFDATA2LSB 1 /* Least significant byte occupying the lowest address */
|
||||
#define ELFDATA2MSB 2 /* Most significant byte occupying the lowest address */
|
||||
|
||||
/* Table 6. Values for EI_OSABI */
|
||||
|
||||
#define ELFOSABI_NONE 0 /* UNIX System V ABI */
|
||||
#define ELFOSABI_SYSV 0 /* Alias. */
|
||||
#define ELFOSABI_HPUX 1 /* HP-UX */
|
||||
#define ELFOSABI_NETBSD 2 /* NetBSD. */
|
||||
#define ELFOSABI_GNU 3 /* Object uses GNU ELF extensions. */
|
||||
#define ELFOSABI_LINUX ELFOSABI_GNU
|
||||
/* Compatibility alias. */
|
||||
#define ELFOSABI_SOLARIS 6 /* Sun Solaris. */
|
||||
#define ELFOSABI_AIX 7 /* IBM AIX. */
|
||||
#define ELFOSABI_IRIX 8 /* SGI Irix. */
|
||||
#define ELFOSABI_FREEBSD 9 /* FreeBSD. */
|
||||
#define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX. */
|
||||
#define ELFOSABI_MODESTO 11 /* Novell Modesto. */
|
||||
#define ELFOSABI_OPENBSD 12 /* OpenBSD. */
|
||||
#define ELFOSABI_ARM_AEABI 64 /* ARM EABI */
|
||||
#define ELFOSABI_ARM 97 /* ARM */
|
||||
#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
|
||||
|
||||
#ifndef ELF_OSABI
|
||||
#define ELF_OSABI ELFOSABI_NONE
|
||||
#endif
|
||||
|
||||
/* Table 7: Special Section Indexes */
|
||||
|
||||
#define SHN_UNDEF 0
|
||||
@ -223,4 +254,105 @@
|
||||
#define DT_LOPROC 0x70000000 /* d_un=unspecified */
|
||||
#define DT_HIPROC 0x7fffffff /* d_un= unspecified */
|
||||
|
||||
/* Legal values for note segment descriptor types for core files. */
|
||||
|
||||
#define NT_PRSTATUS 1 /* Contains copy of prstatus struct */
|
||||
#define NT_PRFPREG 2 /* Contains copy of fpregset struct. */
|
||||
#define NT_FPREGSET 2 /* Contains copy of fpregset struct */
|
||||
#define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */
|
||||
#define NT_PRXREG 4 /* Contains copy of prxregset struct */
|
||||
#define NT_TASKSTRUCT 4 /* Contains copy of task structure */
|
||||
#define NT_PLATFORM 5 /* String from sysinfo(SI_PLATFORM) */
|
||||
#define NT_AUXV 6 /* Contains copy of auxv array */
|
||||
#define NT_GWINDOWS 7 /* Contains copy of gwindows struct */
|
||||
#define NT_ASRS 8 /* Contains copy of asrset struct */
|
||||
#define NT_PSTATUS 10 /* Contains copy of pstatus struct */
|
||||
#define NT_PSINFO 13 /* Contains copy of psinfo struct */
|
||||
#define NT_PRCRED 14 /* Contains copy of prcred struct */
|
||||
#define NT_UTSNAME 15 /* Contains copy of utsname struct */
|
||||
#define NT_LWPSTATUS 16 /* Contains copy of lwpstatus struct */
|
||||
#define NT_LWPSINFO 17 /* Contains copy of lwpinfo struct */
|
||||
#define NT_PRFPXREG 20 /* Contains copy of fprxregset struct */
|
||||
#define NT_SIGINFO 0x53494749
|
||||
/* Contains copy of siginfo_t,
|
||||
* size might increase
|
||||
*/
|
||||
#define NT_FILE 0x46494c45
|
||||
/* Contains information about mapped
|
||||
* files
|
||||
*/
|
||||
#define NT_PRXFPREG 0x46e62b7f
|
||||
/* Contains copy of user_fxsr_struct */
|
||||
#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */
|
||||
#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */
|
||||
#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */
|
||||
#define NT_PPC_TAR 0x103 /* Target Address Register */
|
||||
#define NT_PPC_PPR 0x104 /* Program Priority Register */
|
||||
#define NT_PPC_DSCR 0x105 /* Data Stream Control Register */
|
||||
#define NT_PPC_EBB 0x106 /* Event Based Branch Registers */
|
||||
#define NT_PPC_PMU 0x107 /* Performance Monitor Registers */
|
||||
#define NT_PPC_TM_CGPR 0x108 /* TM checkpointed GPR Registers */
|
||||
#define NT_PPC_TM_CFPR 0x109 /* TM checkpointed FPR Registers */
|
||||
#define NT_PPC_TM_CVMX 0x10a /* TM checkpointed VMX Registers */
|
||||
#define NT_PPC_TM_CVSX 0x10b /* TM checkpointed VSX Registers */
|
||||
#define NT_PPC_TM_SPR 0x10c /* TM Special Purpose Registers */
|
||||
#define NT_PPC_TM_CTAR 0x10d /* TM checkpointed Target Address
|
||||
* Register
|
||||
*/
|
||||
#define NT_PPC_TM_CPPR 0x10e /* TM checkpointed Program Priority
|
||||
* Register
|
||||
*/
|
||||
#define NT_PPC_TM_CDSCR 0x10f /* TM checkpointed Data Stream Control
|
||||
* Register
|
||||
*/
|
||||
#define NT_PPC_PKEY 0x110 /* Memory Protection Keys
|
||||
* registers.
|
||||
*/
|
||||
#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
|
||||
#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */
|
||||
#define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */
|
||||
#define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */
|
||||
#define NT_S390_TIMER 0x301 /* s390 timer register */
|
||||
#define NT_S390_TODCMP 0x302 /* s390 TOD clock comparator register */
|
||||
#define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */
|
||||
#define NT_S390_CTRS 0x304 /* s390 control registers */
|
||||
#define NT_S390_PREFIX 0x305 /* s390 prefix register */
|
||||
#define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */
|
||||
#define NT_S390_SYSTEM_CALL 0x307 /* s390 system call restart data */
|
||||
#define NT_S390_TDB 0x308 /* s390 transaction diagnostic block */
|
||||
#define NT_S390_VXRS_LOW 0x309 /* s390 vector registers 0-15
|
||||
* upper half.
|
||||
*/
|
||||
#define NT_S390_VXRS_HIGH 0x30a /* s390 vector registers 16-31. */
|
||||
#define NT_S390_GS_CB 0x30b /* s390 guarded storage registers. */
|
||||
#define NT_S390_GS_BC 0x30c /* s390 guarded storage
|
||||
* broadcast control block.
|
||||
*/
|
||||
#define NT_S390_RI_CB 0x30d /* s390 runtime instrumentation. */
|
||||
#define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */
|
||||
#define NT_ARM_TLS 0x401 /* ARM TLS register */
|
||||
#define NT_ARM_HW_BREAK 0x402 /* ARM hardware breakpoint registers */
|
||||
#define NT_ARM_HW_WATCH 0x403 /* ARM hardware watchpoint registers */
|
||||
#define NT_ARM_SYSTEM_CALL 0x404 /* ARM system call number */
|
||||
#define NT_ARM_SVE 0x405 /* ARM Scalable Vector Extension
|
||||
* registers
|
||||
*/
|
||||
#define NT_ARM_PAC_MASK 0x406 /* ARM pointer authentication
|
||||
* code masks.
|
||||
*/
|
||||
#define NT_ARM_PACA_KEYS 0x407 /* ARM pointer authentication
|
||||
* address keys.
|
||||
*/
|
||||
#define NT_ARM_PACG_KEYS 0x408 /* ARM pointer authentication
|
||||
* generic key.
|
||||
*/
|
||||
#define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note. */
|
||||
#define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers. */
|
||||
#define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode. */
|
||||
#define NT_MIPS_MSA 0x802 /* MIPS SIMD registers. */
|
||||
|
||||
/* Legal values for the note segment descriptor types for object files. */
|
||||
|
||||
#define NT_VERSION 1 /* Contains a version string. */
|
||||
|
||||
#endif /* __INCLUDE_ELF_H */
|
||||
|
@ -135,6 +135,15 @@ typedef struct
|
||||
Elf32_Word p_align;
|
||||
} Elf32_Phdr;
|
||||
|
||||
/* Figure 5-7: Note Information */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Word n_namesz; /* Length of the note's name. */
|
||||
Elf32_Word n_descsz; /* Length of the note's descriptor. */
|
||||
Elf32_Word n_type; /* Type of the note. */
|
||||
} Elf32_Nhdr;
|
||||
|
||||
/* Figure 5-9: Dynamic Structure */
|
||||
|
||||
typedef struct
|
||||
@ -151,6 +160,8 @@ typedef Elf32_Addr Elf_Addr;
|
||||
typedef Elf32_Ehdr Elf_Ehdr;
|
||||
typedef Elf32_Rel Elf_Rel;
|
||||
typedef Elf32_Rela Elf_Rela;
|
||||
typedef Elf32_Nhdr Elf_Nhdr;
|
||||
typedef Elf32_Phdr Elf_Phdr;
|
||||
typedef Elf32_Sym Elf_Sym;
|
||||
typedef Elf32_Shdr Elf_Shdr;
|
||||
typedef Elf32_Word Elf_Word;
|
||||
|
@ -135,6 +135,15 @@ typedef struct
|
||||
Elf64_Word p_align; /* Alignment of segment */
|
||||
} Elf64_Phdr;
|
||||
|
||||
/* Figure 7. Format of a Note Section */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elf64_Word n_namesz; /* Length of the note's name. */
|
||||
Elf64_Word n_descsz; /* Length of the note's descriptor. */
|
||||
Elf64_Word n_type; /* Type of the note. */
|
||||
} Elf64_Nhdr;
|
||||
|
||||
/* Figure 8: Dynamic Table Structure */
|
||||
|
||||
typedef struct
|
||||
@ -151,6 +160,8 @@ typedef Elf64_Addr Elf_Addr;
|
||||
typedef Elf64_Ehdr Elf_Ehdr;
|
||||
typedef Elf64_Rel Elf_Rel;
|
||||
typedef Elf64_Rela Elf_Rela;
|
||||
typedef Elf64_Nhdr Elf_Nhdr;
|
||||
typedef Elf64_Phdr Elf_Phdr;
|
||||
typedef Elf64_Sym Elf_Sym;
|
||||
typedef Elf64_Shdr Elf_Shdr;
|
||||
typedef Elf64_Word Elf_Word;
|
||||
|
Loading…
Reference in New Issue
Block a user