Thu Jan 2 05:18:07 2020 UTC ()
Sync the e_ident[EI_OSABI] magic values with the ELF specification

source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html


(kamil)
diff -r1.163 -r1.164 src/sys/sys/exec_elf.h

cvs diff -r1.163 -r1.164 src/sys/sys/exec_elf.h (switch to unified diff)

--- src/sys/sys/exec_elf.h 2020/01/02 04:58:07 1.163
+++ src/sys/sys/exec_elf.h 2020/01/02 05:18:07 1.164
@@ -1,1189 +1,1195 @@ @@ -1,1189 +1,1195 @@
1/* $NetBSD: exec_elf.h,v 1.163 2020/01/02 04:58:07 kamil Exp $ */ 1/* $NetBSD: exec_elf.h,v 1.164 2020/01/02 05:18:07 kamil Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1994 The NetBSD Foundation, Inc. 4 * Copyright (c) 1994 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Christos Zoulas. 8 * by Christos Zoulas.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright 15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the 16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution. 17 * documentation and/or other materials provided with the distribution.
18 * 18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#ifndef _SYS_EXEC_ELF_H_ 32#ifndef _SYS_EXEC_ELF_H_
33#define _SYS_EXEC_ELF_H_ 33#define _SYS_EXEC_ELF_H_
34 34
35/* 35/*
36 * The current ELF ABI specification is available at: 36 * The current ELF ABI specification is available at:
37 * http://www.sco.com/developers/gabi/ 37 * http://www.sco.com/developers/gabi/
38 * 38 *
39 * Current header definitions are in: 39 * Current header definitions are in:
40 * http://www.sco.com/developers/gabi/latest/ch4.eheader.html 40 * http://www.sco.com/developers/gabi/latest/ch4.eheader.html
41 */ 41 */
42 42
43#if defined(_KERNEL) || defined(_STANDALONE) 43#if defined(_KERNEL) || defined(_STANDALONE)
44#include <sys/types.h> 44#include <sys/types.h>
45#else 45#else
46#include <inttypes.h> 46#include <inttypes.h>
47#include <stddef.h> 47#include <stddef.h>
48#endif /* _KERNEL || _STANDALONE */ 48#endif /* _KERNEL || _STANDALONE */
49 49
50#if HAVE_NBTOOL_CONFIG_H 50#if HAVE_NBTOOL_CONFIG_H
51#include <nbinclude/machine/elf_machdep.h> 51#include <nbinclude/machine/elf_machdep.h>
52#else 52#else
53#include <machine/elf_machdep.h> 53#include <machine/elf_machdep.h>
54#endif 54#endif
55 55
56typedef uint8_t Elf_Byte; 56typedef uint8_t Elf_Byte;
57 57
58typedef uint32_t Elf32_Addr; 58typedef uint32_t Elf32_Addr;
59#define ELF32_FSZ_ADDR 4 59#define ELF32_FSZ_ADDR 4
60typedef uint32_t Elf32_Off; 60typedef uint32_t Elf32_Off;
61typedef int32_t Elf32_SOff; 61typedef int32_t Elf32_SOff;
62#define ELF32_FSZ_OFF 4 62#define ELF32_FSZ_OFF 4
63typedef int32_t Elf32_Sword; 63typedef int32_t Elf32_Sword;
64#define ELF32_FSZ_SWORD 4 64#define ELF32_FSZ_SWORD 4
65typedef uint32_t Elf32_Word; 65typedef uint32_t Elf32_Word;
66#define ELF32_FSZ_WORD 4 66#define ELF32_FSZ_WORD 4
67typedef uint16_t Elf32_Half; 67typedef uint16_t Elf32_Half;
68#define ELF32_FSZ_HALF 2 68#define ELF32_FSZ_HALF 2
69typedef uint64_t Elf32_Lword; 69typedef uint64_t Elf32_Lword;
70#define ELF32_FSZ_LWORD 8 70#define ELF32_FSZ_LWORD 8
71 71
72typedef uint64_t Elf64_Addr; 72typedef uint64_t Elf64_Addr;
73#define ELF64_FSZ_ADDR 8 73#define ELF64_FSZ_ADDR 8
74typedef uint64_t Elf64_Off; 74typedef uint64_t Elf64_Off;
75typedef int64_t Elf64_SOff; 75typedef int64_t Elf64_SOff;
76#define ELF64_FSZ_OFF 8 76#define ELF64_FSZ_OFF 8
77 77
78typedef int32_t Elf64_Sword; 78typedef int32_t Elf64_Sword;
79#define ELF64_FSZ_SWORD 4 79#define ELF64_FSZ_SWORD 4
80typedef uint32_t Elf64_Word; 80typedef uint32_t Elf64_Word;
81#define ELF64_FSZ_WORD 4 81#define ELF64_FSZ_WORD 4
82 82
83typedef int64_t Elf64_Sxword; 83typedef int64_t Elf64_Sxword;
84#define ELF64_FSZ_SXWORD 8 84#define ELF64_FSZ_SXWORD 8
85typedef uint64_t Elf64_Xword; 85typedef uint64_t Elf64_Xword;
86#define ELF64_FSZ_XWORD 8 86#define ELF64_FSZ_XWORD 8
87typedef uint64_t Elf64_Lword; 87typedef uint64_t Elf64_Lword;
88#define ELF64_FSZ_LWORD 8 88#define ELF64_FSZ_LWORD 8
89typedef uint16_t Elf64_Half; 89typedef uint16_t Elf64_Half;
90#define ELF64_FSZ_HALF 2 90#define ELF64_FSZ_HALF 2
91 91
92/* 92/*
93 * ELF Header 93 * ELF Header
94 */ 94 */
95#define ELF_NIDENT 16 95#define ELF_NIDENT 16
96 96
97typedef struct { 97typedef struct {
98 unsigned char e_ident[ELF_NIDENT]; /* Id bytes */ 98 unsigned char e_ident[ELF_NIDENT]; /* Id bytes */
99 Elf32_Half e_type; /* file type */ 99 Elf32_Half e_type; /* file type */
100 Elf32_Half e_machine; /* machine type */ 100 Elf32_Half e_machine; /* machine type */
101 Elf32_Word e_version; /* version number */ 101 Elf32_Word e_version; /* version number */
102 Elf32_Addr e_entry; /* entry point */ 102 Elf32_Addr e_entry; /* entry point */
103 Elf32_Off e_phoff; /* Program hdr offset */ 103 Elf32_Off e_phoff; /* Program hdr offset */
104 Elf32_Off e_shoff; /* Section hdr offset */ 104 Elf32_Off e_shoff; /* Section hdr offset */
105 Elf32_Word e_flags; /* Processor flags */ 105 Elf32_Word e_flags; /* Processor flags */
106 Elf32_Half e_ehsize; /* sizeof ehdr */ 106 Elf32_Half e_ehsize; /* sizeof ehdr */
107 Elf32_Half e_phentsize; /* Program header entry size */ 107 Elf32_Half e_phentsize; /* Program header entry size */
108 Elf32_Half e_phnum; /* Number of program headers */ 108 Elf32_Half e_phnum; /* Number of program headers */
109 Elf32_Half e_shentsize; /* Section header entry size */ 109 Elf32_Half e_shentsize; /* Section header entry size */
110 Elf32_Half e_shnum; /* Number of section headers */ 110 Elf32_Half e_shnum; /* Number of section headers */
111 Elf32_Half e_shstrndx; /* String table index */ 111 Elf32_Half e_shstrndx; /* String table index */
112} Elf32_Ehdr; 112} Elf32_Ehdr;
113 113
114typedef struct { 114typedef struct {
115 unsigned char e_ident[ELF_NIDENT]; /* Id bytes */ 115 unsigned char e_ident[ELF_NIDENT]; /* Id bytes */
116 Elf64_Half e_type; /* file type */ 116 Elf64_Half e_type; /* file type */
117 Elf64_Half e_machine; /* machine type */ 117 Elf64_Half e_machine; /* machine type */
118 Elf64_Word e_version; /* version number */ 118 Elf64_Word e_version; /* version number */
119 Elf64_Addr e_entry; /* entry point */ 119 Elf64_Addr e_entry; /* entry point */
120 Elf64_Off e_phoff; /* Program hdr offset */ 120 Elf64_Off e_phoff; /* Program hdr offset */
121 Elf64_Off e_shoff; /* Section hdr offset */ 121 Elf64_Off e_shoff; /* Section hdr offset */
122 Elf64_Word e_flags; /* Processor flags */ 122 Elf64_Word e_flags; /* Processor flags */
123 Elf64_Half e_ehsize; /* sizeof ehdr */ 123 Elf64_Half e_ehsize; /* sizeof ehdr */
124 Elf64_Half e_phentsize; /* Program header entry size */ 124 Elf64_Half e_phentsize; /* Program header entry size */
125 Elf64_Half e_phnum; /* Number of program headers */ 125 Elf64_Half e_phnum; /* Number of program headers */
126 Elf64_Half e_shentsize; /* Section header entry size */ 126 Elf64_Half e_shentsize; /* Section header entry size */
127 Elf64_Half e_shnum; /* Number of section headers */ 127 Elf64_Half e_shnum; /* Number of section headers */
128 Elf64_Half e_shstrndx; /* String table index */ 128 Elf64_Half e_shstrndx; /* String table index */
129} Elf64_Ehdr; 129} Elf64_Ehdr;
130 130
131/* e_ident offsets */ 131/* e_ident offsets */
132#define EI_MAG0 0 /* '\177' */ 132#define EI_MAG0 0 /* '\177' */
133#define EI_MAG1 1 /* 'E' */ 133#define EI_MAG1 1 /* 'E' */
134#define EI_MAG2 2 /* 'L' */ 134#define EI_MAG2 2 /* 'L' */
135#define EI_MAG3 3 /* 'F' */ 135#define EI_MAG3 3 /* 'F' */
136#define EI_CLASS 4 /* File class */ 136#define EI_CLASS 4 /* File class */
137#define EI_DATA 5 /* Data encoding */ 137#define EI_DATA 5 /* Data encoding */
138#define EI_VERSION 6 /* File version */ 138#define EI_VERSION 6 /* File version */
139#define EI_OSABI 7 /* Operating system/ABI identification */ 139#define EI_OSABI 7 /* Operating system/ABI identification */
140#define EI_ABIVERSION 8 /* ABI version */ 140#define EI_ABIVERSION 8 /* ABI version */
141#define EI_PAD 9 /* Start of padding bytes up to EI_NIDENT*/ 141#define EI_PAD 9 /* Start of padding bytes up to EI_NIDENT*/
142#define EI_NIDENT 16 /* First non-ident header byte */ 142#define EI_NIDENT 16 /* First non-ident header byte */
143 143
144/* e_ident[EI_MAG0,EI_MAG3] */ 144/* e_ident[EI_MAG0,EI_MAG3] */
145#define ELFMAG0 0x7f 145#define ELFMAG0 0x7f
146#define ELFMAG1 'E' 146#define ELFMAG1 'E'
147#define ELFMAG2 'L' 147#define ELFMAG2 'L'
148#define ELFMAG3 'F' 148#define ELFMAG3 'F'
149#define ELFMAG "\177ELF" 149#define ELFMAG "\177ELF"
150#define SELFMAG 4 150#define SELFMAG 4
151 151
152/* e_ident[EI_CLASS] */ 152/* e_ident[EI_CLASS] */
153#define ELFCLASSNONE 0 /* Invalid class */ 153#define ELFCLASSNONE 0 /* Invalid class */
154#define ELFCLASS32 1 /* 32-bit objects */ 154#define ELFCLASS32 1 /* 32-bit objects */
155#define ELFCLASS64 2 /* 64-bit objects */ 155#define ELFCLASS64 2 /* 64-bit objects */
156#define ELFCLASSNUM 3 156#define ELFCLASSNUM 3
157 157
158/* e_ident[EI_DATA] */ 158/* e_ident[EI_DATA] */
159#define ELFDATANONE 0 /* Invalid data encoding */ 159#define ELFDATANONE 0 /* Invalid data encoding */
160#define ELFDATA2LSB 1 /* 2's complement values, LSB first */ 160#define ELFDATA2LSB 1 /* 2's complement values, LSB first */
161#define ELFDATA2MSB 2 /* 2's complement values, MSB first */ 161#define ELFDATA2MSB 2 /* 2's complement values, MSB first */
162 162
163/* e_ident[EI_VERSION] */ 163/* e_ident[EI_VERSION] */
164#define EV_NONE 0 /* Invalid version */ 164#define EV_NONE 0 /* Invalid version */
165#define EV_CURRENT 1 /* Current version */ 165#define EV_CURRENT 1 /* Current version */
166#define EV_NUM 2 166#define EV_NUM 2
167 167
168/* e_ident[EI_OSABI] */ 168/* e_ident[EI_OSABI] */
169#define ELFOSABI_SYSV 0 /* UNIX System V ABI */ 169#define ELFOSABI_SYSV 0 /* UNIX System V ABI */
170#define ELFOSABI_HPUX 1 /* HP-UX operating system */ 170#define ELFOSABI_HPUX 1 /* HP-UX operating system */
171#define ELFOSABI_NETBSD 2 /* NetBSD */ 171#define ELFOSABI_NETBSD 2 /* NetBSD */
172#define ELFOSABI_LINUX 3 /* GNU/Linux */ 172#define ELFOSABI_GNU 3 /* GNU/Linux */
173#define ELFOSABI_HURD 4 /* GNU/Hurd */ 173#define ELFOSABI_HURD 4 /* GNU/Hurd - historical */
174#define ELFOSABI_86OPEN 5 /* 86Open */ 174#define ELFOSABI_86OPEN 5 /* 86Open - historical */
175#define ELFOSABI_SOLARIS 6 /* Solaris */ 175#define ELFOSABI_SOLARIS 6 /* Solaris */
176#define ELFOSABI_MONTEREY 7 /* Monterey */ 176#define ELFOSABI_AIX 7 /* AIX */
177#define ELFOSABI_IRIX 8 /* IRIX */ 177#define ELFOSABI_IRIX 8 /* IRIX */
178#define ELFOSABI_FREEBSD 9 /* FreeBSD */ 178#define ELFOSABI_FREEBSD 9 /* FreeBSD */
179#define ELFOSABI_TRU64 10 /* TRU64 UNIX */ 179#define ELFOSABI_TRU64 10 /* TRU64 UNIX */
180#define ELFOSABI_MODESTO 11 /* Novell Modesto */ 180#define ELFOSABI_MODESTO 11 /* Novell Modesto */
181#define ELFOSABI_OPENBSD 12 /* OpenBSD */ 181#define ELFOSABI_OPENBSD 12 /* OpenBSD */
182#define ELFOSABI_OPENVMS 13 /* OpenVMS */ 182#define ELFOSABI_OPENVMS 13 /* OpenVMS */
183#define ELFOSABI_NSK 14 /* HP Non-Stop Kernel */ 183#define ELFOSABI_NSK 14 /* HP Non-Stop Kernel */
184#define ELFOSABI_AROS 15 /* Amiga Research OS */ 184#define ELFOSABI_AROS 15 /* Amiga Research OS */
 185#define ELFOSABI_FENIXOS 16 /* The FenixOS highly scalable multi-core OS */
 186#define ELFOSABI_CLOUDABI 17 /* Nuxi CloudABI */
 187#define ELFOSABI_OPENVOS 18 /* Stratus Technologies OpenVOS */
