1 /* $NetBSD: readelf.h,v 1.9 2002/05/18 07:00:47 pooka Exp $ */
5 * @(#)Id: readelf.h,v 1.9 2002/05/16 18:45:56 christos Exp
7 * Provide elf data structures for non-elf machines, allowing file
8 * non-elf hosts to determine if an elf binary is stripped.
9 * Note: cobbled from the linux header file, with modifications
11 #ifndef __fake_elf_h__
12 #define __fake_elf_h__
18 typedef uint32_t Elf32_Addr;
19 typedef uint32_t Elf32_Off;
20 typedef uint16_t Elf32_Half;
21 typedef uint32_t Elf32_Word;
22 typedef uint8_t Elf32_Char;
24 #if SIZEOF_UINT64_T != 8
25 #define USE_ARRAY_FOR_64BIT_TYPES
26 typedef uint32_t Elf64_Addr[2];
27 typedef uint32_t Elf64_Off[2];
28 typedef uint32_t Elf64_Xword[2];
30 typedef uint64_t Elf64_Addr;
31 typedef uint64_t Elf64_Off;
32 typedef uint64_t Elf64_Xword;
34 typedef uint16_t Elf64_Half;
35 typedef uint32_t Elf64_Word;
36 typedef uint8_t Elf64_Char;
41 Elf32_Char e_ident[EI_NIDENT];
45 Elf32_Addr e_entry; /* Entry point */
50 Elf32_Half e_phentsize;
52 Elf32_Half e_shentsize;
54 Elf32_Half e_shstrndx;
58 Elf64_Char e_ident[EI_NIDENT];
62 Elf64_Addr e_entry; /* Entry point */
67 Elf64_Half e_phentsize;
69 Elf64_Half e_shentsize;
71 Elf64_Half e_shstrndx;
84 #define ELFDATANONE 0 /* e_ident[EI_DATA] */
89 #define ELFCLASSNONE 0
94 #define EI_MAG0 0 /* e_ident[] indexes */
103 #define ELFMAG0 0x7f /* EI_MAG */
107 #define ELFMAG "\177ELF"
110 #define OLFMAG "\177OLF"
129 Elf64_Xword p_filesz;
134 #define PT_NULL 0 /* p_type */
152 Elf32_Word sh_addralign;
153 Elf32_Word sh_entsize;
165 Elf64_Off sh_addralign;
166 Elf64_Off sh_entsize;
169 /* Notes used in ET_CORE */
170 #define NT_PRSTATUS 1
172 #define NT_PRPSINFO 3
173 #define NT_TASKSTRUCT 4
175 #define NT_NETBSD_CORE_PROCINFO 1
177 /* Note header in a PT_NOTE section */
178 typedef struct elf_note {
179 Elf32_Word n_namesz; /* Name size */
180 Elf32_Word n_descsz; /* Content size */
181 Elf32_Word n_type; /* Content type */
190 #define NT_PRSTATUS 1
192 #define NT_PRPSINFO 3
194 #define NT_PLATFORM 5
197 /* Note types used in executables */
198 /* NetBSD executables (name = "NetBSD") */
199 #define NT_NETBSD_VERSION 1
200 #define NT_NETBSD_EMULATION 2
201 #define NT_FREEBSD_VERSION 1
202 #define NT_OPENBSD_VERSION 1
203 /* GNU executables (name = "GNU") */
204 #define NT_GNU_VERSION 1
207 #define GNU_OS_LINUX 0
208 #define GNU_OS_HURD 1
209 #define GNU_OS_SOLARIS 2