185/* Unofficial OSABIs follow */ 188/* Unofficial OSABIs follow */
186#define ELFOSABI_ARM 97 /* ARM */ 189#define ELFOSABI_ARM 97 /* ARM */
187#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */ 190#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
188 191
189#define ELFOSABI_NONE ELFOSABI_SYSV 192#define ELFOSABI_NONE ELFOSABI_SYSV
190#define ELFOSABI_AIX ELFOSABI_MONTEREY 193
 194/* Historical aliases. */
 195#define ELFOSABI_LINUX ELFOSABI_GNU
 196#define ELFOSABI_MONTEREY ELFOSABI_AIX
191 197
192/* e_type */ 198/* e_type */
193#define ET_NONE 0 /* No file type */ 199#define ET_NONE 0 /* No file type */
194#define ET_REL 1 /* Relocatable file */ 200#define ET_REL 1 /* Relocatable file */
195#define ET_EXEC 2 /* Executable file */ 201#define ET_EXEC 2 /* Executable file */
196#define ET_DYN 3 /* Shared object file */ 202#define ET_DYN 3 /* Shared object file */
197#define ET_CORE 4 /* Core file */ 203#define ET_CORE 4 /* Core file */
198#define ET_NUM 5 204#define ET_NUM 5
199 205
200#define ET_LOOS 0xfe00 /* Operating system specific range */ 206#define ET_LOOS 0xfe00 /* Operating system specific range */
201#define ET_HIOS 0xfeff 207#define ET_HIOS 0xfeff
202#define ET_LOPROC 0xff00 /* Processor-specific range */ 208#define ET_LOPROC 0xff00 /* Processor-specific range */
203#define ET_HIPROC 0xffff 209#define ET_HIPROC 0xffff
204 210
205/* e_machine */ 211/* e_machine */
206#define EM_NONE 0 /* No machine */ 212#define EM_NONE 0 /* No machine */
207#define EM_M32 1 /* AT&T WE 32100 */ 213#define EM_M32 1 /* AT&T WE 32100 */
208#define EM_SPARC 2 /* SPARC */ 214#define EM_SPARC 2 /* SPARC */
209#define EM_386 3 /* Intel 80386 */ 215#define EM_386 3 /* Intel 80386 */
210#define EM_68K 4 /* Motorola 68000 */ 216#define EM_68K 4 /* Motorola 68000 */
211#define EM_88K 5 /* Motorola 88000 */ 217#define EM_88K 5 /* Motorola 88000 */
212#define EM_486 6 /* Intel 80486 [old] */ 218#define EM_486 6 /* Intel 80486 [old] */
213#define EM_IAMCU 6 /* Intel MCU. */ 219#define EM_IAMCU 6 /* Intel MCU. */
214#define EM_860 7 /* Intel 80860 */ 220#define EM_860 7 /* Intel 80860 */
215#define EM_MIPS 8 /* MIPS I Architecture */ 221#define EM_MIPS 8 /* MIPS I Architecture */
216#define EM_S370 9 /* Amdahl UTS on System/370 */ 222#define EM_S370 9 /* Amdahl UTS on System/370 */
217#define EM_MIPS_RS3_LE 10 /* MIPS RS3000 Little-endian */ 223#define EM_MIPS_RS3_LE 10 /* MIPS RS3000 Little-endian */
218 /* 11-14 - Reserved */ 224 /* 11-14 - Reserved */
219#define EM_RS6000 11 /* IBM RS/6000 XXX reserved */ 225#define EM_RS6000 11 /* IBM RS/6000 XXX reserved */
220#define EM_PARISC 15 /* Hewlett-Packard PA-RISC */ 226#define EM_PARISC 15 /* Hewlett-Packard PA-RISC */
221#define EM_NCUBE 16 /* NCube XXX reserved */ 227#define EM_NCUBE 16 /* NCube XXX reserved */
222#define EM_VPP500 17 /* Fujitsu VPP500 */ 228#define EM_VPP500 17 /* Fujitsu VPP500 */
223#define EM_SPARC32PLUS 18 /* Enhanced instruction set SPARC */ 229#define EM_SPARC32PLUS 18 /* Enhanced instruction set SPARC */
224#define EM_960 19 /* Intel 80960 */ 230#define EM_960 19 /* Intel 80960 */
225#define EM_PPC 20 /* PowerPC */ 231#define EM_PPC 20 /* PowerPC */
226#define EM_PPC64 21 /* 64-bit PowerPC */ 232#define EM_PPC64 21 /* 64-bit PowerPC */
227#define EM_S390 22 /* IBM System/390 Processor */ 233#define EM_S390 22 /* IBM System/390 Processor */
228#define EM_SPU 23 /* IBM SPU/SPC */ 234#define EM_SPU 23 /* IBM SPU/SPC */
229 /* 24-35 - Reserved */ 235 /* 24-35 - Reserved */
230#define EM_V800 36 /* NEC V800 */ 236#define EM_V800 36 /* NEC V800 */
231#define EM_FR20 37 /* Fujitsu FR20 */ 237#define EM_FR20 37 /* Fujitsu FR20 */
232#define EM_RH32 38 /* TRW RH-32 */ 238#define EM_RH32 38 /* TRW RH-32 */
233#define EM_RCE 39 /* Motorola RCE */ 239#define EM_RCE 39 /* Motorola RCE */
234#define EM_ARM 40 /* Advanced RISC Machines ARM */ 240#define EM_ARM 40 /* Advanced RISC Machines ARM */
235#define EM_ALPHA 41 /* DIGITAL Alpha */ 241#define EM_ALPHA 41 /* DIGITAL Alpha */
236#define EM_SH 42 /* Hitachi Super-H */ 242#define EM_SH 42 /* Hitachi Super-H */
237#define EM_SPARCV9 43 /* SPARC Version 9 */ 243#define EM_SPARCV9 43 /* SPARC Version 9 */
238#define EM_TRICORE 44 /* Siemens Tricore */ 244#define EM_TRICORE 44 /* Siemens Tricore */
239#define EM_ARC 45 /* Argonaut RISC Core */ 245#define EM_ARC 45 /* Argonaut RISC Core */
240#define EM_H8_300 46 /* Hitachi H8/300 */ 246#define EM_H8_300 46 /* Hitachi H8/300 */
241#define EM_H8_300H 47 /* Hitachi H8/300H */ 247#define EM_H8_300H 47 /* Hitachi H8/300H */
242#define EM_H8S 48 /* Hitachi H8S */ 248#define EM_H8S 48 /* Hitachi H8S */
243#define EM_H8_500 49 /* Hitachi H8/500 */ 249#define EM_H8_500 49 /* Hitachi H8/500 */
244#define EM_IA_64 50 /* Intel Merced Processor */ 250#define EM_IA_64 50 /* Intel Merced Processor */
245#define EM_MIPS_X 51 /* Stanford MIPS-X */ 251#define EM_MIPS_X 51 /* Stanford MIPS-X */
246#define EM_COLDFIRE 52 /* Motorola Coldfire */ 252#define EM_COLDFIRE 52 /* Motorola Coldfire */
247#define EM_68HC12 53 /* Motorola MC68HC12 */ 253#define EM_68HC12 53 /* Motorola MC68HC12 */
248#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator */ 254#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator */
249#define EM_PCP 55 /* Siemens PCP */ 255#define EM_PCP 55 /* Siemens PCP */
250#define EM_NCPU 56 /* Sony nCPU embedded RISC processor */ 256#define EM_NCPU 56 /* Sony nCPU embedded RISC processor */
251#define EM_NDR1 57 /* Denso NDR1 microprocessor */ 257#define EM_NDR1 57 /* Denso NDR1 microprocessor */
252#define EM_STARCORE 58 /* Motorola Star*Core processor */ 258#define EM_STARCORE 58 /* Motorola Star*Core processor */
253#define EM_ME16 59 /* Toyota ME16 processor */ 259#define EM_ME16 59 /* Toyota ME16 processor */
254#define EM_ST100 60 /* STMicroelectronics ST100 processor */ 260#define EM_ST100 60 /* STMicroelectronics ST100 processor */
255#define EM_TINYJ 61 /* Advanced Logic Corp. TinyJ embedded family processor */ 261#define EM_TINYJ 61 /* Advanced Logic Corp. TinyJ embedded family processor */
256#define EM_X86_64 62 /* AMD x86-64 architecture */ 262#define EM_X86_64 62 /* AMD x86-64 architecture */
257#define EM_PDSP 63 /* Sony DSP Processor */ 263#define EM_PDSP 63 /* Sony DSP Processor */
258#define EM_PDP10 64 /* Digital Equipment Corp. PDP-10 */ 264#define EM_PDP10 64 /* Digital Equipment Corp. PDP-10 */
259#define EM_PDP11 65 /* Digital Equipment Corp. PDP-11 */ 265#define EM_PDP11 65 /* Digital Equipment Corp. PDP-11 */
260#define EM_FX66 66 /* Siemens FX66 microcontroller */ 266#define EM_FX66 66 /* Siemens FX66 microcontroller */
261#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 bit microcontroller */ 267#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 bit microcontroller */
262#define EM_ST7 68 /* STMicroelectronics ST7 8-bit microcontroller */ 268#define EM_ST7 68 /* STMicroelectronics ST7 8-bit microcontroller */
263#define EM_68HC16 69 /* Motorola MC68HC16 Microcontroller */ 269#define EM_68HC16 69 /* Motorola MC68HC16 Microcontroller */
264#define EM_68HC11 70 /* Motorola MC68HC11 Microcontroller */ 270#define EM_68HC11 70 /* Motorola MC68HC11 Microcontroller */
265#define EM_68HC08 71 /* Motorola MC68HC08 Microcontroller */ 271#define EM_68HC08 71 /* Motorola MC68HC08 Microcontroller */
266#define EM_68HC05 72 /* Motorola MC68HC05 Microcontroller */ 272#define EM_68HC05 72 /* Motorola MC68HC05 Microcontroller */
267#define EM_SVX 73 /* Silicon Graphics SVx */ 273#define EM_SVX 73 /* Silicon Graphics SVx */
268#define EM_ST19 74 /* STMicroelectronics ST19 8-bit CPU */ 274#define EM_ST19 74 /* STMicroelectronics ST19 8-bit CPU */
269#define EM_VAX 75 /* Digital VAX */ 275#define EM_VAX 75 /* Digital VAX */
270#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */ 276#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */
271#define EM_JAVELIN 77 /* Infineon Technologies 32-bit embedded CPU */ 277#define EM_JAVELIN 77 /* Infineon Technologies 32-bit embedded CPU */
272#define EM_FIREPATH 78 /* Element 14 64-bit DSP processor */ 278#define EM_FIREPATH 78 /* Element 14 64-bit DSP processor */
273#define EM_ZSP 79 /* LSI Logic's 16-bit DSP processor */ 279#define EM_ZSP 79 /* LSI Logic's 16-bit DSP processor */
274#define EM_MMIX 80 /* Donald Knuth's educational 64-bit processor */ 280#define EM_MMIX 80 /* Donald Knuth's educational 64-bit processor */
275#define EM_HUANY 81 /* Harvard's machine-independent format */ 281#define EM_HUANY 81 /* Harvard's machine-independent format */
276#define EM_PRISM 82 /* SiTera Prism */ 282#define EM_PRISM 82 /* SiTera Prism */
277#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */ 283#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */
278#define EM_FR30 84 /* Fujitsu FR30 */ 284#define EM_FR30 84 /* Fujitsu FR30 */
279#define EM_D10V 85 /* Mitsubishi D10V */ 285#define EM_D10V 85 /* Mitsubishi D10V */
280#define EM_D30V 86 /* Mitsubishi D30V */ 286#define EM_D30V 86 /* Mitsubishi D30V */
281#define EM_V850 87 /* NEC v850 */ 287#define EM_V850 87 /* NEC v850 */
282#define EM_M32R 88 /* Mitsubishi M32R */ 288#define EM_M32R 88 /* Mitsubishi M32R */
283#define EM_MN10300 89 /* Matsushita MN10300 */ 289#define EM_MN10300 89 /* Matsushita MN10300 */
284#define EM_MN10200 90 /* Matsushita MN10200 */ 290#define EM_MN10200 90 /* Matsushita MN10200 */
285#define EM_PJ 91 /* picoJava */ 291#define EM_PJ 91 /* picoJava */
286#define EM_OR1K 92 /* OpenRISC 32-bit embedded processor */ 292#define EM_OR1K 92 /* OpenRISC 32-bit embedded processor */
287#define EM_OPENRISC EM_OR1K 293#define EM_OPENRISC EM_OR1K
288#define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */ 294#define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */
289#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */ 295#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */
290#define EM_VIDEOCORE 95 /* Alphamosaic VideoCore processor */ 296#define EM_VIDEOCORE 95 /* Alphamosaic VideoCore processor */
291#define EM_TMM_GPP 96 /* Thompson Multimedia General Purpose Processor */ 297#define EM_TMM_GPP 96 /* Thompson Multimedia General Purpose Processor */
292#define EM_NS32K 97 /* National Semiconductor 32000 series */ 298#define EM_NS32K 97 /* National Semiconductor 32000 series */
293#define EM_TPC 98 /* Tenor Network TPC processor */ 299#define EM_TPC 98 /* Tenor Network TPC processor */
294#define EM_SNP1K 99 /* Trebia SNP 1000 processor */ 300#define EM_SNP1K 99 /* Trebia SNP 1000 processor */
295#define EM_ST200 100 /* STMicroelectronics ST200 microcontroller */ 301#define EM_ST200 100 /* STMicroelectronics ST200 microcontroller */
296#define EM_IP2K 101 /* Ubicom IP2xxx microcontroller family */ 302#define EM_IP2K 101 /* Ubicom IP2xxx microcontroller family */
297#define EM_MAX 102 /* MAX processor */ 303#define EM_MAX 102 /* MAX processor */
298#define EM_CR 103 /* National Semiconductor CompactRISC micorprocessor */ 304#define EM_CR 103 /* National Semiconductor CompactRISC micorprocessor */
299#define EM_F2MC16 104 /* Fujitsu F2MC16 */ 305#define EM_F2MC16 104 /* Fujitsu F2MC16 */
300#define EM_MSP430 105 /* Texas Instruments MSP430 */ 306#define EM_MSP430 105 /* Texas Instruments MSP430 */
301#define EM_BLACKFIN 106 /* Analog Devices Blackfin DSP */ 307#define EM_BLACKFIN 106 /* Analog Devices Blackfin DSP */
302#define EM_SE_C33 107 /* Seiko Epson S1C33 family */ 308#define EM_SE_C33 107 /* Seiko Epson S1C33 family */
303#define EM_SEP 108 /* Sharp embedded microprocessor */ 309#define EM_SEP 108 /* Sharp embedded microprocessor */
304#define EM_ARCA 109 /* Arca RISC microprocessor */ 310#define EM_ARCA 109 /* Arca RISC microprocessor */
305#define EM_UNICORE 110 /* UNICORE from PKU-Unity Ltd. and MPRC Peking University */ 311#define EM_UNICORE 110 /* UNICORE from PKU-Unity Ltd. and MPRC Peking University */
306#define EM_EXCESS 111 /* eXcess: 16/32/64-bit configurable embedded CPU */ 312#define EM_EXCESS 111 /* eXcess: 16/32/64-bit configurable embedded CPU */
307#define EM_DXP 112 /* Icera Semiconductor Inc. Deep Execution Processor */ 313#define EM_DXP 112 /* Icera Semiconductor Inc. Deep Execution Processor */
308#define EM_ALTERA_NIOS2 113 /* Altera Nios II soft-core processor */ 314#define EM_ALTERA_NIOS2 113 /* Altera Nios II soft-core processor */
309#define EM_CRX 114 /* National Semiconductor CompactRISC CRX microprocessor */ 315#define EM_CRX 114 /* National Semiconductor CompactRISC CRX microprocessor */
310#define EM_XGATE 115 /* Motorola XGATE embedded processor */ 316#define EM_XGATE 115 /* Motorola XGATE embedded processor */
311#define EM_C166 116 /* Infineon C16x/XC16x processor */ 317#define EM_C166 116 /* Infineon C16x/XC16x processor */
312#define EM_M16C 117 /* Renesas M16C series microprocessors */ 318#define EM_M16C 117 /* Renesas M16C series microprocessors */
313#define EM_DSPIC30F 118 /* Microchip Technology dsPIC30F Digital Signal Controller */ 319#define EM_DSPIC30F 118 /* Microchip Technology dsPIC30F Digital Signal Controller */
314#define EM_CE 119 /* Freescale Communication Engine RISC core */ 320#define EM_CE 119 /* Freescale Communication Engine RISC core */
315#define EM_M32C 120 /* Renesas M32C series microprocessors */ 321#define EM_M32C 120 /* Renesas M32C series microprocessors */
316 /* 121-130 - Reserved */ 322 /* 121-130 - Reserved */
317#define EM_TSK3000 131 /* Altium TSK3000 core */ 323#define EM_TSK3000 131 /* Altium TSK3000 core */
318#define EM_RS08 132 /* Freescale RS08 embedded processor */ 324#define EM_RS08 132 /* Freescale RS08 embedded processor */
319#define EM_SHARC 133 /* Analog Devices SHARC family of 32-bit DSP processors */ 325#define EM_SHARC 133 /* Analog Devices SHARC family of 32-bit DSP processors */
320#define EM_ECOG2 134 /* Cyan Technology eCOG2 microprocessor */ 326#define EM_ECOG2 134 /* Cyan Technology eCOG2 microprocessor */
321#define EM_SCORE7 135 /* Sunplus S+core7 RISC processor */ 327#define EM_SCORE7 135 /* Sunplus S+core7 RISC processor */
322#define EM_DSP24 136 /* New Japan Radio (NJR) 24-bit DSP Processor */ 328#define EM_DSP24 136 /* New Japan Radio (NJR) 24-bit DSP Processor */
323#define EM_VIDEOCORE3 137 /* Broadcom VideoCore III processor */ 329#define EM_VIDEOCORE3 137 /* Broadcom VideoCore III processor */
324#define EM_LATTICEMICO32 138 /* RISC processor for Lattice FPGA architecture */ 330#define EM_LATTICEMICO32 138 /* RISC processor for Lattice FPGA architecture */
325#define EM_SE_C17 139 /* Seiko Epson C17 family */ 331#define EM_SE_C17 139 /* Seiko Epson C17 family */
326#define EM_TI_C6000 140 /* The Texas Instruments TMS320C6000 DSP family */ 332#define EM_TI_C6000 140 /* The Texas Instruments TMS320C6000 DSP family */
327#define EM_TI_C2000 141 /* The Texas Instruments TMS320C2000 DSP family */ 333#define EM_TI_C2000 141 /* The Texas Instruments TMS320C2000 DSP family */
328#define EM_TI_C5500 142 /* The Texas Instruments TMS320C55x DSP family */ 334#define EM_TI_C5500 142 /* The Texas Instruments TMS320C55x DSP family */
329#define EM_TI_ARP32 143 /* Texas Instruments Application Specific RISC Processor, 32bit fetch */ 335#define EM_TI_ARP32 143 /* Texas Instruments Application Specific RISC Processor, 32bit fetch */
330#define EM_TI_PRU 144 /* Texas Instruments Programmable Realtime Unit */ 336#define EM_TI_PRU 144 /* Texas Instruments Programmable Realtime Unit */
331 /* 145-159 - Reserved */ 337 /* 145-159 - Reserved */
332#define EM_MMDSP_PLUS 160 /* STMicroelectronics 64bit VLIW Data Signal Processor */ 338#define EM_MMDSP_PLUS 160 /* STMicroelectronics 64bit VLIW Data Signal Processor */
333#define EM_CYPRESS_M8C 161 /* Cypress M8C microprocessor */ 339#define EM_CYPRESS_M8C 161 /* Cypress M8C microprocessor */
334#define EM_R32C 162 /* Renesas R32C series microprocessors */ 340#define EM_R32C 162 /* Renesas R32C series microprocessors */
335#define EM_TRIMEDIA 163 /* NXP Semiconductors TriMedia architecture family */ 341#define EM_TRIMEDIA 163 /* NXP Semiconductors TriMedia architecture family */
336#define EM_QDSP6 164 /* QUALCOMM DSP6 Processor */ 342#define EM_QDSP6 164 /* QUALCOMM DSP6 Processor */
337#define EM_8051 165 /* Intel 8051 and variants */ 343#define EM_8051 165 /* Intel 8051 and variants */
338#define EM_STXP7X 166 /* STMicroelectronics STxP7x family of configurable and extensible RISC processors */ 344#define EM_STXP7X 166 /* STMicroelectronics STxP7x family of configurable and extensible RISC processors */
339#define EM_NDS32 167 /* Andes Technology compact code size embedded RISC processor family */ 345#define EM_NDS32 167 /* Andes Technology compact code size embedded RISC processor family */
340#define EM_ECOG1 168 /* Cyan Technology eCOG1X family */ 346#define EM_ECOG1 168 /* Cyan Technology eCOG1X family */
341#define EM_ECOG1X 168 /* Cyan Technology eCOG1X family */ 347#define EM_ECOG1X 168 /* Cyan Technology eCOG1X family */
342#define EM_MAXQ30 169 /* Dallas Semiconductor MAXQ30 Core Micro-controllers */ 348#define EM_MAXQ30 169 /* Dallas Semiconductor MAXQ30 Core Micro-controllers */
343#define EM_XIMO16 170 /* New Japan Radio (NJR) 16-bit DSP Processor */ 349#define EM_XIMO16 170 /* New Japan Radio (NJR) 16-bit DSP Processor */
344#define EM_MANIK 171 /* M2000 Reconfigurable RISC Microprocessor */ 350#define EM_MANIK 171 /* M2000 Reconfigurable RISC Microprocessor */
345#define EM_CRAYNV2 172 /* Cray Inc. NV2 vector architecture */ 351#define EM_CRAYNV2 172 /* Cray Inc. NV2 vector architecture */
346#define EM_RX 173 /* Renesas RX family */ 352#define EM_RX 173 /* Renesas RX family */
347#define EM_METAG 174 /* Imagination Technologies META processor architecture */ 353#define EM_METAG 174 /* Imagination Technologies META processor architecture */
348#define EM_MCST_ELBRUS 175 /* MCST Elbrus general purpose hardware architecture */ 354#define EM_MCST_ELBRUS 175 /* MCST Elbrus general purpose hardware architecture */
349#define EM_ECOG16 176 /* Cyan Technology eCOG16 family */ 355#define EM_ECOG16 176 /* Cyan Technology eCOG16 family */
350#define EM_CR16 177 /* National Semiconductor CompactRISC CR16 16-bit microprocessor */ 356#define EM_CR16 177 /* National Semiconductor CompactRISC CR16 16-bit microprocessor */
351#define EM_ETPU 178 /* Freescale Extended Time Processing Unit */ 357#define EM_ETPU 178 /* Freescale Extended Time Processing Unit */
352#define EM_SLE9X 179 /* Infineon Technologies SLE9X core */ 358#define EM_SLE9X 179 /* Infineon Technologies SLE9X core */
353#define EM_L10M 180 /* Intel L10M */ 359#define EM_L10M 180 /* Intel L10M */
354#define EM_K10M 181 /* Intel K10M */ 360#define EM_K10M 181 /* Intel K10M */
355 /* 182 - Reserved */ 361 /* 182 - Reserved */
356#define EM_AARCH64 183 /* AArch64 64-bit ARM microprocessor */ 362#define EM_AARCH64 183 /* AArch64 64-bit ARM microprocessor */
357 /* 184 - Reserved */ 363 /* 184 - Reserved */
358#define EM_AVR32 185 /* Atmel Corporation 32-bit microprocessor family*/ 364#define EM_AVR32 185 /* Atmel Corporation 32-bit microprocessor family*/
359#define EM_TILE64 187 /* Tilera TILE64 multicore architecture family */ 365#define EM_TILE64 187 /* Tilera TILE64 multicore architecture family */
360#define EM_TILEPRO 188 /* Tilera TILEPro multicore architecture family */ 366#define EM_TILEPRO 188 /* Tilera TILEPro multicore architecture family */
361#define EM_MICROBLAZE 189 /* Xilinx MicroBlaze 32-bit RISC soft processor core */ 367#define EM_MICROBLAZE 189 /* Xilinx MicroBlaze 32-bit RISC soft processor core */
362#define EM_CUDA 190 /* NVIDIA CUDA architecture */ 368#define EM_CUDA 190 /* NVIDIA CUDA architecture */
363#define EM_TILEGX 191 /* Tilera TILE-GX multicore architecture family */ 369#define EM_TILEGX 191 /* Tilera TILE-GX multicore architecture family */
364#define EM_CLOUDSHIELD 192 /* CloudShield architecture family */ 370#define EM_CLOUDSHIELD 192 /* CloudShield architecture family */
365#define EM_COREA_1ST 193 /* KIPO-KAIST Core-A 1st generation processor family */ 371#define EM_COREA_1ST 193 /* KIPO-KAIST Core-A 1st generation processor family */
366#define EM_COREA_2ND 194 /* KIPO-KAIST Core-A 2nd generation processor family */ 372#define EM_COREA_2ND 194 /* KIPO-KAIST Core-A 2nd generation processor family */
367#define EM_ARC_COMPACT2 195 /* Synopsys ARCompact V2 */ 373#define EM_ARC_COMPACT2 195 /* Synopsys ARCompact V2 */
368#define EM_OPEN8 196 /* Open8 8-bit RISC soft processor core */ 374#define EM_OPEN8 196 /* Open8 8-bit RISC soft processor core */
369#define EM_RL78 197 /* Renesas RL78 family */ 375#define EM_RL78 197 /* Renesas RL78 family */
370#define EM_VIDEOCORE5 198 /* Broadcom VideoCore V processor */ 376#define EM_VIDEOCORE5 198 /* Broadcom VideoCore V processor */
371#define EM_78KOR 199 /* Renesas 78KOR family */ 377#define EM_78KOR 199 /* Renesas 78KOR family */
372#define EM_56800EX 200 /* Freescale 56800EX Digital Signal Controller (DSC) */ 378#define EM_56800EX 200 /* Freescale 56800EX Digital Signal Controller (DSC) */
373#define EM_BA1 201 /* Beyond BA1 CPU architecture */ 379#define EM_BA1 201 /* Beyond BA1 CPU architecture */
374#define EM_BA2 202 /* Beyond BA2 CPU architecture */ 380#define EM_BA2 202 /* Beyond BA2 CPU architecture */
375#define EM_XCORE 203 /* XMOS xCORE processor family */ 381#define EM_XCORE 203 /* XMOS xCORE processor family */
376#define EM_MCHP_PIC 204 /* Microchip 8-bit PIC(r) family */ 382#define EM_MCHP_PIC 204 /* Microchip 8-bit PIC(r) family */
377#define EM_INTEL205 205 /* Reserved by Intel */ 383#define EM_INTEL205 205 /* Reserved by Intel */
378#define EM_INTEL206 206 /* Reserved by Intel */ 384#define EM_INTEL206 206 /* Reserved by Intel */
379#define EM_INTEL207 207 /* Reserved by Intel */ 385#define EM_INTEL207 207 /* Reserved by Intel */
380#define EM_INTEL208 208 /* Reserved by Intel */ 386#define EM_INTEL208 208 /* Reserved by Intel */
381#define EM_INTEL209 209 /* Reserved by Intel */ 387#define EM_INTEL209 209 /* Reserved by Intel */
382#define EM_KM32 210 /* KM211 KM32 32-bit processor */ 388#define EM_KM32 210 /* KM211 KM32 32-bit processor */
383#define EM_KMX32 211 /* KM211 KMX32 32-bit processor */ 389#define EM_KMX32 211 /* KM211 KMX32 32-bit processor */
384#define EM_KMX16 212 /* KM211 KMX16 16-bit processor */ 390#define EM_KMX16 212 /* KM211 KMX16 16-bit processor */
385#define EM_KMX8 213 /* KM211 KMX8 8-bit processor */ 391#define EM_KMX8 213 /* KM211 KMX8 8-bit processor */
386#define EM_KVARC 214 /* KM211 KVARC processor */ 392#define EM_KVARC 214 /* KM211 KVARC processor */
387#define EM_CDP 215 /* Paneve CDP architecture family */ 393#define EM_CDP 215 /* Paneve CDP architecture family */
388#define EM_COGE 216 /* Cognitive Smart Memory Processor */ 394#define EM_COGE 216 /* Cognitive Smart Memory Processor */
389#define EM_COOL 217 /* Bluechip Systems CoolEngine */ 395#define EM_COOL 217 /* Bluechip Systems CoolEngine */
390#define EM_NORC 218 /* Nanoradio Optimized RISC */ 396#define EM_NORC 218 /* Nanoradio Optimized RISC */
391#define EM_CSR_KALIMBA 219 /* CSR Kalimba architecture family */ 397#define EM_CSR_KALIMBA 219 /* CSR Kalimba architecture family */
392#define EM_Z80 220 /* Zilog Z80 */ 398#define EM_Z80 220 /* Zilog Z80 */
393#define EM_VISIUM 221 /* Controls and Data Services VISIUMcore processor */ 399#define EM_VISIUM 221 /* Controls and Data Services VISIUMcore processor */
394#define EM_FT32 222 /* FTDI Chip FT32 high performance 32-bit RISC architecture */ 400#define EM_FT32 222 /* FTDI Chip FT32 high performance 32-bit RISC architecture */
395#define EM_MOXIE 223 /* Moxie processor family */ 401#define EM_MOXIE 223 /* Moxie processor family */
396#define EM_AMDGPU 224 /* AMD GPU architecture */ 402#define EM_AMDGPU 224 /* AMD GPU architecture */
397 /* 225-242 - Reserved */ 403 /* 225-242 - Reserved */
398#define EM_RISCV 243 /* RISC-V */ 404#define EM_RISCV 243 /* RISC-V */
399 405
400/* Unofficial machine types follow */ 406/* Unofficial machine types follow */
401#define EM_ALPHA_EXP 36902 /* used by NetBSD/alpha; obsolete */ 407#define EM_ALPHA_EXP 36902 /* used by NetBSD/alpha; obsolete */
402#define EM_NUM 36903 408#define EM_NUM 36903
403 409
404/* 410/*
405 * Program Header 411 * Program Header
406 */ 412 */
407typedef struct { 413typedef struct {
408 Elf32_Word p_type; /* entry type */ 414 Elf32_Word p_type; /* entry type */
409 Elf32_Off p_offset; /* offset */ 415 Elf32_Off p_offset; /* offset */
410 Elf32_Addr p_vaddr; /* virtual address */ 416 Elf32_Addr p_vaddr; /* virtual address */
411 Elf32_Addr p_paddr; /* physical address */ 417 Elf32_Addr p_paddr; /* physical address */
412 Elf32_Word p_filesz; /* file size */ 418 Elf32_Word p_filesz; /* file size */
413 Elf32_Word p_memsz; /* memory size */ 419 Elf32_Word p_memsz; /* memory size */
414 Elf32_Word p_flags; /* flags */ 420 Elf32_Word p_flags; /* flags */
415 Elf32_Word p_align; /* memory & file alignment */ 421 Elf32_Word p_align; /* memory & file alignment */
416} Elf32_Phdr; 422} Elf32_Phdr;
417 423
418typedef struct { 424typedef struct {
419 Elf64_Word p_type; /* entry type */ 425 Elf64_Word p_type; /* entry type */
420 Elf64_Word p_flags; /* flags */ 426 Elf64_Word p_flags; /* flags */
421 Elf64_Off p_offset; /* offset */ 427 Elf64_Off p_offset; /* offset */
422 Elf64_Addr p_vaddr; /* virtual address */ 428 Elf64_Addr p_vaddr; /* virtual address */
423 Elf64_Addr p_paddr; /* physical address */ 429 Elf64_Addr p_paddr; /* physical address */
424 Elf64_Xword p_filesz; /* file size */ 430 Elf64_Xword p_filesz; /* file size */
425 Elf64_Xword p_memsz; /* memory size */ 431 Elf64_Xword p_memsz; /* memory size */
426 Elf64_Xword p_align; /* memory & file alignment */ 432 Elf64_Xword p_align; /* memory & file alignment */
427} Elf64_Phdr; 433} Elf64_Phdr;
428 434
429/* p_type */ 435/* p_type */
430#define PT_NULL 0 /* Program header table entry unused */ 436#define PT_NULL 0 /* Program header table entry unused */
431#define PT_LOAD 1 /* Loadable program segment */ 437#define PT_LOAD 1 /* Loadable program segment */
432#define PT_DYNAMIC 2 /* Dynamic linking information */ 438#define PT_DYNAMIC 2 /* Dynamic linking information */
433#define PT_INTERP 3 /* Program interpreter */ 439#define PT_INTERP 3 /* Program interpreter */
434#define PT_NOTE 4 /* Auxiliary information */ 440#define PT_NOTE 4 /* Auxiliary information */
435#define PT_SHLIB 5 /* Reserved, unspecified semantics */ 441#define PT_SHLIB 5 /* Reserved, unspecified semantics */
436#define PT_PHDR 6 /* Entry for header table itself */ 442#define PT_PHDR 6 /* Entry for header table itself */
437#define PT_TLS 7 /* TLS initialisation image */ 443#define PT_TLS 7 /* TLS initialisation image */
438#define PT_NUM 8 444#define PT_NUM 8
439 445
440#define PT_LOOS 0x60000000 /* OS-specific range */ 446#define PT_LOOS 0x60000000 /* OS-specific range */
441 447
442/* GNU-specific */ 448/* GNU-specific */
443#define PT_GNU_EH_FRAME 0x6474e550 /* EH frame segment */ 449#define PT_GNU_EH_FRAME 0x6474e550 /* EH frame segment */
444#define PT_GNU_STACK 0x6474e551 /* Indicate executable stack */ 450#define PT_GNU_STACK 0x6474e551 /* Indicate executable stack */
445#define PT_GNU_RELRO 0x6474e552 /* Make read-only after relocation */ 451#define PT_GNU_RELRO 0x6474e552 /* Make read-only after relocation */
446 452
447#define PT_HIOS 0x6fffffff 453#define PT_HIOS 0x6fffffff
448#define PT_LOPROC 0x70000000 /* Processor-specific range */ 454#define PT_LOPROC 0x70000000 /* Processor-specific range */
449#define PT_HIPROC 0x7fffffff 455#define PT_HIPROC 0x7fffffff
450 456
451#define PT_MIPS_REGINFO 0x70000000 457#define PT_MIPS_REGINFO 0x70000000
452#define PT_MIPS_ABIFLAGS 0x70000003 458#define PT_MIPS_ABIFLAGS 0x70000003
453 459
454/* p_flags */ 460/* p_flags */
455#define PF_R 0x4 /* Segment is readable */ 461#define PF_R 0x4 /* Segment is readable */
456#define PF_W 0x2 /* Segment is writable */ 462#define PF_W 0x2 /* Segment is writable */
457#define PF_X 0x1 /* Segment is executable */ 463#define PF_X 0x1 /* Segment is executable */
458 464
459#define PF_MASKOS 0x0ff00000 /* Operating system specific values */ 465#define PF_MASKOS 0x0ff00000 /* Operating system specific values */
460#define PF_MASKPROC 0xf0000000 /* Processor-specific values */ 466#define PF_MASKPROC 0xf0000000 /* Processor-specific values */
461 467
462/* Extended program header index. */ 468/* Extended program header index. */
463#define PN_XNUM 0xffff 469#define PN_XNUM 0xffff
464 470
465/* 471/*
466 * Section Headers 472 * Section Headers
467 */ 473 */
468typedef struct { 474typedef struct {
469 Elf32_Word sh_name; /* section name (.shstrtab index) */ 475 Elf32_Word sh_name; /* section name (.shstrtab index) */
470 Elf32_Word sh_type; /* section type */ 476 Elf32_Word sh_type; /* section type */
471 Elf32_Word sh_flags; /* section flags */ 477 Elf32_Word sh_flags; /* section flags */
472 Elf32_Addr sh_addr; /* virtual address */ 478 Elf32_Addr sh_addr; /* virtual address */
473 Elf32_Off sh_offset; /* file offset */ 479 Elf32_Off sh_offset; /* file offset */
474 Elf32_Word sh_size; /* section size */ 480 Elf32_Word sh_size; /* section size */
475 Elf32_Word sh_link; /* link to another */ 481 Elf32_Word sh_link; /* link to another */
476 Elf32_Word sh_info; /* misc info */ 482 Elf32_Word sh_info; /* misc info */
477 Elf32_Word sh_addralign; /* memory alignment */ 483 Elf32_Word sh_addralign; /* memory alignment */
478 Elf32_Word sh_entsize; /* table entry size */ 484 Elf32_Word sh_entsize; /* table entry size */
479} Elf32_Shdr; 485} Elf32_Shdr;
480 486
481typedef struct { 487typedef struct {
482 Elf64_Word sh_name; /* section name (.shstrtab index) */ 488 Elf64_Word sh_name; /* section name (.shstrtab index) */
483 Elf64_Word sh_type; /* section type */ 489 Elf64_Word sh_type; /* section type */
484 Elf64_Xword sh_flags; /* section flags */ 490 Elf64_Xword sh_flags; /* section flags */
485 Elf64_Addr sh_addr; /* virtual address */ 491 Elf64_Addr sh_addr; /* virtual address */
486 Elf64_Off sh_offset; /* file offset */ 492 Elf64_Off sh_offset; /* file offset */
487 Elf64_Xword sh_size; /* section size */ 493 Elf64_Xword sh_size; /* section size */
488 Elf64_Word sh_link; /* link to another */ 494 Elf64_Word sh_link; /* link to another */
489 Elf64_Word sh_info; /* misc info */ 495 Elf64_Word sh_info; /* misc info */
490 Elf64_Xword sh_addralign; /* memory alignment */ 496 Elf64_Xword sh_addralign; /* memory alignment */
491 Elf64_Xword sh_entsize; /* table entry size */ 497 Elf64_Xword sh_entsize; /* table entry size */
492} Elf64_Shdr; 498} Elf64_Shdr;
493 499
494/* sh_type */ 500/* sh_type */
495#define SHT_NULL 0 /* Section header table entry unused */ 501#define SHT_NULL 0 /* Section header table entry unused */
496#define SHT_PROGBITS 1 /* Program information */ 502#define SHT_PROGBITS 1 /* Program information */
497#define SHT_SYMTAB 2 /* Symbol table */ 503#define SHT_SYMTAB 2 /* Symbol table */
498#define SHT_STRTAB 3 /* String table */ 504#define SHT_STRTAB 3 /* String table */
499#define SHT_RELA 4 /* Relocation information w/ addend */ 505#define SHT_RELA 4 /* Relocation information w/ addend */
500#define SHT_HASH 5 /* Symbol hash table */ 506#define SHT_HASH 5 /* Symbol hash table */
501#define SHT_DYNAMIC 6 /* Dynamic linking information */ 507#define SHT_DYNAMIC 6 /* Dynamic linking information */
502#define SHT_NOTE 7 /* Auxiliary information */ 508#define SHT_NOTE 7 /* Auxiliary information */
503#define SHT_NOBITS 8 /* No space allocated in file image */ 509#define SHT_NOBITS 8 /* No space allocated in file image */
504#define SHT_REL 9 /* Relocation information w/o addend */ 510#define SHT_REL 9 /* Relocation information w/o addend */
505#define SHT_SHLIB 10 /* Reserved, unspecified semantics */ 511#define SHT_SHLIB 10 /* Reserved, unspecified semantics */
506#define SHT_DYNSYM 11 /* Symbol table for dynamic linker */ 512#define SHT_DYNSYM 11 /* Symbol table for dynamic linker */
507#define SHT_INIT_ARRAY 14 /* Initialization function pointers */ 513#define SHT_INIT_ARRAY 14 /* Initialization function pointers */
508#define SHT_FINI_ARRAY 15 /* Termination function pointers */ 514#define SHT_FINI_ARRAY 15 /* Termination function pointers */
509#define SHT_PREINIT_ARRAY 16 /* Pre-initialization function ptrs */ 515#define SHT_PREINIT_ARRAY 16 /* Pre-initialization function ptrs */
510#define SHT_GROUP 17 /* Section group */ 516#define SHT_GROUP 17 /* Section group */
511#define SHT_SYMTAB_SHNDX 18 /* Section indexes (see SHN_XINDEX) */ 517#define SHT_SYMTAB_SHNDX 18 /* Section indexes (see SHN_XINDEX) */
512#define SHT_NUM 19 518#define SHT_NUM 19
513 519
514#define SHT_LOOS 0x60000000 /* Operating system specific range */ 520#define SHT_LOOS 0x60000000 /* Operating system specific range */
515#define SHT_GNU_INCREMENTAL_INPUTS 0x6fff4700 /* GNU incremental build data */ 521#define SHT_GNU_INCREMENTAL_INPUTS 0x6fff4700 /* GNU incremental build data */
516#define SHT_LOSUNW 0x6ffffff4 522#define SHT_LOSUNW 0x6ffffff4
517#define SHT_SUNW_dof 0x6ffffff4 523#define SHT_SUNW_dof 0x6ffffff4
518#define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* GNU object attributes */ 524#define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* GNU object attributes */
519#define SHT_SUNW_cap 0x6ffffff5 525#define SHT_SUNW_cap 0x6ffffff5
520#define SHT_SUNW_SIGNATURE 0x6ffffff6 526#define SHT_SUNW_SIGNATURE 0x6ffffff6
521#define SHT_GNU_HASH 0x6ffffff6 /* GNU style symbol hash table */ 527#define SHT_GNU_HASH 0x6ffffff6 /* GNU style symbol hash table */
522#define SHT_GNU_LIBLIST 0x6ffffff7 /* GNU list of prelink dependencies */ 528#define SHT_GNU_LIBLIST 0x6ffffff7 /* GNU list of prelink dependencies */
523#define SHT_SUNW_move 0x6ffffffa 529#define SHT_SUNW_move 0x6ffffffa
524#define SHT_SUNW_COMDAT 0x6ffffffb 530#define SHT_SUNW_COMDAT 0x6ffffffb
525#define SHT_SUNW_syminfo 0x6ffffffc 531#define SHT_SUNW_syminfo 0x6ffffffc
526#define SHT_SUNW_verdef 0x6ffffffd /* Versions defined by file */ 532#define SHT_SUNW_verdef 0x6ffffffd /* Versions defined by file */
527#define SHT_GNU_verdef SHT_SUNW_verdef 533#define SHT_GNU_verdef SHT_SUNW_verdef
528#define SHT_SUNW_verneed 0x6ffffffe /* Versions needed by file */ 534#define SHT_SUNW_verneed 0x6ffffffe /* Versions needed by file */
529#define SHT_GNU_verneed SHT_SUNW_verneed 535#define SHT_GNU_verneed SHT_SUNW_verneed
530#define SHT_SUNW_versym 0x6fffffff /* Symbol versions */ 536#define SHT_SUNW_versym 0x6fffffff /* Symbol versions */
531#define SHT_GNU_versym SHT_SUNW_versym 537#define SHT_GNU_versym SHT_SUNW_versym
532#define SHT_HISUNW 0x6fffffff 538#define SHT_HISUNW 0x6fffffff
533#define SHT_HIOS 0x6fffffff 539#define SHT_HIOS 0x6fffffff
534#define SHT_LOPROC 0x70000000 /* Processor-specific range */ 540#define SHT_LOPROC 0x70000000 /* Processor-specific range */
535#define SHT_AMD64_UNWIND 0x70000001 /* unwind information */ 541#define SHT_AMD64_UNWIND 0x70000001 /* unwind information */
536#define SHT_ARM_EXIDX 0x70000001 /* exception index table */ 542#define SHT_ARM_EXIDX 0x70000001 /* exception index table */
537#define SHT_ARM_PREEMPTMAP 0x70000002 /* BPABI DLL dynamic linking  543#define SHT_ARM_PREEMPTMAP 0x70000002 /* BPABI DLL dynamic linking
538 * pre-emption map */ 544 * pre-emption map */
539#define SHT_ARM_ATTRIBUTES 0x70000003 /* Object file compatibility  545#define SHT_ARM_ATTRIBUTES 0x70000003 /* Object file compatibility
540 * attributes */ 546 * attributes */
541#define SHT_ARM_DEBUGOVERLAY 0x70000004 /* See DBGOVL for details */ 547#define SHT_ARM_DEBUGOVERLAY 0x70000004 /* See DBGOVL for details */
542#define SHT_ARM_OVERLAYSECTION 0x70000005 548#define SHT_ARM_OVERLAYSECTION 0x70000005
543#define SHT_MIPS_REGINFO 0x70000006 549#define SHT_MIPS_REGINFO 0x70000006
544#define SHT_MIPS_OPTIONS 0x7000000d 550#define SHT_MIPS_OPTIONS 0x7000000d
545#define SHT_MIPS_DWARF 0x7000001e /* MIPS gcc uses MIPS_DWARF */ 551#define SHT_MIPS_DWARF 0x7000001e /* MIPS gcc uses MIPS_DWARF */
546#define SHT_HIPROC 0x7fffffff 552#define SHT_HIPROC 0x7fffffff
547#define SHT_LOUSER 0x80000000 /* Application-specific range */ 553#define SHT_LOUSER 0x80000000 /* Application-specific range */
548#define SHT_HIUSER 0xffffffff 554#define SHT_HIUSER 0xffffffff
549 555
550/* sh_flags */ 556/* sh_flags */
551#define SHF_WRITE 0x00000001 /* Contains writable data */ 557#define SHF_WRITE 0x00000001 /* Contains writable data */
552#define SHF_ALLOC 0x00000002 /* Occupies memory */ 558#define SHF_ALLOC 0x00000002 /* Occupies memory */
553#define SHF_EXECINSTR 0x00000004 /* Contains executable insns */ 559#define SHF_EXECINSTR 0x00000004 /* Contains executable insns */
554#define SHF_MERGE 0x00000010 /* Might be merged */ 560#define SHF_MERGE 0x00000010 /* Might be merged */
555#define SHF_STRINGS 0x00000020 /* Contains nul terminated strings */ 561#define SHF_STRINGS 0x00000020 /* Contains nul terminated strings */
556#define SHF_INFO_LINK 0x00000040 /* "sh_info" contains SHT index */ 562#define SHF_INFO_LINK 0x00000040 /* "sh_info" contains SHT index */
557#define SHF_LINK_ORDER 0x00000080 /* Preserve order after combining */ 563#define SHF_LINK_ORDER 0x00000080 /* Preserve order after combining */
558#define SHF_OS_NONCONFORMING 0x00000100 /* OS specific handling required */ 564#define SHF_OS_NONCONFORMING 0x00000100 /* OS specific handling required */
559#define SHF_GROUP 0x00000200 /* Is member of a group */ 565#define SHF_GROUP 0x00000200 /* Is member of a group */
560#define SHF_TLS 0x00000400 /* Holds thread-local data */ 566#define SHF_TLS 0x00000400 /* Holds thread-local data */
561#define SHF_MASKOS 0x0ff00000 /* Operating system specific values */ 567#define SHF_MASKOS 0x0ff00000 /* Operating system specific values */
562#define SHF_MASKPROC 0xf0000000 /* Processor-specific values */ 568#define SHF_MASKPROC 0xf0000000 /* Processor-specific values */
563#define SHF_ORDERED 0x40000000 /* Ordering requirement (Solaris) */ 569#define SHF_ORDERED 0x40000000 /* Ordering requirement (Solaris) */
564#define SHF_EXCLUDE 0x80000000 /* Excluded unless unles ref/alloc 570#define SHF_EXCLUDE 0x80000000 /* Excluded unless unles ref/alloc
565 (Solaris).*/ 571 (Solaris).*/
566/* 572/*
567 * Symbol Table 573 * Symbol Table
568 */ 574 */
569typedef struct { 575typedef struct {
570 Elf32_Word st_name; /* Symbol name (.strtab index) */ 576 Elf32_Word st_name; /* Symbol name (.strtab index) */
571 Elf32_Word st_value; /* value of symbol */ 577 Elf32_Word st_value; /* value of symbol */
572 Elf32_Word st_size; /* size of symbol */ 578 Elf32_Word st_size; /* size of symbol */
573 Elf_Byte st_info; /* type / binding attrs */ 579 Elf_Byte st_info; /* type / binding attrs */
574 Elf_Byte st_other; /* unused */ 580 Elf_Byte st_other; /* unused */
575 Elf32_Half st_shndx; /* section index of symbol */ 581 Elf32_Half st_shndx; /* section index of symbol */
576} Elf32_Sym; 582} Elf32_Sym;
577 583
578typedef struct { 584typedef struct {
579 Elf64_Word st_name; /* Symbol name (.strtab index) */ 585 Elf64_Word st_name; /* Symbol name (.strtab index) */
580 Elf_Byte st_info; /* type / binding attrs */ 586 Elf_Byte st_info; /* type / binding attrs */
581 Elf_Byte st_other; /* unused */ 587 Elf_Byte st_other; /* unused */
582 Elf64_Half st_shndx; /* section index of symbol */ 588 Elf64_Half st_shndx; /* section index of symbol */
583 Elf64_Addr st_value; /* value of symbol */ 589 Elf64_Addr st_value; /* value of symbol */
584 Elf64_Xword st_size; /* size of symbol */ 590 Elf64_Xword st_size; /* size of symbol */
585} Elf64_Sym; 591} Elf64_Sym;
586 592
587/* Symbol Table index of the undefined symbol */ 593/* Symbol Table index of the undefined symbol */
588#define ELF_SYM_UNDEFINED 0 594#define ELF_SYM_UNDEFINED 0
589 595
590#define STN_UNDEF 0 /* undefined index */ 596#define STN_UNDEF 0 /* undefined index */
591 597
592/* st_info: Symbol Bindings */ 598/* st_info: Symbol Bindings */
593#define STB_LOCAL 0 /* local symbol */ 599#define STB_LOCAL 0 /* local symbol */
594#define STB_GLOBAL 1 /* global symbol */ 600#define STB_GLOBAL 1 /* global symbol */
595#define STB_WEAK 2 /* weakly defined global symbol */ 601#define STB_WEAK 2 /* weakly defined global symbol */
596#define STB_NUM 3 602#define STB_NUM 3
597 603
598#define STB_LOOS 10 /* Operating system specific range */ 604#define STB_LOOS 10 /* Operating system specific range */
599#define STB_HIOS 12 605#define STB_HIOS 12
600#define STB_LOPROC 13 /* Processor-specific range */ 606#define STB_LOPROC 13 /* Processor-specific range */
601#define STB_HIPROC 15 607#define STB_HIPROC 15
602 608
603/* st_info: Symbol Types */ 609/* st_info: Symbol Types */
604#define STT_NOTYPE 0 /* Type not specified */ 610#define STT_NOTYPE 0 /* Type not specified */
605#define STT_OBJECT 1 /* Associated with a data object */ 611#define STT_OBJECT 1 /* Associated with a data object */
606#define STT_FUNC 2 /* Associated with a function */ 612#define STT_FUNC 2 /* Associated with a function */
607#define STT_SECTION 3 /* Associated with a section */ 613#define STT_SECTION 3 /* Associated with a section */
608#define STT_FILE 4 /* Associated with a file name */ 614#define STT_FILE 4 /* Associated with a file name */
609#define STT_COMMON 5 /* Uninitialised common block */ 615#define STT_COMMON 5 /* Uninitialised common block */
610#define STT_TLS 6 /* Thread local data object */ 616#define STT_TLS 6 /* Thread local data object */
611#define STT_NUM 7 617#define STT_NUM 7
612 618
613#define STT_LOOS 10 /* Operating system specific range */ 619#define STT_LOOS 10 /* Operating system specific range */
614#define STT_GNU_IFUNC 10 /* GNU extension: indirect function */ 620#define STT_GNU_IFUNC 10 /* GNU extension: indirect function */
615#define STT_HIOS 12 621#define STT_HIOS 12
616#define STT_LOPROC 13 /* Processor-specific range */ 622#define STT_LOPROC 13 /* Processor-specific range */
617#define STT_HIPROC 15 623#define STT_HIPROC 15
618 624
619/* st_other: Visibility Types */ 625/* st_other: Visibility Types */
620#define STV_DEFAULT 0 /* use binding type */ 626#define STV_DEFAULT 0 /* use binding type */
621#define STV_INTERNAL 1 /* not referenced from outside */ 627#define STV_INTERNAL 1 /* not referenced from outside */
622#define STV_HIDDEN 2 /* not visible, may be used via ptr */ 628#define STV_HIDDEN 2 /* not visible, may be used via ptr */
623#define STV_PROTECTED 3 /* visible, not preemptible */ 629#define STV_PROTECTED 3 /* visible, not preemptible */
624#define STV_EXPORTED 4 630#define STV_EXPORTED 4
625#define STV_SINGLETON 5 631#define STV_SINGLETON 5
626#define STV_ELIMINATE 6 632#define STV_ELIMINATE 6
627 633
628/* st_info/st_other utility macros */ 634/* st_info/st_other utility macros */
629#define ELF_ST_BIND(info) ((uint32_t)(info) >> 4) 635#define ELF_ST_BIND(info) ((uint32_t)(info) >> 4)
630#define ELF_ST_TYPE(info) ((uint32_t)(info) & 0xf) 636#define ELF_ST_TYPE(info) ((uint32_t)(info) & 0xf)
631#define ELF_ST_INFO(bind,type) ((Elf_Byte)(((bind) << 4) | \ 637#define ELF_ST_INFO(bind,type) ((Elf_Byte)(((bind) << 4) | \
632 ((type) & 0xf))) 638 ((type) & 0xf)))
633#define ELF_ST_VISIBILITY(other) ((uint32_t)(other) & 3) 639#define ELF_ST_VISIBILITY(other) ((uint32_t)(other) & 3)
634 640
635/* 641/*
636 * Special section indexes 642 * Special section indexes
637 */ 643 */
638#define SHN_UNDEF 0 /* Undefined section */ 644#define SHN_UNDEF 0 /* Undefined section */
639 645
640#define SHN_LORESERVE 0xff00 /* Reserved range */ 646#define SHN_LORESERVE 0xff00 /* Reserved range */
641#define SHN_ABS 0xfff1 /* Absolute symbols */ 647#define SHN_ABS 0xfff1 /* Absolute symbols */
642#define SHN_COMMON 0xfff2 /* Common symbols */ 648#define SHN_COMMON 0xfff2 /* Common symbols */
643#define SHN_XINDEX 0xffff /* Escape -- index stored elsewhere */ 649#define SHN_XINDEX 0xffff /* Escape -- index stored elsewhere */
644#define SHN_HIRESERVE 0xffff 650#define SHN_HIRESERVE 0xffff
645 651
646#define SHN_LOPROC 0xff00 /* Processor-specific range */ 652#define SHN_LOPROC 0xff00 /* Processor-specific range */
647#define SHN_HIPROC 0xff1f 653#define SHN_HIPROC 0xff1f
648#define SHN_LOOS 0xff20 /* Operating system specific range */ 654#define SHN_LOOS 0xff20 /* Operating system specific range */
649#define SHN_HIOS 0xff3f 655#define SHN_HIOS 0xff3f
650 656
651#define SHN_MIPS_ACOMMON 0xff00 657#define SHN_MIPS_ACOMMON 0xff00
652#define SHN_MIPS_TEXT 0xff01 658#define SHN_MIPS_TEXT 0xff01
653#define SHN_MIPS_DATA 0xff02 659#define SHN_MIPS_DATA 0xff02
654#define SHN_MIPS_SCOMMON 0xff03 660#define SHN_MIPS_SCOMMON 0xff03
655 661
656/* 662/*
657 * Relocation Entries 663 * Relocation Entries
658 */ 664 */
659typedef struct { 665typedef struct {
660 Elf32_Word r_offset; /* where to do it */ 666 Elf32_Word r_offset; /* where to do it */
661 Elf32_Word r_info; /* index & type of relocation */ 667 Elf32_Word r_info; /* index & type of relocation */
662} Elf32_Rel; 668} Elf32_Rel;
663 669
664typedef struct { 670typedef struct {
665 Elf32_Word r_offset; /* where to do it */ 671 Elf32_Word r_offset; /* where to do it */
666 Elf32_Word r_info; /* index & type of relocation */ 672 Elf32_Word r_info; /* index & type of relocation */
667 Elf32_Sword r_addend; /* adjustment value */ 673 Elf32_Sword r_addend; /* adjustment value */
668} Elf32_Rela; 674} Elf32_Rela;
669 675
670/* r_info utility macros */ 676/* r_info utility macros */
671#define ELF32_R_SYM(info) ((info) >> 8) 677#define ELF32_R_SYM(info) ((info) >> 8)
672#define ELF32_R_TYPE(info) ((info) & 0xff) 678#define ELF32_R_TYPE(info) ((info) & 0xff)
673#define ELF32_R_INFO(sym, type) (((sym) << 8) + (unsigned char)(type)) 679#define ELF32_R_INFO(sym, type) (((sym) << 8) + (unsigned char)(type))
674 680
675typedef struct { 681typedef struct {
676 Elf64_Addr r_offset; /* where to do it */ 682 Elf64_Addr r_offset; /* where to do it */
677 Elf64_Xword r_info; /* index & type of relocation */ 683 Elf64_Xword r_info; /* index & type of relocation */
678} Elf64_Rel; 684} Elf64_Rel;
679 685
680typedef struct { 686typedef struct {
681 Elf64_Addr r_offset; /* where to do it */ 687 Elf64_Addr r_offset; /* where to do it */
682 Elf64_Xword r_info; /* index & type of relocation */ 688 Elf64_Xword r_info; /* index & type of relocation */
683 Elf64_Sxword r_addend; /* adjustment value */ 689 Elf64_Sxword r_addend; /* adjustment value */
684} Elf64_Rela; 690} Elf64_Rela;
685 691
686/* r_info utility macros */ 692/* r_info utility macros */
687#define ELF64_R_SYM(info) ((info) >> 32) 693#define ELF64_R_SYM(info) ((info) >> 32)
688#define ELF64_R_TYPE(info) ((info) & 0xffffffff) 694#define ELF64_R_TYPE(info) ((info) & 0xffffffff)
689#define ELF64_R_INFO(sym,type) (((sym) << 32) + (type)) 695#define ELF64_R_INFO(sym,type) (((sym) << 32) + (type))
690 696
691/* 697/*
692 * Move entries 698 * Move entries
693 */ 699 */
694typedef struct { 700typedef struct {
695 Elf32_Lword m_value; /* symbol value */ 701 Elf32_Lword m_value; /* symbol value */
696 Elf32_Word m_info; /* size + index */ 702 Elf32_Word m_info; /* size + index */
697 Elf32_Word m_poffset; /* symbol offset */ 703 Elf32_Word m_poffset; /* symbol offset */
698 Elf32_Half m_repeat; /* repeat count */ 704 Elf32_Half m_repeat; /* repeat count */
699 Elf32_Half m_stride; /* stride info */ 705 Elf32_Half m_stride; /* stride info */
700} Elf32_Move; 706} Elf32_Move;
701 707
702#define ELF32_M_SYM(info) ((info) >> 8) 708#define ELF32_M_SYM(info) ((info) >> 8)
703#define ELF32_M_SIZE(info) ((info) & 0xff) 709#define ELF32_M_SIZE(info) ((info) & 0xff)
704#define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char)(size)) 710#define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char)(size))
705 711
706typedef struct { 712typedef struct {
707 Elf64_Lword m_value; /* symbol value */ 713 Elf64_Lword m_value; /* symbol value */
708 Elf64_Xword m_info; /* size + index */ 714 Elf64_Xword m_info; /* size + index */
709 Elf64_Xword m_poffset; /* symbol offset */ 715 Elf64_Xword m_poffset; /* symbol offset */
710 Elf64_Word m_repeat; /* repeat count */ 716 Elf64_Word m_repeat; /* repeat count */
711 Elf64_Word m_stride; /* stride info */ 717 Elf64_Word m_stride; /* stride info */
712} Elf64_Move; 718} Elf64_Move;
713 719
714#define ELF64_M_SYM(info) ((info) >> 8) 720#define ELF64_M_SYM(info) ((info) >> 8)
715#define ELF64_M_SIZE(info) ((info) & 0xff) 721#define ELF64_M_SIZE(info) ((info) & 0xff)
716#define ELF64_M_INFO(sym, size) (((sym) << 8) + (unsigned char)(size)) 722#define ELF64_M_INFO(sym, size) (((sym) << 8) + (unsigned char)(size))
717 723
718/* 724/*
719 * Hardware/software capabilities entry 725 * Hardware/software capabilities entry
720 */ 726 */
721typedef struct { 727typedef struct {
722 Elf32_Word c_tag; /* entry tag value */ 728 Elf32_Word c_tag; /* entry tag value */
723 union { 729 union {
724 Elf32_Addr c_ptr; 730 Elf32_Addr c_ptr;
725 Elf32_Word c_val; 731 Elf32_Word c_val;
726 } c_un; 732 } c_un;
727} Elf32_Cap; 733} Elf32_Cap;
728 734
729typedef struct { 735typedef struct {
730 Elf64_Xword c_tag; /* entry tag value */ 736 Elf64_Xword c_tag; /* entry tag value */
731 union { 737 union {
732 Elf64_Addr c_ptr; 738 Elf64_Addr c_ptr;
733 Elf64_Xword c_val; 739 Elf64_Xword c_val;
734 } c_un; 740 } c_un;
735} Elf64_Cap; 741} Elf64_Cap;
736 742
737/* 743/*
738 * Dynamic Section structure array 744 * Dynamic Section structure array
739 */ 745 */
740typedef struct { 746typedef struct {
741 Elf32_Word d_tag; /* entry tag value */ 747 Elf32_Word d_tag; /* entry tag value */
742 union { 748 union {
743 Elf32_Addr d_ptr; 749 Elf32_Addr d_ptr;
744 Elf32_Word d_val; 750 Elf32_Word d_val;
745 } d_un; 751 } d_un;
746} Elf32_Dyn; 752} Elf32_Dyn;
747 753
748typedef struct { 754typedef struct {
749 Elf64_Xword d_tag; /* entry tag value */ 755 Elf64_Xword d_tag; /* entry tag value */
750 union { 756 union {
751 Elf64_Addr d_ptr; 757 Elf64_Addr d_ptr;
752 Elf64_Xword d_val; 758 Elf64_Xword d_val;
753 } d_un; 759 } d_un;
754} Elf64_Dyn; 760} Elf64_Dyn;
755 761
756/* d_tag */ 762/* d_tag */
757#define DT_NULL 0 /* Marks end of dynamic array */ 763#define DT_NULL 0 /* Marks end of dynamic array */
758#define DT_NEEDED 1 /* Name of needed library (DT_STRTAB offset) */ 764#define DT_NEEDED 1 /* Name of needed library (DT_STRTAB offset) */
759#define DT_PLTRELSZ 2 /* Size, in bytes, of relocations in PLT */ 765#define DT_PLTRELSZ 2 /* Size, in bytes, of relocations in PLT */
760#define DT_PLTGOT 3 /* Address of PLT and/or GOT */ 766#define DT_PLTGOT 3 /* Address of PLT and/or GOT */
761#define DT_HASH 4 /* Address of symbol hash table */ 767#define DT_HASH 4 /* Address of symbol hash table */
762#define DT_STRTAB 5 /* Address of string table */ 768#define DT_STRTAB 5 /* Address of string table */
763#define DT_SYMTAB 6 /* Address of symbol table */ 769#define DT_SYMTAB 6 /* Address of symbol table */
764#define DT_RELA 7 /* Address of Rela relocation table */ 770#define DT_RELA 7 /* Address of Rela relocation table */
765#define DT_RELASZ 8 /* Size, in bytes, of DT_RELA table */ 771#define DT_RELASZ 8 /* Size, in bytes, of DT_RELA table */
766#define DT_RELAENT 9 /* Size, in bytes, of one DT_RELA entry */ 772#define DT_RELAENT 9 /* Size, in bytes, of one DT_RELA entry */
767#define DT_STRSZ 10 /* Size, in bytes, of DT_STRTAB table */ 773#define DT_STRSZ 10 /* Size, in bytes, of DT_STRTAB table */
768#define DT_SYMENT 11 /* Size, in bytes, of one DT_SYMTAB entry */ 774#define DT_SYMENT 11 /* Size, in bytes, of one DT_SYMTAB entry */
769#define DT_INIT 12 /* Address of initialization function */ 775#define DT_INIT 12 /* Address of initialization function */
770#define DT_FINI 13 /* Address of termination function */ 776#define DT_FINI 13 /* Address of termination function */
771#define DT_SONAME 14 /* Shared object name (DT_STRTAB offset) */ 777#define DT_SONAME 14 /* Shared object name (DT_STRTAB offset) */
772#define DT_RPATH 15 /* Library search path (DT_STRTAB offset) */ 778#define DT_RPATH 15 /* Library search path (DT_STRTAB offset) */
773#define DT_SYMBOLIC 16 /* Start symbol search within local object */ 779#define DT_SYMBOLIC 16 /* Start symbol search within local object */
774#define DT_REL 17 /* Address of Rel relocation table */ 780#define DT_REL 17 /* Address of Rel relocation table */
775#define DT_RELSZ 18 /* Size, in bytes, of DT_REL table */ 781#define DT_RELSZ 18 /* Size, in bytes, of DT_REL table */
776#define DT_RELENT 19 /* Size, in bytes, of one DT_REL entry */ 782#define DT_RELENT 19 /* Size, in bytes, of one DT_REL entry */
777#define DT_PLTREL 20 /* Type of PLT relocation entries */ 783#define DT_PLTREL 20 /* Type of PLT relocation entries */
778#define DT_DEBUG 21 /* Used for debugging; unspecified */ 784#define DT_DEBUG 21 /* Used for debugging; unspecified */
779#define DT_TEXTREL 22 /* Relocations might modify non-writable seg */ 785#define DT_TEXTREL 22 /* Relocations might modify non-writable seg */
780#define DT_JMPREL 23 /* Address of relocations associated with PLT */ 786#define DT_JMPREL 23 /* Address of relocations associated with PLT */
781#define DT_BIND_NOW 24 /* Process all relocations at load-time */ 787#define DT_BIND_NOW 24 /* Process all relocations at load-time */
782#define DT_INIT_ARRAY 25 /* Address of initialization function array */ 788#define DT_INIT_ARRAY 25 /* Address of initialization function array */
783#define DT_FINI_ARRAY 26 /* Size, in bytes, of DT_INIT_ARRAY array */ 789#define DT_FINI_ARRAY 26 /* Size, in bytes, of DT_INIT_ARRAY array */
784#define DT_INIT_ARRAYSZ 27 /* Address of termination function array */ 790#define DT_INIT_ARRAYSZ 27 /* Address of termination function array */
785#define DT_FINI_ARRAYSZ 28 /* Size, in bytes, of DT_FINI_ARRAY array*/ 791#define DT_FINI_ARRAYSZ 28 /* Size, in bytes, of DT_FINI_ARRAY array*/
786#define DT_RUNPATH 29 /* overrides DT_RPATH */ 792#define DT_RUNPATH 29 /* overrides DT_RPATH */
787#define DT_FLAGS 30 /* Encodes ORIGIN, SYMBOLIC, TEXTREL, BIND_NOW, STATIC_TLS */ 793#define DT_FLAGS 30 /* Encodes ORIGIN, SYMBOLIC, TEXTREL, BIND_NOW, STATIC_TLS */
788#define DT_ENCODING 31 /* ??? */ 794#define DT_ENCODING 31 /* ??? */
789#define DT_PREINIT_ARRAY 32 /* Address of pre-init function array */ 795#define DT_PREINIT_ARRAY 32 /* Address of pre-init function array */
790#define DT_PREINIT_ARRAYSZ 33 /* Size, in bytes, of DT_PREINIT_ARRAY array */ 796#define DT_PREINIT_ARRAYSZ 33 /* Size, in bytes, of DT_PREINIT_ARRAY array */
791#define DT_NUM 34 797#define DT_NUM 34
792 798
793#define DT_LOOS 0x60000000 /* Operating system specific range */ 799#define DT_LOOS 0x60000000 /* Operating system specific range */
794#define DT_VERSYM 0x6ffffff0 /* Symbol versions */ 800#define DT_VERSYM 0x6ffffff0 /* Symbol versions */
795#define DT_FLAGS_1 0x6ffffffb /* ELF dynamic flags */ 801#define DT_FLAGS_1 0x6ffffffb /* ELF dynamic flags */
796#define DT_VERDEF 0x6ffffffc /* Versions defined by file */ 802#define DT_VERDEF 0x6ffffffc /* Versions defined by file */
797#define DT_VERDEFNUM 0x6ffffffd /* Number of versions defined by file */ 803#define DT_VERDEFNUM 0x6ffffffd /* Number of versions defined by file */
798#define DT_VERNEED 0x6ffffffe /* Versions needed by file */ 804#define DT_VERNEED 0x6ffffffe /* Versions needed by file */
799#define DT_VERNEEDNUM 0x6fffffff /* Number of versions needed by file */ 805#define DT_VERNEEDNUM 0x6fffffff /* Number of versions needed by file */
800#define DT_HIOS 0x6fffffff 806#define DT_HIOS 0x6fffffff
801#define DT_LOPROC 0x70000000 /* Processor-specific range */ 807#define DT_LOPROC 0x70000000 /* Processor-specific range */
802#define DT_HIPROC 0x7fffffff 808#define DT_HIPROC 0x7fffffff
803 809
804/* Flag values for DT_FLAGS */ 810/* Flag values for DT_FLAGS */
805#define DF_ORIGIN 0x00000001 /* uses $ORIGIN */ 811#define DF_ORIGIN 0x00000001 /* uses $ORIGIN */
806#define DF_SYMBOLIC 0x00000002 /* */ 812#define DF_SYMBOLIC 0x00000002 /* */
807#define DF_TEXTREL 0x00000004 /* */ 813#define DF_TEXTREL 0x00000004 /* */
808#define DF_BIND_NOW 0x00000008 /* */ 814#define DF_BIND_NOW 0x00000008 /* */
809#define DF_STATIC_TLS 0x00000010 /* */ 815#define DF_STATIC_TLS 0x00000010 /* */
810 816
811/* Flag values for DT_FLAGS_1 */ 817/* Flag values for DT_FLAGS_1 */
812#define DF_1_NOW 0x00000001 /* Same as DF_BIND_NOW */ 818#define DF_1_NOW 0x00000001 /* Same as DF_BIND_NOW */
813#define DF_1_GLOBAL 0x00000002 /* Unused */ 819#define DF_1_GLOBAL 0x00000002 /* Unused */
814#define DF_1_GROUP 0x00000004 /* Is member of group */ 820#define DF_1_GROUP 0x00000004 /* Is member of group */
815#define DF_1_NODELETE 0x00000008 /* Cannot be deleted from process */ 821#define DF_1_NODELETE 0x00000008 /* Cannot be deleted from process */
816#define DF_1_LOADFLTR 0x00000010 /* Immediate loading of filters */ 822#define DF_1_LOADFLTR 0x00000010 /* Immediate loading of filters */
817#define DF_1_INITFIRST 0x00000020 /* init/fini takes priority */ 823#define DF_1_INITFIRST 0x00000020 /* init/fini takes priority */
818#define DF_1_NOOPEN 0x00000040 /* Do not allow loading on dlopen() */ 824#define DF_1_NOOPEN 0x00000040 /* Do not allow loading on dlopen() */
819#define DF_1_ORIGIN 0x00000080 /* Require $ORIGIN processing */ 825#define DF_1_ORIGIN 0x00000080 /* Require $ORIGIN processing */
820#define DF_1_DIRECT 0x00000100 /* Enable direct bindings */ 826#define DF_1_DIRECT 0x00000100 /* Enable direct bindings */
821#define DF_1_INTERPOSE 0x00000400 /* Is an interposer */ 827#define DF_1_INTERPOSE 0x00000400 /* Is an interposer */
822#define DF_1_NODEFLIB 0x00000800 /* Ignore default library search path */ 828#define DF_1_NODEFLIB 0x00000800 /* Ignore default library search path */
823#define DF_1_NODUMP 0x00001000 /* Cannot be dumped with dldump(3C) */ 829#define DF_1_NODUMP 0x00001000 /* Cannot be dumped with dldump(3C) */
824#define DF_1_CONFALT 0x00002000 /* Configuration alternative */ 830#define DF_1_CONFALT 0x00002000 /* Configuration alternative */
825#define DF_1_ENDFILTEE 0x00004000 /* Filtee ends filter's search */ 831#define DF_1_ENDFILTEE 0x00004000 /* Filtee ends filter's search */
826#define DF_1_DISPRELDNE 0x00008000 /* Did displacement relocation */ 832#define DF_1_DISPRELDNE 0x00008000 /* Did displacement relocation */
827#define DF_1_DISPRELPND 0x00010000 /* Pending displacement relocation */ 833#define DF_1_DISPRELPND 0x00010000 /* Pending displacement relocation */
828#define DF_1_NODIRECT 0x00020000 /* Has non-direct bindings */ 834#define DF_1_NODIRECT 0x00020000 /* Has non-direct bindings */
829#define DF_1_IGNMULDEF 0x00040000 /* Used internally */ 835#define DF_1_IGNMULDEF 0x00040000 /* Used internally */
830#define DF_1_NOKSYMS 0x00080000 /* Used internally */ 836#define DF_1_NOKSYMS 0x00080000 /* Used internally */
831#define DF_1_NOHDR 0x00100000 /* Used internally */ 837#define DF_1_NOHDR 0x00100000 /* Used internally */
832#define DF_1_EDITED 0x00200000 /* Has been modified since build */ 838#define DF_1_EDITED 0x00200000 /* Has been modified since build */
833#define DF_1_NORELOC 0x00400000 /* Used internally */ 839#define DF_1_NORELOC 0x00400000 /* Used internally */
834#define DF_1_SYMINTPOSE 0x00800000 /* Has individual symbol interposers */ 840#define DF_1_SYMINTPOSE 0x00800000 /* Has individual symbol interposers */
835#define DF_1_GLOBAUDIT 0x01000000 /* Require global auditing */ 841#define DF_1_GLOBAUDIT 0x01000000 /* Require global auditing */
836#define DF_1_SINGLETON 0x02000000 /* Has singleton symbols */ 842#define DF_1_SINGLETON 0x02000000 /* Has singleton symbols */
837#define DF_1_STUB 0x04000000 /* Stub */ 843#define DF_1_STUB 0x04000000 /* Stub */
838#define DF_1_PIE 0x08000000 /* Position Independent Executable */ 844#define DF_1_PIE 0x08000000 /* Position Independent Executable */
839 845
840/* 846/*
841 * Auxiliary Vectors 847 * Auxiliary Vectors
842 */ 848 */
843typedef struct { 849typedef struct {
844 Elf32_Word a_type; /* 32-bit id */ 850 Elf32_Word a_type; /* 32-bit id */
845 Elf32_Word a_v; /* 32-bit id */ 851 Elf32_Word a_v; /* 32-bit id */
846} Aux32Info; 852} Aux32Info;
847 853
848typedef struct { 854typedef struct {
849 Elf64_Word a_type; /* 32-bit id */ 855 Elf64_Word a_type; /* 32-bit id */
850 Elf64_Xword a_v; /* 64-bit id */ 856 Elf64_Xword a_v; /* 64-bit id */
851} Aux64Info; 857} Aux64Info;
852 858
853/* a_type */ 859/* a_type */
854#define AT_NULL 0 /* Marks end of array */ 860#define AT_NULL 0 /* Marks end of array */
855#define AT_IGNORE 1 /* No meaning, a_un is undefined */ 861#define AT_IGNORE 1 /* No meaning, a_un is undefined */
856#define AT_EXECFD 2 /* Open file descriptor of object file */ 862#define AT_EXECFD 2 /* Open file descriptor of object file */
857#define AT_PHDR 3 /* &phdr[0] */ 863#define AT_PHDR 3 /* &phdr[0] */
858#define AT_PHENT 4 /* sizeof(phdr[0]) */ 864#define AT_PHENT 4 /* sizeof(phdr[0]) */
859#define AT_PHNUM 5 /* # phdr entries */ 865#define AT_PHNUM 5 /* # phdr entries */
860#define AT_PAGESZ 6 /* PAGESIZE */ 866#define AT_PAGESZ 6 /* PAGESIZE */
861#define AT_BASE 7 /* Interpreter base addr */ 867#define AT_BASE 7 /* Interpreter base addr */
862#define AT_FLAGS 8 /* Processor flags */ 868#define AT_FLAGS 8 /* Processor flags */
863#define AT_ENTRY 9 /* Entry address of executable */ 869#define AT_ENTRY 9 /* Entry address of executable */
864#define AT_DCACHEBSIZE 10 /* Data cache block size */ 870#define AT_DCACHEBSIZE 10 /* Data cache block size */
865#define AT_ICACHEBSIZE 11 /* Instruction cache block size */ 871#define AT_ICACHEBSIZE 11 /* Instruction cache block size */
866#define AT_UCACHEBSIZE 12 /* Unified cache block size */ 872#define AT_UCACHEBSIZE 12 /* Unified cache block size */
867#define AT_STACKBASE 13 /* Base address of the main thread */ 873#define AT_STACKBASE 13 /* Base address of the main thread */
868 874
869 /* Vendor specific */ 875 /* Vendor specific */
870#define AT_MIPS_NOTELF 10 /* XXX a_val != 0 -> MIPS XCOFF executable */ 876#define AT_MIPS_NOTELF 10 /* XXX a_val != 0 -> MIPS XCOFF executable */
871 877
872#define AT_EUID 2000 /* euid (solaris compatible numbers) */ 878#define AT_EUID 2000 /* euid (solaris compatible numbers) */
873#define AT_RUID 2001 /* ruid (solaris compatible numbers) */ 879#define AT_RUID 2001 /* ruid (solaris compatible numbers) */
874#define AT_EGID 2002 /* egid (solaris compatible numbers) */ 880#define AT_EGID 2002 /* egid (solaris compatible numbers) */
875#define AT_RGID 2003 /* rgid (solaris compatible numbers) */ 881#define AT_RGID 2003 /* rgid (solaris compatible numbers) */
876 882
877 /* Solaris kernel specific */ 883 /* Solaris kernel specific */
878#define AT_SUN_LDELF 2004 /* dynamic linker's ELF header */ 884#define AT_SUN_LDELF 2004 /* dynamic linker's ELF header */
879#define AT_SUN_LDSHDR 2005 /* dynamic linker's section header */ 885#define AT_SUN_LDSHDR 2005 /* dynamic linker's section header */
880#define AT_SUN_LDNAME 2006 /* dynamic linker's name */ 886#define AT_SUN_LDNAME 2006 /* dynamic linker's name */
881#define AT_SUN_LPGSIZE 2007 /* large pagesize */ 887#define AT_SUN_LPGSIZE 2007 /* large pagesize */
882 888
883 /* Other information */ 889 /* Other information */
884#define AT_SUN_PLATFORM 2008 /* sysinfo(SI_PLATFORM) */ 890#define AT_SUN_PLATFORM 2008 /* sysinfo(SI_PLATFORM) */
885#define AT_SUN_HWCAP 2009 /* process hardware capabilities */ 891#define AT_SUN_HWCAP 2009 /* process hardware capabilities */
886#define AT_SUN_IFLUSH 2010 /* do we need to flush the instruction cache? */ 892#define AT_SUN_IFLUSH 2010 /* do we need to flush the instruction cache? */
887#define AT_SUN_CPU 2011 /* CPU name */ 893#define AT_SUN_CPU 2011 /* CPU name */
888 /* ibcs2 emulation band aid */ 894 /* ibcs2 emulation band aid */
889#define AT_SUN_EMUL_ENTRY 2012 /* coff entry point */ 895#define AT_SUN_EMUL_ENTRY 2012 /* coff entry point */
890#define AT_SUN_EMUL_EXECFD 2013 /* coff file descriptor */ 896#define AT_SUN_EMUL_EXECFD 2013 /* coff file descriptor */
891 /* Executable's fully resolved name */ 897 /* Executable's fully resolved name */
892#define AT_SUN_EXECNAME 2014 898#define AT_SUN_EXECNAME 2014
893 899
894/* 900/*
895 * The header for GNU-style hash sections. 901 * The header for GNU-style hash sections.
896 */ 902 */
897typedef struct { 903typedef struct {
898 uint32_t gh_nbuckets; /* Number of hash buckets. */ 904 uint32_t gh_nbuckets; /* Number of hash buckets. */
899 uint32_t gh_symndx; /* First visible symbol in .dynsym. */ 905 uint32_t gh_symndx; /* First visible symbol in .dynsym. */
900 uint32_t gh_maskwords; /* #maskwords used in bloom filter. */ 906 uint32_t gh_maskwords; /* #maskwords used in bloom filter. */
901 uint32_t gh_shift2; /* Bloom filter shift count. */ 907 uint32_t gh_shift2; /* Bloom filter shift count. */
902} Elf_GNU_Hash_Header; 908} Elf_GNU_Hash_Header;
903 909
904/* 910/*
905 * Note Headers 911 * Note Headers
906 */ 912 */
907typedef struct { 913typedef struct {
908 Elf32_Word n_namesz; 914 Elf32_Word n_namesz;
909 Elf32_Word n_descsz; 915 Elf32_Word n_descsz;
910 Elf32_Word n_type; 916 Elf32_Word n_type;
911} Elf32_Nhdr; 917} Elf32_Nhdr;
912 918
913typedef struct { 919typedef struct {
914 Elf64_Word n_namesz; 920 Elf64_Word n_namesz;
915 Elf64_Word n_descsz; 921 Elf64_Word n_descsz;
916 Elf64_Word n_type; 922 Elf64_Word n_type;
917} Elf64_Nhdr; 923} Elf64_Nhdr;
918 924
919#define ELF_NOTE_GNU_NAMESZ 4 925#define ELF_NOTE_GNU_NAMESZ 4
920#define ELF_NOTE_GNU_NAME "GNU\0" 926#define ELF_NOTE_GNU_NAME "GNU\0"
921 927
922/* 928/*
923 * GNU-specific note type: ABI tag 929 * GNU-specific note type: ABI tag
924 * name: GNU\0 930 * name: GNU\0
925 * namesz: 4 931 * namesz: 4
926 * desc: 932 * desc:
927 * word[0]: OS tag 933 * word[0]: OS tag
928 * word[1]: major version 934 * word[1]: major version
929 * word[2]: minor version 935 * word[2]: minor version
930 * word[3]: teeny version 936 * word[3]: teeny version
931 * descsz: 16 937 * descsz: 16
932 */ 938 */
933/* GNU-specific note name and description sizes */ 939/* GNU-specific note name and description sizes */
934#define ELF_NOTE_TYPE_ABI_TAG 1 940#define ELF_NOTE_TYPE_ABI_TAG 1
935#define ELF_NOTE_ABI_NAME ELF_NOTE_GNU_NAME 941#define ELF_NOTE_ABI_NAME ELF_NOTE_GNU_NAME
936#define ELF_NOTE_ABI_NAMESZ ELF_NOTE_GNU_NAMESZ 942#define ELF_NOTE_ABI_NAMESZ ELF_NOTE_GNU_NAMESZ
937#define ELF_NOTE_ABI_DESCSZ 16 943#define ELF_NOTE_ABI_DESCSZ 16
938/* GNU-specific OS/version value stuff */ 944/* GNU-specific OS/version value stuff */
939#define ELF_NOTE_ABI_OS_LINUX 0 945#define ELF_NOTE_ABI_OS_LINUX 0
940#define ELF_NOTE_ABI_OS_HURD 1 946#define ELF_NOTE_ABI_OS_HURD 1
941#define ELF_NOTE_ABI_OS_SOLARIS 2 947#define ELF_NOTE_ABI_OS_SOLARIS 2
942#define ELF_NOTE_ABI_OS_KFREEBSD 3 948#define ELF_NOTE_ABI_OS_KFREEBSD 3
943#define ELF_NOTE_ABI_OS_KNETBSD 4 949#define ELF_NOTE_ABI_OS_KNETBSD 4
944 950
945/* Old gcc style, under the ABI tag */ 951/* Old gcc style, under the ABI tag */
946#define ELF_NOTE_OGCC_NAMESZ 8 952#define ELF_NOTE_OGCC_NAMESZ 8
947#define ELF_NOTE_OGCC_NAME "01.01\0\0\0\0" 953#define ELF_NOTE_OGCC_NAME "01.01\0\0\0\0"
948#define ELF_NOTE_OGCC_DESCSZ 0 954#define ELF_NOTE_OGCC_DESCSZ 0
949 955
950/* 956/*
951 * GNU-specific note type: Hardware capabilities 957 * GNU-specific note type: Hardware capabilities
952 * name: GNU\0 958 * name: GNU\0
953 * namesz: 4 959 * namesz: 4
954 * desc: 960 * desc:
955 * word[0]: Number of entries 961 * word[0]: Number of entries
956 * word[1]: Bitmask of enabled entries 962 * word[1]: Bitmask of enabled entries
957 * Followed by a byte id, and a NUL terminated string per entry 963 * Followed by a byte id, and a NUL terminated string per entry
958 * descsz: variable 964 * descsz: variable
959 */ 965 */
960#define ELF_NOTE_TYPE_GNU_HWCAP 2 966#define ELF_NOTE_TYPE_GNU_HWCAP 2
961 967
962/* 968/*
963 * GNU-specific note type: Build ID generated by ld 969 * GNU-specific note type: Build ID generated by ld
964 * name: GNU\0 970 * name: GNU\0
965 * desc: 971 * desc:
966 * word[0..4] SHA1 [default]  972 * word[0..4] SHA1 [default]
967 * or 973 * or
968 * word[0..3] md5 or uuid 974 * word[0..3] md5 or uuid
969 * descsz: 16 or 20 975 * descsz: 16 or 20
970 */ 976 */
971#define ELF_NOTE_TYPE_GNU_BUILD_ID 3 977#define ELF_NOTE_TYPE_GNU_BUILD_ID 3
972 978
973/* SuSE-specific note type: ABI 979/* SuSE-specific note type: ABI
974 * name: SuSE\0 980 * name: SuSE\0
975 * namesz: 5 981 * namesz: 5
976 * desc: 982 * desc:
977 * half[0] = MMmm 983 * half[0] = MMmm
978 * 984 *
979 * M = product major version 985 * M = product major version
980 * m = product minor version 986 * m = product minor version
981 * descsz: 2 987 * descsz: 2
982 */ 988 */
983#define ELF_NOTE_TYPE_SUSE_TAG 1 989#define ELF_NOTE_TYPE_SUSE_TAG 1
984/* SuSE-specific note name and description sizes */ 990/* SuSE-specific note name and description sizes */
985#define ELF_NOTE_SUSE_NAMESZ 5 991#define ELF_NOTE_SUSE_NAMESZ 5
986#define ELF_NOTE_SUSE_DESCSZ 2 992#define ELF_NOTE_SUSE_DESCSZ 2
987/* SuSE-specific note name */ 993/* SuSE-specific note name */
988#define ELF_NOTE_SUSE_NAME "SuSE\0" 994#define ELF_NOTE_SUSE_NAME "SuSE\0"
989 995
990/* SuSE-specific note type: version 996/* SuSE-specific note type: version
991 * name: SuSE\0\0\0\0 997 * name: SuSE\0\0\0\0
992 * namesz: 8 998 * namesz: 8
993 * desc:  999 * desc:
994 * word[0] = VVTTMMmm 1000 * word[0] = VVTTMMmm
995 * 1001 *
996 * V = version of following data 1002 * V = version of following data
997 * T = product type: [box, sles, nld, whatever] 1003 * T = product type: [box, sles, nld, whatever]
998 * M = product major version 1004 * M = product major version
999 * m = product minor version 1005 * m = product minor version
1000 * descsz: 8 1006 * descsz: 8
1001 */ 1007 */
1002#define ELF_NOTE_TYPE_SUSE_VERSION_TAG 0x45537553 /* SuSE in LE */ 1008#define ELF_NOTE_TYPE_SUSE_VERSION_TAG 0x45537553 /* SuSE in LE */
1003/* SuSE-specific note name and description sizes */ 1009/* SuSE-specific note name and description sizes */
1004#define ELF_NOTE_SUSE_VERSION_NAMESZ 8 1010#define ELF_NOTE_SUSE_VERSION_NAMESZ 8
1005#define ELF_NOTE_SUSE_VERSION_DESCSZ 8 1011#define ELF_NOTE_SUSE_VERSION_DESCSZ 8
1006/* SuSE-specific note name */ 1012/* SuSE-specific note name */
1007#define ELF_NOTE_SUSE_VERSION_NAME "SuSE\0\0\0\0" 1013#define ELF_NOTE_SUSE_VERSION_NAME "SuSE\0\0\0\0"
1008 1014
1009/* Go-specific note type: buildid 1015/* Go-specific note type: buildid
1010 * name: Go\0\0 1016 * name: Go\0\0
1011 * namesz: 4 1017 * namesz: 4
1012 * desc:  1018 * desc:
1013 * words[10] 1019 * words[10]
1014 * descsz: 40 1020 * descsz: 40
1015 */ 1021 */
1016#define ELF_NOTE_TYPE_GO_BUILDID_TAG 4 1022#define ELF_NOTE_TYPE_GO_BUILDID_TAG 4
1017#define ELF_NOTE_GO_BUILDID_NAMESZ 4 1023#define ELF_NOTE_GO_BUILDID_NAMESZ 4
1018#define ELF_NOTE_GO_BUILDID_DESCSZ 40 1024#define ELF_NOTE_GO_BUILDID_DESCSZ 40
1019#define ELF_NOTE_GO_BUILDID_NAME "Go\0\0" 1025#define ELF_NOTE_GO_BUILDID_NAME "Go\0\0"
1020 1026
1021/* NetBSD-specific note type: NetBSD ABI version. 1027/* NetBSD-specific note type: NetBSD ABI version.
1022 * name: NetBSD\0\0 1028 * name: NetBSD\0\0
1023 * namesz: 8 1029 * namesz: 8
1024 * desc:  1030 * desc:
1025 * word[0]: MMmmrrpp00 1031 * word[0]: MMmmrrpp00
1026 * 1032 *
1027 * M = major version 1033 * M = major version
1028 * m = minor version 1034 * m = minor version
1029 * r = release ["",A-Z,Z[A-Z] but numeric] 1035 * r = release ["",A-Z,Z[A-Z] but numeric]
1030 * p = patchlevel 1036 * p = patchlevel
1031 * descsz: 4 1037 * descsz: 4
1032 */ 1038 */
1033#define ELF_NOTE_TYPE_NETBSD_TAG 1 1039#define ELF_NOTE_TYPE_NETBSD_TAG 1
1034/* NetBSD-specific note name and description sizes */ 1040/* NetBSD-specific note name and description sizes */
1035#define ELF_NOTE_NETBSD_NAMESZ 7 1041#define ELF_NOTE_NETBSD_NAMESZ 7
1036#define ELF_NOTE_NETBSD_DESCSZ 4 1042#define ELF_NOTE_NETBSD_DESCSZ 4
1037/* NetBSD-specific note name */ 1043/* NetBSD-specific note name */
1038#define ELF_NOTE_NETBSD_NAME "NetBSD\0\0" 1044#define ELF_NOTE_NETBSD_NAME "NetBSD\0\0"
1039 1045
1040/* NetBSD-specific note type: Emulation (obsolete; last used early 2000) 1046/* NetBSD-specific note type: Emulation (obsolete; last used early 2000)
1041 * name: NetBSD\0\0 1047 * name: NetBSD\0\0
1042 * namesz: 8 1048 * namesz: 8
1043 * desc: 1049 * desc:
1044 * "netbsd\0" 1050 * "netbsd\0"
1045 *  1051 *
1046 * descsz: 8 1052 * descsz: 8
1047 */ 1053 */
1048#define ELF_NOTE_TYPE_NETBSD_EMUL_TAG 2 1054#define ELF_NOTE_TYPE_NETBSD_EMUL_TAG 2
1049#define ELF_NOTE_NETBSD_EMUL_NAMESZ 7 1055#define ELF_NOTE_NETBSD_EMUL_NAMESZ 7
1050#define ELF_NOTE_NETBSD_EMUL_DESCSZ 7 1056#define ELF_NOTE_NETBSD_EMUL_DESCSZ 7
1051/* NetBSD-specific note name */ 1057/* NetBSD-specific note name */
1052#define ELF_NOTE_NETBSD_EMUL_NAME "NetBSD\0\0" 1058#define ELF_NOTE_NETBSD_EMUL_NAME "NetBSD\0\0"
1053 1059
1054/* 1060/*
1055 * NetBSD-specific note type: PaX. 1061 * NetBSD-specific note type: PaX.
1056 * There should be 1 NOTE per executable. 1062 * There should be 1 NOTE per executable.
1057 * name: PaX\0 1063 * name: PaX\0
1058 * namesz: 4 1064 * namesz: 4
1059 * desc: 1065 * desc:
1060 * word[0]: capability bitmask 1066 * word[0]: capability bitmask
1061 * descsz: 4 1067 * descsz: 4
1062 */ 1068 */
1063#define ELF_NOTE_TYPE_PAX_TAG 3 1069#define ELF_NOTE_TYPE_PAX_TAG 3
1064#define ELF_NOTE_PAX_MPROTECT 0x01 /* Force enable Mprotect */ 1070#define ELF_NOTE_PAX_MPROTECT 0x01 /* Force enable Mprotect */
1065#define ELF_NOTE_PAX_NOMPROTECT 0x02 /* Force disable Mprotect */ 1071#define ELF_NOTE_PAX_NOMPROTECT 0x02 /* Force disable Mprotect */
1066#define ELF_NOTE_PAX_GUARD 0x04 /* Force enable Segvguard */ 1072#define ELF_NOTE_PAX_GUARD 0x04 /* Force enable Segvguard */
1067#define ELF_NOTE_PAX_NOGUARD 0x08 /* Force disable Segvguard */ 1073#define ELF_NOTE_PAX_NOGUARD 0x08 /* Force disable Segvguard */
1068#define ELF_NOTE_PAX_ASLR 0x10 /* Force enable ASLR */ 1074#define ELF_NOTE_PAX_ASLR 0x10 /* Force enable ASLR */
1069#define ELF_NOTE_PAX_NOASLR 0x20 /* Force disable ASLR */ 1075#define ELF_NOTE_PAX_NOASLR 0x20 /* Force disable ASLR */
1070#define ELF_NOTE_PAX_NAMESZ 4 1076#define ELF_NOTE_PAX_NAMESZ 4
1071#define ELF_NOTE_PAX_NAME "PaX\0" 1077#define ELF_NOTE_PAX_NAME "PaX\0"
1072#define ELF_NOTE_PAX_DESCSZ 4 1078#define ELF_NOTE_PAX_DESCSZ 4
1073 1079
1074/* 1080/*
1075 * NetBSD-specific core file information. 1081 * NetBSD-specific core file information.
1076 * 1082 *
1077 * NetBSD ELF core files use notes to provide information about 1083 * NetBSD ELF core files use notes to provide information about
1078 * the process's state. The note name is "NetBSD-CORE" for 1084 * the process's state. The note name is "NetBSD-CORE" for
1079 * information that is global to the process, and "NetBSD-CORE@nn", 1085 * information that is global to the process, and "NetBSD-CORE@nn",
1080 * where "nn" is the lwpid of the LWP that the information belongs 1086 * where "nn" is the lwpid of the LWP that the information belongs
1081 * to (such as register state). 1087 * to (such as register state).
1082 * 1088 *
1083 * We use the following note identifiers: 1089 * We use the following note identifiers:
1084 * 1090 *
1085 * ELF_NOTE_NETBSD_CORE_PROCINFO 1091 * ELF_NOTE_NETBSD_CORE_PROCINFO
1086 * Note is a "netbsd_elfcore_procinfo" structure. 1092 * Note is a "netbsd_elfcore_procinfo" structure.
1087 * ELF_NOTE_NETBSD_CORE_AUXV 1093 * ELF_NOTE_NETBSD_CORE_AUXV
1088 * Note is an array of AuxInfo structures. 1094 * Note is an array of AuxInfo structures.
1089 * 1095 *
1090 * We also use ptrace(2) request numbers (the ones that exist in 1096 * We also use ptrace(2) request numbers (the ones that exist in
1091 * machine-dependent space) to identify register info notes. The 1097 * machine-dependent space) to identify register info notes. The
1092 * info in such notes is in the same format that ptrace(2) would 1098 * info in such notes is in the same format that ptrace(2) would
1093 * export that information. 1099 * export that information.
1094 * 1100 *
1095 * Please try to keep the members of this structure nicely aligned, 1101 * Please try to keep the members of this structure nicely aligned,
1096 * and if you add elements, add them to the end and bump the version. 1102 * and if you add elements, add them to the end and bump the version.
1097 */ 1103 */
1098 1104
1099#define ELF_NOTE_NETBSD_CORE_NAME "NetBSD-CORE" 1105#define ELF_NOTE_NETBSD_CORE_NAME "NetBSD-CORE"
1100 1106
1101#define ELF_NOTE_NETBSD_CORE_PROCINFO 1 1107#define ELF_NOTE_NETBSD_CORE_PROCINFO 1
1102#define ELF_NOTE_NETBSD_CORE_AUXV 2 1108#define ELF_NOTE_NETBSD_CORE_AUXV 2
1103 1109
1104#define NETBSD_ELFCORE_PROCINFO_VERSION 1 1110#define NETBSD_ELFCORE_PROCINFO_VERSION 1
1105 1111
1106struct netbsd_elfcore_procinfo { 1112struct netbsd_elfcore_procinfo {
1107 /* Version 1 fields start here. */ 1113 /* Version 1 fields start here. */
1108 uint32_t cpi_version; /* our version */ 1114 uint32_t cpi_version; /* our version */
1109 uint32_t cpi_cpisize; /* sizeof(this struct) */ 1115 uint32_t cpi_cpisize; /* sizeof(this struct) */
1110 uint32_t cpi_signo; /* killing signal */ 1116 uint32_t cpi_signo; /* killing signal */
1111 uint32_t cpi_sigcode; /* signal code */ 1117 uint32_t cpi_sigcode; /* signal code */
1112 uint32_t cpi_sigpend[4]; /* pending signals */ 1118 uint32_t cpi_sigpend[4]; /* pending signals */
1113 uint32_t cpi_sigmask[4]; /* blocked signals */ 1119 uint32_t cpi_sigmask[4]; /* blocked signals */
1114 uint32_t cpi_sigignore[4]; /* ignored signals */ 1120 uint32_t cpi_sigignore[4]; /* ignored signals */
1115 uint32_t cpi_sigcatch[4]; /* caught signals */ 1121 uint32_t cpi_sigcatch[4]; /* caught signals */
1116 int32_t cpi_pid; /* process ID */ 1122 int32_t cpi_pid; /* process ID */
1117 int32_t cpi_ppid; /* parent process ID */ 1123 int32_t cpi_ppid; /* parent process ID */
1118 int32_t cpi_pgrp; /* process group ID */ 1124 int32_t cpi_pgrp; /* process group ID */
1119 int32_t cpi_sid; /* session ID */ 1125 int32_t cpi_sid; /* session ID */
1120 uint32_t cpi_ruid; /* real user ID */ 1126 uint32_t cpi_ruid; /* real user ID */
1121 uint32_t cpi_euid; /* effective user ID */ 1127 uint32_t cpi_euid; /* effective user ID */
1122 uint32_t cpi_svuid; /* saved user ID */ 1128 uint32_t cpi_svuid; /* saved user ID */
1123 uint32_t cpi_rgid; /* real group ID */ 1129 uint32_t cpi_rgid; /* real group ID */
1124 uint32_t cpi_egid; /* effective group ID */ 1130 uint32_t cpi_egid; /* effective group ID */
1125 uint32_t cpi_svgid; /* saved group ID */ 1131 uint32_t cpi_svgid; /* saved group ID */
1126 uint32_t cpi_nlwps; /* number of LWPs */ 1132 uint32_t cpi_nlwps; /* number of LWPs */
1127 int8_t cpi_name[32]; /* copy of p->p_comm */ 1133 int8_t cpi_name[32]; /* copy of p->p_comm */
1128 /* Add version 2 fields below here. */ 1134 /* Add version 2 fields below here. */
1129 int32_t cpi_siglwp; /* LWP target of killing signal */ 1135 int32_t cpi_siglwp; /* LWP target of killing signal */
1130}; 1136};
1131 1137
1132/* 1138/*
1133 * NetBSD-specific note type: MACHINE_ARCH. 1139 * NetBSD-specific note type: MACHINE_ARCH.
1134 * There should be 1 NOTE per executable. 1140 * There should be 1 NOTE per executable.
1135 * name: NetBSD\0 1141 * name: NetBSD\0
1136 * namesz: 7 1142 * namesz: 7
1137 * desc: string 1143 * desc: string
1138 * descsz: variable 1144 * descsz: variable
1139 */ 1145 */
1140#define ELF_NOTE_TYPE_MARCH_TAG 5 1146#define ELF_NOTE_TYPE_MARCH_TAG 5
1141/* NetBSD-specific note name and description sizes */ 1147/* NetBSD-specific note name and description sizes */
1142#define ELF_NOTE_MARCH_NAMESZ ELF_NOTE_NETBSD_NAMESZ 1148#define ELF_NOTE_MARCH_NAMESZ ELF_NOTE_NETBSD_NAMESZ
1143/* NetBSD-specific note name */ 1149/* NetBSD-specific note name */
1144#define ELF_NOTE_MARCH_NAME ELF_NOTE_NETBSD_NAME 1150#define ELF_NOTE_MARCH_NAME ELF_NOTE_NETBSD_NAME
1145 1151
1146/* 1152/*
1147 * NetBSD-specific note type: MCMODEL 1153 * NetBSD-specific note type: MCMODEL
1148 * There should be 1 NOTE per executable. 1154 * There should be 1 NOTE per executable.
1149 * name: NetBSD\0 1155 * name: NetBSD\0
1150 * namesz: 7 1156 * namesz: 7
1151 * code model: string 1157 * code model: string
1152 */ 1158 */
1153 1159
1154#define ELF_NOTE_TYPE_MCMODEL_TAG 6 1160#define ELF_NOTE_TYPE_MCMODEL_TAG 6
1155/* NetBSD-specific note name and description sizes */ 1161/* NetBSD-specific note name and description sizes */
1156#define ELF_NOTE_MCMODEL_NAMESZ ELF_NOTE_NETBSD_NAMESZ 1162#define ELF_NOTE_MCMODEL_NAMESZ ELF_NOTE_NETBSD_NAMESZ
1157/* NetBSD-specific note name */ 1163/* NetBSD-specific note name */
1158#define ELF_NOTE_MCMODEL_NAME ELF_NOTE_NETBSD_NAME 1164#define ELF_NOTE_MCMODEL_NAME ELF_NOTE_NETBSD_NAME
1159 1165
1160 1166
1161#if !defined(ELFSIZE) 1167#if !defined(ELFSIZE)
1162# if defined(_RUMPKERNEL) || !defined(_KERNEL) 1168# if defined(_RUMPKERNEL) || !defined(_KERNEL)
1163# define ELFSIZE ARCH_ELFSIZE 1169# define ELFSIZE ARCH_ELFSIZE
1164# else 1170# else
1165# define ELFSIZE KERN_ELFSIZE 1171# define ELFSIZE KERN_ELFSIZE
1166# endif 1172# endif
1167#endif 1173#endif
1168 1174
1169#if defined(ELFSIZE) 1175#if defined(ELFSIZE)
1170#define CONCAT(x,y) __CONCAT(x,y) 1176#define CONCAT(x,y) __CONCAT(x,y)
1171#define ELFNAME(x) CONCAT(elf,CONCAT(ELFSIZE,CONCAT(_,x))) 1177#define ELFNAME(x) CONCAT(elf,CONCAT(ELFSIZE,CONCAT(_,x)))
1172#define ELFNAME2(x,y) CONCAT(x,CONCAT(_elf,CONCAT(ELFSIZE,CONCAT(_,y)))) 1178#define ELFNAME2(x,y) CONCAT(x,CONCAT(_elf,CONCAT(ELFSIZE,CONCAT(_,y))))
1173#define ELFNAMEEND(x) CONCAT(x,CONCAT(_elf,ELFSIZE)) 1179#define ELFNAMEEND(x) CONCAT(x,CONCAT(_elf,ELFSIZE))
1174#define ELFDEFNNAME(x) CONCAT(ELF,CONCAT(ELFSIZE,CONCAT(_,x))) 1180#define ELFDEFNNAME(x) CONCAT(ELF,CONCAT(ELFSIZE,CONCAT(_,x)))
1175#define ElfW(x) CONCAT(Elf,CONCAT(ELFSIZE,CONCAT(_,x))) 1181#define ElfW(x) CONCAT(Elf,CONCAT(ELFSIZE,CONCAT(_,x)))
1176#endif 1182#endif
1177 1183
1178#if defined(ELFSIZE) && (ELFSIZE == 32) 1184#if defined(ELFSIZE) && (ELFSIZE == 32)
1179#define Elf_Ehdr Elf32_Ehdr 1185#define Elf_Ehdr Elf32_Ehdr
1180#define Elf_Phdr Elf32_Phdr 1186#define Elf_Phdr Elf32_Phdr
1181#define Elf_Shdr Elf32_Shdr 1187#define Elf_Shdr Elf32_Shdr
1182#define Elf_Sym Elf32_Sym 1188#define Elf_Sym Elf32_Sym
1183#define Elf_Rel Elf32_Rel 1189#define Elf_Rel Elf32_Rel
1184#define Elf_Rela Elf32_Rela 1190#define Elf_Rela Elf32_Rela
1185#define Elf_Dyn Elf32_Dyn 1191#define Elf_Dyn Elf32_Dyn
1186#define Elf_Word Elf32_Word 1192#define Elf_Word Elf32_Word
1187#define Elf_Sword Elf32_Sword 1193#define Elf_Sword Elf32_Sword
1188#define Elf_Half Elf32_Half 1194#define Elf_Half Elf32_Half
1189#define Elf_Addr Elf32_Addr 1195#define Elf_Addr Elf32_Addr