Hi,
below is last version of my attempt to migrate elf_abi.h to elf.h. This version
solves devel/libdwarf and devel/valgrind failures reported on ports@ by
Christian Weisgerber
Thanks,
Karel
? .cvsignore
Index: distrib/sets/lists/comp/mi
===================================================================
RCS file: /cvs/src/distrib/sets/lists/comp/mi,v
retrieving revision 1.1369
diff -u -p -u -r1.1369 mi
--- distrib/sets/lists/comp/mi 5 Sep 2017 03:16:14 -0000 1.1369
+++ distrib/sets/lists/comp/mi 15 Sep 2017 21:01:18 -0000
@@ -825,7 +825,7 @@
./usr/include/dirent.h
./usr/include/disktab.h
./usr/include/dlfcn.h
-./usr/include/elf_abi.h
+./usr/include/elf.h
./usr/include/endian.h
./usr/include/err.h
./usr/include/errno.h
Index: games/hangman/ksyms.c
===================================================================
RCS file: /cvs/src/games/hangman/ksyms.c,v
retrieving revision 1.10
diff -u -p -u -r1.10 ksyms.c
--- games/hangman/ksyms.c 8 Jan 2016 13:40:05 -0000 1.10
+++ games/hangman/ksyms.c 15 Sep 2017 21:01:49 -0000
@@ -18,7 +18,7 @@
#include <ctype.h>
#include <curses.h>
-#include <elf_abi.h>
+#include <elf.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
Index: include/Makefile
===================================================================
RCS file: /cvs/src/include/Makefile,v
retrieving revision 1.219
diff -u -p -u -r1.219 Makefile
--- include/Makefile 17 Apr 2017 15:53:21 -0000 1.219
+++ include/Makefile 15 Sep 2017 21:04:50 -0000
@@ -11,7 +11,7 @@
FILES= a.out.h ar.h asr.h assert.h bitstring.h blf.h bsd_auth.h \
complex.h cpio.h ctype.h curses.h db.h dirent.h disktab.h \
- dlfcn.h elf_abi.h err.h errno.h fenv.h float.h fnmatch.h fstab.h fts.h \
+ dlfcn.h elf.h err.h errno.h fenv.h float.h fnmatch.h fstab.h fts.h \
ftw.h getopt.h glob.h grp.h icdb.h ieeefp.h ifaddrs.h inttypes.h \
iso646.h kvm.h langinfo.h libgen.h limits.h link.h link_elf.h \
locale.h login_cap.h math.h md5.h memory.h ndbm.h netdb.h netgroup.h \
Index: include/elf.h
===================================================================
RCS file: include/elf.h
diff -N include/elf.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ include/elf.h 15 Sep 2017 21:04:50 -0000
@@ -0,0 +1,33 @@
+/* $OpenBSD: elf.h,v 1.4 1996/05/22 07:46:22 etheisen Exp $ */
+/*
+ * Copyright (c) 1996 Erik Theisen
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _ELF_H_
+#define _ELF_H_
+
+#include <sys/exec_elf.h>
+
+#endif /* _ELF_H_ */
Index: include/elf_abi.h
===================================================================
RCS file: include/elf_abi.h
diff -N include/elf_abi.h
--- include/elf_abi.h 22 May 1996 07:46:22 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,33 +0,0 @@
-/* $OpenBSD: elf_abi.h,v 1.4 1996/05/22 07:46:22 etheisen Exp $ */
-/*
- * Copyright (c) 1996 Erik Theisen
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _ELF_ABI_H_
-#define _ELF_ABI_H_
-
-#include <sys/exec_elf.h>
-
-#endif /* _ELF_ABI_H_ */
Index: include/link_elf.h
===================================================================
RCS file: /cvs/src/include/link_elf.h,v
retrieving revision 1.7
diff -u -p -u -r1.7 link_elf.h
--- include/link_elf.h 20 Sep 2016 18:24:55 -0000 1.7
+++ include/link_elf.h 15 Sep 2017 21:04:50 -0000
@@ -7,7 +7,7 @@
#ifndef _LINK_ELF_H
#define _LINK_ELF_H
-#include <elf_abi.h>
+#include <elf.h>
#ifndef DT_PROCNUM
#define DT_PROCNUM 0
Index: lib/libc/gen/elf_hash.c
===================================================================
RCS file: /cvs/src/lib/libc/gen/Attic/elf_hash.c,v
retrieving revision 1.9
diff -u -p -u -r1.9 elf_hash.c
--- lib/libc/gen/elf_hash.c 16 Jan 2015 16:48:51 -0000 1.9
+++ lib/libc/gen/elf_hash.c 15 Sep 2017 21:04:50 -0000
@@ -37,7 +37,7 @@
#include <unistd.h>
#include <sys/exec.h>
-#include <elf_abi.h>
+#include <elf.h>
/*
* Standard ELF ABI hash function.
Index: lib/libc/gen/nlist.c
===================================================================
RCS file: /cvs/src/lib/libc/gen/nlist.c,v
retrieving revision 1.68
diff -u -p -u -r1.68 nlist.c
--- lib/libc/gen/nlist.c 25 Dec 2016 20:30:41 -0000 1.68
+++ lib/libc/gen/nlist.c 15 Sep 2017 21:04:50 -0000
@@ -40,7 +40,7 @@
#include <string.h>
#include <unistd.h>
#include <a.out.h> /* pulls in nlist.h */
-#include <elf_abi.h>
+#include <elf.h>
#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
Index: libexec/ld.so/aarch64/archdep.h
===================================================================
RCS file: /cvs/src/libexec/ld.so/aarch64/archdep.h,v
retrieving revision 1.4
diff -u -p -u -r1.4 archdep.h
--- libexec/ld.so/aarch64/archdep.h 24 Jan 2017 07:48:37 -0000 1.4
+++ libexec/ld.so/aarch64/archdep.h 15 Sep 2017 21:05:00 -0000
@@ -33,7 +33,7 @@
#define MACHID EM_AARCH64 /* ELF e_machine ID value checked */
-#include <elf_abi.h>
+#include <elf.h>
#include <machine/reloc.h>
#include "syscall.h"
#include "util.h"
Index: libexec/ld.so/alpha/archdep.h
===================================================================
RCS file: /cvs/src/libexec/ld.so/alpha/archdep.h,v
retrieving revision 1.20
diff -u -p -u -r1.20 archdep.h
--- libexec/ld.so/alpha/archdep.h 24 Jan 2017 07:48:37 -0000 1.20
+++ libexec/ld.so/alpha/archdep.h 15 Sep 2017 21:05:00 -0000
@@ -33,7 +33,7 @@
#define MACHID EM_ALPHA_EXP /* ELF e_machine ID value checked */
-#include <elf_abi.h>
+#include <elf.h>
#include <machine/reloc.h>
#include "syscall.h"
#include "util.h"
Index: libexec/ld.so/amd64/archdep.h
===================================================================
RCS file: /cvs/src/libexec/ld.so/amd64/archdep.h,v
retrieving revision 1.11
diff -u -p -u -r1.11 archdep.h
--- libexec/ld.so/amd64/archdep.h 21 Jan 2017 01:15:00 -0000 1.11
+++ libexec/ld.so/amd64/archdep.h 15 Sep 2017 21:05:01 -0000
@@ -33,7 +33,7 @@
#define MACHID EM_AMD64 /* ELF e_machine ID value checked */
-#include <elf_abi.h>
+#include <elf.h>
#include <machine/reloc.h>
#include "syscall.h"
#include "util.h"
Index: libexec/ld.so/arm/archdep.h
===================================================================
RCS file: /cvs/src/libexec/ld.so/arm/archdep.h,v
retrieving revision 1.12
diff -u -p -u -r1.12 archdep.h
--- libexec/ld.so/arm/archdep.h 24 Jan 2017 07:48:37 -0000 1.12
+++ libexec/ld.so/arm/archdep.h 15 Sep 2017 21:05:01 -0000
@@ -33,7 +33,7 @@
#define MACHID EM_ARM /* ELF e_machine ID value checked */
-#include <elf_abi.h>
+#include <elf.h>
#include <machine/reloc.h>
#include "syscall.h"
#include "util.h"
Index: libexec/ld.so/hppa/archdep.h
===================================================================
RCS file: /cvs/src/libexec/ld.so/hppa/archdep.h,v
retrieving revision 1.15
diff -u -p -u -r1.15 archdep.h
--- libexec/ld.so/hppa/archdep.h 24 Jan 2017 07:48:37 -0000 1.15
+++ libexec/ld.so/hppa/archdep.h 15 Sep 2017 21:05:01 -0000
@@ -35,7 +35,7 @@
#define MACHID EM_PARISC /* ELF e_machine ID value
checked */
-#include <elf_abi.h>
+#include <elf.h>
#include <machine/reloc.h>
#include "syscall.h"
#include "util.h"
Index: libexec/ld.so/i386/archdep.h
===================================================================
RCS file: /cvs/src/libexec/ld.so/i386/archdep.h,v
retrieving revision 1.19
diff -u -p -u -r1.19 archdep.h
--- libexec/ld.so/i386/archdep.h 24 Jan 2017 07:48:37 -0000 1.19
+++ libexec/ld.so/i386/archdep.h 15 Sep 2017 21:05:01 -0000
@@ -33,7 +33,7 @@
#define MACHID EM_386 /* ELF e_machine ID value checked */
-#include <elf_abi.h>
+#include <elf.h>
#include <machine/reloc.h>
#include "syscall.h"
#include "util.h"
Index: libexec/ld.so/ldd/ldd.c
===================================================================
RCS file: /cvs/src/libexec/ld.so/ldd/ldd.c,v
retrieving revision 1.21
diff -u -p -u -r1.21 ldd.c
--- libexec/ld.so/ldd/ldd.c 2 Jul 2017 19:06:12 -0000 1.21
+++ libexec/ld.so/ldd/ldd.c 15 Sep 2017 21:05:01 -0000
@@ -26,7 +26,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <elf_abi.h>
+#include <elf.h>
#include <err.h>
#include <fcntl.h>
#include <string.h>
Index: libexec/ld.so/m88k/archdep.h
===================================================================
RCS file: /cvs/src/libexec/ld.so/m88k/archdep.h,v
retrieving revision 1.5
diff -u -p -u -r1.5 archdep.h
--- libexec/ld.so/m88k/archdep.h 24 Jan 2017 07:48:37 -0000 1.5
+++ libexec/ld.so/m88k/archdep.h 15 Sep 2017 21:05:01 -0000
@@ -33,7 +33,7 @@
#define MACHID EM_88K /* ELF e_machine ID value
checked */
-#include <elf_abi.h>
+#include <elf.h>
#include <machine/reloc.h>
#include "syscall.h"
#include "util.h"
Index: libexec/ld.so/powerpc/archdep.h
===================================================================
RCS file: /cvs/src/libexec/ld.so/powerpc/archdep.h,v
retrieving revision 1.21
diff -u -p -u -r1.21 archdep.h
--- libexec/ld.so/powerpc/archdep.h 24 Jan 2017 07:48:37 -0000 1.21
+++ libexec/ld.so/powerpc/archdep.h 15 Sep 2017 21:05:01 -0000
@@ -33,7 +33,7 @@
#define MACHID EM_PPC /* ELF e_machine ID value checked */
-#include <elf_abi.h>
+#include <elf.h>
#include <machine/reloc.h>
#include "syscall.h"
#include "util.h"
Index: libexec/ld.so/sh/archdep.h
===================================================================
RCS file: /cvs/src/libexec/ld.so/sh/archdep.h,v
retrieving revision 1.10
diff -u -p -u -r1.10 archdep.h
--- libexec/ld.so/sh/archdep.h 24 Jan 2017 07:48:37 -0000 1.10
+++ libexec/ld.so/sh/archdep.h 15 Sep 2017 21:05:01 -0000
@@ -33,7 +33,7 @@
#define MACHID EM_SH /* ELF e_machine ID value checked */
-#include <elf_abi.h>
+#include <elf.h>
#include <machine/reloc.h>
#include "syscall.h"
#include "util.h"
Index: libexec/ld.so/sparc64/archdep.h
===================================================================
RCS file: /cvs/src/libexec/ld.so/sparc64/archdep.h,v
retrieving revision 1.25
diff -u -p -u -r1.25 archdep.h
--- libexec/ld.so/sparc64/archdep.h 24 Jan 2017 07:48:37 -0000 1.25
+++ libexec/ld.so/sparc64/archdep.h 15 Sep 2017 21:05:01 -0000
@@ -33,7 +33,7 @@
#define MACHID EM_SPARCV9 /* ELF e_machine ID value checked */
-#include <elf_abi.h>
+#include <elf.h>
#include <machine/reloc.h>
#include "syscall.h"
#include "util.h"
Index: sys/ddb/db_dwarf.c
===================================================================
RCS file: /cvs/src/sys/ddb/db_dwarf.c,v
retrieving revision 1.6
diff -u -p -u -r1.6 db_dwarf.c
--- sys/ddb/db_dwarf.c 8 Sep 2017 05:36:52 -0000 1.6
+++ sys/ddb/db_dwarf.c 15 Sep 2017 21:06:57 -0000
@@ -396,7 +396,7 @@ next:
#include <sys/endian.h>
#include <sys/mman.h>
#include <sys/stat.h>
-#include <elf_abi.h>
+#include <elf.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
Index: sys/sys/exec_elf.h
===================================================================
RCS file: /cvs/src/sys/sys/exec_elf.h,v
retrieving revision 1.75
diff -u -p -u -r1.75 exec_elf.h
--- sys/sys/exec_elf.h 5 Sep 2017 06:35:19 -0000 1.75
+++ sys/sys/exec_elf.h 15 Sep 2017 21:07:17 -0000
@@ -33,99 +33,70 @@
#ifndef _SYS_EXEC_ELF_H_
#define _SYS_EXEC_ELF_H_
-#include <sys/types.h>
+#include <machine/_types.h>
#include <machine/exec.h>
-typedef __uint8_t Elf_Byte;
+/*
+ * System V Application Binary Interface - DRAFT - 10 June 2013
+ * http://www.sco.com/developers/gabi/latest/contents.html
+ */
+
+/*
+ * Introduction/Data Representation
+ * http://www.sco.com/developers/gabi/latest/ch4.intro.html
+ */
+/*
+ * 32-Bit Data Types
+ */
+
+/* typedef __uint8_t Elf_Byte; -- not in spec! */
typedef __uint32_t Elf32_Addr; /* Unsigned program address */
typedef __uint32_t Elf32_Off; /* Unsigned file offset */
-typedef __int32_t Elf32_Sword; /* Signed large integer */
-typedef __uint32_t Elf32_Word; /* Unsigned large integer */
typedef __uint16_t Elf32_Half; /* Unsigned medium integer */
+typedef __uint32_t Elf32_Word; /* Unsigned large integer */
+typedef __int32_t Elf32_Sword; /* Signed large integer */
+/* spec also counts with `unsigned char' being 1 byte long with
+ 1 byte alignment as an unsigned small integer */
-typedef __uint64_t Elf64_Addr;
-typedef __uint64_t Elf64_Off;
-typedef __int32_t Elf64_Shalf;
+/*
+ * 64-Bit Data Types
+ */
+typedef __uint64_t Elf64_Addr; /* Unsigned program address */
+typedef __uint64_t Elf64_Off; /* Unsigned file offset */
+typedef __uint16_t Elf64_Half; /* Unsigned medium integer */
+/* typedef __int32_t Elf64_Shalf; -- not in spec! */
+/* alpha definition is not in spec!
#ifdef __alpha__
-typedef __int64_t Elf64_Sword;
typedef __uint64_t Elf64_Word;
-#else
-typedef __int32_t Elf64_Sword;
-typedef __uint32_t Elf64_Word;
-#endif
-
-typedef __int64_t Elf64_Sxword;
-typedef __uint64_t Elf64_Xword;
+typedef __int64_t Elf64_Sword;
+#else */
+typedef __uint32_t Elf64_Word; /* Unsigned integer */
+typedef __int32_t Elf64_Sword; /* Signed integer */
+/* #endif */
+typedef __uint64_t Elf64_Xword; /* Unsigned long integer */
+typedef __int64_t Elf64_Sxword; /* Signed long integer */
+/* incorrect width with regarding to spec (Elf64_Half)
+ and not in spec at all (Elf64_Quarter)
typedef __uint32_t Elf64_Half;
typedef __uint16_t Elf64_Quarter;
+*/
+/* spec also counts with `unsigned char' being 1 byte long with
+ 1 byte alignment as an unsigned small integer */
/*
- * e_ident[] identification indexes
- * See http://www.sco.com/developers/gabi/latest/ch4.eheader.html
+ * ELF Header
+ * http://www.sco.com/developers/gabi/latest/ch4.eheader.html
*/
-#define EI_MAG0 0 /* file ID */
-#define EI_MAG1 1 /* file ID */
-#define EI_MAG2 2 /* file ID */
-#define EI_MAG3 3 /* file ID */
-#define EI_CLASS 4 /* file class */
-#define EI_DATA 5 /* data encoding */
-#define EI_VERSION 6 /* ELF header version */
-#define EI_OSABI 7 /* OS/ABI ID */
-#define EI_ABIVERSION 8 /* ABI version */
-#define EI_PAD 9 /* start of pad bytes */
-#define EI_NIDENT 16 /* Size of e_ident[] */
-
-/* e_ident[] magic number */
-#define ELFMAG0 0x7f /* e_ident[EI_MAG0] */
-#define ELFMAG1 'E' /* e_ident[EI_MAG1] */
-#define ELFMAG2 'L' /* e_ident[EI_MAG2] */
-#define ELFMAG3 'F' /* e_ident[EI_MAG3] */
-#define ELFMAG "\177ELF" /* magic */
-#define SELFMAG 4 /* size of magic */
-
-/* e_ident[] file class */
-#define ELFCLASSNONE 0 /* invalid */
-#define ELFCLASS32 1 /* 32-bit objs */
-#define ELFCLASS64 2 /* 64-bit objs */
-#define ELFCLASSNUM 3 /* number of classes */
-
-/* e_ident[] data encoding */
-#define ELFDATANONE 0 /* invalid */
-#define ELFDATA2LSB 1 /* Little-Endian */
-#define ELFDATA2MSB 2 /* Big-Endian */
-#define ELFDATANUM 3 /* number of data encode defines */
-
-/* e_ident[] Operating System/ABI */
-#define ELFOSABI_SYSV 0 /* UNIX System V ABI */
-#define ELFOSABI_HPUX 1 /* HP-UX operating system */
-#define ELFOSABI_NETBSD 2 /* NetBSD */
-#define ELFOSABI_LINUX 3 /* GNU/Linux */
-#define ELFOSABI_HURD 4 /* GNU/Hurd */
-#define ELFOSABI_86OPEN 5 /* 86Open common IA32 ABI */
-#define ELFOSABI_SOLARIS 6 /* Solaris */
-#define ELFOSABI_MONTEREY 7 /* Monterey */
-#define ELFOSABI_IRIX 8 /* IRIX */
-#define ELFOSABI_FREEBSD 9 /* FreeBSD */
-#define ELFOSABI_TRU64 10 /* TRU64 UNIX */
-#define ELFOSABI_MODESTO 11 /* Novell Modesto */
-#define ELFOSABI_OPENBSD 12 /* OpenBSD */
-#define ELFOSABI_ARM 97 /* ARM */
-#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
-/* e_ident */
-#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \
- (ehdr).e_ident[EI_MAG1] == ELFMAG1 && \
- (ehdr).e_ident[EI_MAG2] == ELFMAG2 && \
- (ehdr).e_ident[EI_MAG3] == ELFMAG3)
+#define EI_NIDENT 16 /* Size of e_ident[] */
-/* ELF Header */
-typedef struct elfhdr {
+typedef struct {
unsigned char e_ident[EI_NIDENT]; /* ELF Identification */
Elf32_Half e_type; /* object file type */
- Elf32_Half e_machine; /* machine */
+ Elf32_Half e_machine; /* machine type */
Elf32_Word e_version; /* object file version */
Elf32_Addr e_entry; /* virtual entry point */
Elf32_Off e_phoff; /* program header table offset */
@@ -141,70 +112,394 @@ typedef struct elfhdr {
} Elf32_Ehdr;
typedef struct {
- unsigned char e_ident[EI_NIDENT]; /* Id bytes */
- Elf64_Quarter e_type; /* file type */
- Elf64_Quarter e_machine; /* machine type */
- Elf64_Half e_version; /* version number */
+ unsigned char e_ident[EI_NIDENT]; /* ELF Identification */
+ Elf64_Half e_type; /* object file type */
+ Elf64_Half e_machine; /* machine type */
+ Elf64_Word e_version; /* object file version */
Elf64_Addr e_entry; /* entry point */
Elf64_Off e_phoff; /* Program hdr offset */
Elf64_Off e_shoff; /* Section hdr offset */
- Elf64_Half e_flags; /* Processor flags */
- Elf64_Quarter e_ehsize; /* sizeof ehdr */
- Elf64_Quarter e_phentsize; /* Program header entry size */
- Elf64_Quarter e_phnum; /* Number of program headers */
- Elf64_Quarter e_shentsize; /* Section header entry size */
- Elf64_Quarter e_shnum; /* Number of section headers */
- Elf64_Quarter e_shstrndx; /* String table index */
+ Elf64_Word e_flags; /* Processor flags */
+ Elf64_Half e_ehsize; /* sizeof ehdr */
+ Elf64_Half e_phentsize; /* Program header entry size */
+ Elf64_Half e_phnum; /* Number of program headers */
+ Elf64_Half e_shentsize; /* Section header entry size */
+ Elf64_Half e_shnum; /* Number of section headers */
+ Elf64_Half e_shstrndx; /* String table index */
} Elf64_Ehdr;
-/* e_type */
+/* e_type -- This member identifies the object file type. */
#define ET_NONE 0 /* No file type */
#define ET_REL 1 /* relocatable file */
#define ET_EXEC 2 /* executable file */
#define ET_DYN 3 /* shared object file */
#define ET_CORE 4 /* core file */
-#define ET_NUM 5 /* number of types */
-#define ET_LOPROC 0xff00 /* reserved range for processor */
-#define ET_HIPROC 0xffff /* specific e_type */
+/* #define ET_NUM 5*/ /* number of types */ /*-- not
in spec! */
+#define ET_LOOS 0xfe00 /* operating system specific */
+#define ET_HIOS 0xfeff /* operating system specific */
+#define ET_LOPROC 0xff00 /* processor specific */
+#define ET_HIPROC 0xffff /* processor specific */
-/* e_machine */
+/* e_machine -- This member's value specifies the required architecture
+ for an individual file. */
#define EM_NONE 0 /* No Machine */
#define EM_M32 1 /* AT&T WE 32100 */
#define EM_SPARC 2 /* SPARC */
#define EM_386 3 /* Intel 80386 */
#define EM_68K 4 /* Motorola 68000 */
#define EM_88K 5 /* Motorola 88000 */
-#define EM_486 6 /* Intel 80486 - unused? */
+#define EM_IAMCU 6 /* Intel MCU */
#define EM_860 7 /* Intel 80860 */
-#define EM_MIPS 8 /* MIPS R3000 Big-Endian only */
-/*
- * Don't know if EM_MIPS_RS4_BE,
- * EM_SPARC64, EM_PARISC,
- * or EM_PPC are ABI compliant
- */
-#define EM_MIPS_RS4_BE 10 /* MIPS R4000 Big-Endian */
-#define EM_SPARC64 11 /* SPARC v9 64-bit unofficial */
+#define EM_MIPS 8 /* MIPS I Architecture
+ (R3000 Big-Endian only) */
+#define EM_S370 9 /* IBM System/370 Processor */
+#define EM_MIPS_RS3_LE 10 /* MIPS R3000 Little-Endian */
+ /* 11 - 14 reserved for future use */
#define EM_PARISC 15 /* HPPA */
+ /* 16 reserved for future use */
+#define EM_VPP500 17 /* Fujitsu VPP500 */
#define EM_SPARC32PLUS 18 /* Enhanced instruction set SPARC */
+#define EM_960 19 /* Intel 960 */
#define EM_PPC 20 /* PowerPC */
-#define EM_ARM 40 /* Advanced RISC Machines ARM */
+#define EM_PPC64 21 /* PowerPC 64 */
+#define EM_S390 22 /* IBM System/390 Processor */
+#define EM_SPU 23 /* IBM SPU/SPC */
+ /* 24 - 35 reserved for future use */
+#define EM_V800 36 /* NEC V800 */
+#define EM_FR20 37 /* Fujitsu FR20 */
+#define EM_RH32 38 /* TRW RH-32 */
+#define EM_RCE 39 /* Motorola RCE */
+#define EM_ARM 40 /* ARM 32-bit architecture
(AARCH32) */
#define EM_ALPHA 41 /* DEC ALPHA */
#define EM_SH 42 /* Hitachi/Renesas Super-H */
#define EM_SPARCV9 43 /* SPARC version 9 */
+#define EM_TRICORE 44 /* Siemens TriCore embedded
processor */
+#define EM_ARC 45 /* Argonaut RISC Core,
+ Argonaut Technologies Inc. */
+#define EM_H8_300 46 /* Hitachi H8/300 */
+#define EM_H8_300H 47 /* Hitachi H8/300H */
+#define EM_H8S 48 /* Hitachi H8S */
+#define EM_H8_500 49 /* Hitachi H8/500 */
#define EM_IA_64 50 /* Intel IA-64 Processor */
-#define EM_AMD64 62 /* AMD64 architecture */
+#define EM_MIPS_X 51 /* Stanford MIPS-X */
+#define EM_COLDFIRE 52 /* Motorola ColdFire */
+#define EM_68HC12 53 /* Motorola H68HC12 */
+#define EM_MMA 54 /* Fujitsu MMA Multimedia
Accelerator */
+#define EM_PCP 55 /* Siemens PCP */
+#define EM_NCPU 56 /* Sony nCPU embedded RISC
processor */
+#define EM_NDR1 57 /* Denso NDR1 microprocessor */
+#define EM_STARCORE 58 /* Motorola Star*Core processor
*/
+#define EM_ME16 59 /* Toyota ME16 processor */
+#define EM_ST100 60 /* STMicroelectronics ST100
processor */
+#define EM_TINYJ 61 /* Advanced Logic Corp. TineJ
+ embedded processor family */
+#define EM_X86_64 62 /* AMD x86-64 architecture */
+#define EM_DPSP 63 /* Sony DSP Processor */
+#define EM_PDP10 64 /* Digital Equipment Corp.
PDP-10 */
+#define EM_PDP11 65 /* Digital Equipment Corp.
PDP-11 */
+#define EM_FX66 66 /* Siemens FX66 microcontroller
*/
+#define EM_ST9PLUS 67 /* STMicroelectronics ST9+
+ 8/16 bit microcontroller */
+#define EM_ST7 68 /* STMicroelectronics ST7
+ 8-bit microcontroller */
+#define EM_68HC16 69 /* Motorola MC68HC16
Microcontroller */
+#define EM_68HC11 70 /* Motorola MC68HC11
Microcontroller */
+#define EM_68HC08 71 /* Motorola MC68HC08
Microcontroller */
+#define EM_68HC05 72 /* Motorola MC68HC05
Microcontroller */
+#define EM_SVX 73 /* Silicon Graphics SVx */
+#define EM_ST19 74 /* STMicroelectronics ST19
+ 8-bit microcontroller */
#define EM_VAX 75 /* DEC VAX */
-#define EM_AARCH64 183 /* ARM 64-bit architecture (AArch64) */
+#define EM_CRIS 76 /* Axis Communications
+ 32-bit embedded processor */
+#define EM_JAVELIN 77 /* Infineon Technologies
+ 32-bit embedded processor */
+#define EM_FIREPATH 78 /* Element 14 64-bit DSP
Processor */
+#define EM_ZSP 79 /* LSI Logic 16-bit DSP
Processor */
+#define EM_MMIX 80 /* Donald Knuth's educational
+ 64-bit processor */
+#define EM_HUANY 81 /* Harvard Uni.
machine-independent
+ object files */
+#define EM_PRISM 82 /* SiTera Prism */
+#define EM_AVR 83 /* Atmel AVR 8-bit
microcontroller */
+#define EM_FR30 84 /* Fujitsu FR30 */
+#define EM_D10V 85 /* Mitsubishi D10V */
+#define EM_D30V 86 /* Mitsubishi D30V */
+#define EM_V850 87 /* NEC v850 */
+#define EM_M32R 88 /* Mitsubishi M32R */
+#define EM_MN10300 89 /* Matsushita MN10300 */
+#define EM_MN10200 90 /* Matsushita MN10200 */
+#define EM_PJ 91 /* picoJava */
+#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded
processor */
+#define EM_ARC_COMPACT 93 /* ARC International ARCompact
processor
+ (old spelling/synonym: EM_ARC_A5) */
+#define EM_XTENSA 94 /* Tensilica Xtensa
Architecture */
+#define EM_VIDEOCORE 95 /* Alphamosaic VideoCore
processor */
+#define EM_TMM_GPP 96 /* Thompson Multimedia General
Purpose
+ Processor */
+#define EM_NS32K 97 /* National Semiconductor 32000
series*/
+#define EM_TPC 98 /* Tenor Network TPC processor
*/
+#define EM_SNP1K 99 /* Trebia SNP 1000 processor */
+#define EM_ST200 100 /* STMicroelectronics ST200
+ microcontroller */
+#define EM_IP2K 101 /* Ubicom IP2xxx microcontroller
+ family */
+#define EM_MAX 102 /* MAX Processor */
+#define EM_CR 103 /* National Semiconductor
CompactRISC
+ microprocessor */
+#define EM_F2MC16 104 /* Fujitsu F2MC16 */
+#define EM_MSP430 105 /* Texas Instruments embedded
+ microcontroller msp430 */
+#define EM_BLACKFIN 106 /* Analog Devices Blackfin (DSP)
+ processor */
+#define EM_SE_C33 107 /* S1C33 Family of Seiko Epson
+ processors */
+#define EM_SEP 108 /* Sharp embedded
microprocessor */
+#define EM_ARCA 109 /* Arca RISC Microprocessor */
+#define EM_UNICORE 110 /* Microprocessor series from
PKU-Unity
+ Ltd. and MPRC of Peking University */
+#define EM_EXCESS 111 /* eXcess: 16/32/64-bit
configurable
+ embedded CPU */
+#define EM_DXP 112 /* Icera Semiconductor Inc. Deep
+ Execution Processor */
+#define EM_ALTERA_NIOS2 113 /* Altera Nios II soft-core
processor */
+#define EM_CRX 114 /* National Semiconductor
CompactRISC
+ CRX microprocessor */
+#define EM_XGATE 115 /* Motorola XGATE embedded
processor */
+#define EM_C166 116 /* Infineon C16x/XC16x
processor */
+#define EM_M16C 117 /* Renesas M16C series
microprocessors*/
+#define EM_DSPIC30F 118 /* Microchip Technology dsPIC30F
+ Digital Signal Controller */
+#define EM_CE 119 /* Freescale Communication
Engine RISC
+ core */
+#define EM_M32C 120 /* Renesas M32C series
microprocessors*/
+ /* 121-130 Reserved for future use */
+#define EM_TSK3000 131 /* Altium TSK3000 core */
+#define EM_RS08 132 /* Freescale RS08 embedded
processor */
+#define EM_SHARC 133 /* Analog Devices SHARC family
+ of 32-bit DSP processors */
+#define EM_ECOG2 134 /*Cyan Technology eCOG2
microprocessor*/
+#define EM_SCORE7 135 /* Sunplus S+core7 RISC
processor */
+#define EM_DSP24 136 /* New Japan Radio (NJR) 24-bit
DSP
+ Processor */
+#define EM_VIDEOCORE3 137 /* Broadcom VideoCore III
processor */
+#define EM_LATTICEMICO32 138 /* RISC processor for Lattice
FPGA
+ architecture */
+#define EM_SE_C17 139 /* Seiko Epson C17 family */
+#define EM_TI_C6000 140 /* The Texas Instruments
TMS320C6000 DSP
+ family */
+#define EM_TI_C2000 141 /* The Texas Instruments
TMS320C2000 DSP
+ family */
+#define EM_TI_C5500 142 /* The Texas Instruments
TMS320C55x DSP
+ family */
+#define EM_TI_ARP32 143 /* Texas Instruments Application
+ Specific RISC Processor,32bit fetch*/
+#define EM_TI_PRU 144 /* Texas Instruments
Programmable
+ Realtime Unit */
+ /* 145-159 Reserved for future use */
+#define EM_MMDSP_PLUS 160 /* STMicroelectronics 64bit
VLIW Data
+ Signal Processor */
+#define EM_CYPRESS_M8C 161 /* Cypress M8C microprocessor */
+#define EM_R32C 162 /* Renesas R32C series
microprocessors*/
+#define EM_TRIMEDIA 163 /* NXP Semiconductors TriMedia
+ architecture family */
+#define EM_QDSP6 164 /* QUALCOMM DSP6 Processor */
+#define EM_8051 165 /* Intel 8051 and variants */
+#define EM_STXP7X 166 /* STMicroelectronics STxP7x
family
+ of configurable and extensible RISC
+ processors */
+#define EM_NDS32 167 /* Andes Technology compact
code size
+ embedded RISC processor family */
+#define EM_ECOG1 168 /* Cyan Technology eCOG1X
family */
+#define EM_ECOG1X 168 /* Cyan Technology eCOG1X
family */
+#define EM_MAXQ30 169 /* Dallas Semiconductor MAXQ30
Core
+ Micro-controllers */
+#define EM_XIMO16 170 /* New Japan Radio (NJR) 16-bit
DSP
+ Processor */
+#define EM_MANIK 171 /* M2000 Reconfigurable RISC
+ Microprocessor */
+#define EM_CRAYNV2 172 /* Cray Inc. NV2 vector
architecture */
+#define EM_RX 173 /* Renesas RX family */
+#define EM_METAG 174 /* Imagination Technologies META
+ processor architecture */
+#define EM_MCST_ELBRUS 175 /* MCST Elbrus general purpose
hardware
+ architecture */
+#define EM_ECOG16 176 /* Cyan Technology eCOG16
family */
+#define EM_CR16 177 /* National Semiconductor
CompactRISC
+ CR16 16-bit microprocessor */
+#define EM_ETPU 178 /* Freescale Extended Time
Processing
+ Unit */
+#define EM_SLE9X 179 /* Infineon Technologies SLE9X
core */
+#define EM_L10M 180 /* Intel L10M */
+#define EM_K10M 181 /* Intel K10M */
+ /* 182 Reserved for future Intel use */
+#define EM_AARCH64 183 /* ARM 64-bit architecture
(AARCH64) */
+ /* 184 Reserved for future ARM use */
+#define EM_AVR32 185 /* Atmel Corporation 32-bit
+ microprocessor family */
+#define EM_STM8 186 /* STMicroeletronics STM8 8-bit
+ microcontroller */
+#define EM_TILE64 187 /* Tilera TILE64 multicore
architecture
+ family */
+#define EM_TILEPRO 188 /* Tilera TILEPro multicore
+ architecture family */
+#define EM_MICROBLAZE 189 /* Xilinx MicroBlaze 32-bit
RISC soft
+ processor core */
+#define EM_CUDA 190 /* NVIDIA CUDA architecture */
+#define EM_TILEGX 191 /* Tilera TILE-Gx multicore
+ architecture family */
+#define EM_CLOUDSHIELD 192 /* CloudShield architecture
family */
+#define EM_COREA_1ST 193 /* KIPO-KAIST Core-A 1st
generation
+ processor family */
+#define EM_COREA_2ND 194 /* KIPO-KAIST Core-A 2nd
generation
+ processor family */
+#define EM_ARC_COMPACT2 195 /* Synopsys ARCompact V2 */
+#define EM_OPEN8 196 /* Open8 8-bit RISC soft
processor
+ core */
+#define EM_RL78 197 /* Renesas RL78 family */
+#define EM_VIDEOCORE5 198 /* Broadcom VideoCore V
processor */
+#define EM_78KOR 199 /* Renesas 78KOR family */
+#define EM_56800EX 200 /* Freescale 56800EX Digital
Signal
+ Controller (DSC) */
+#define EM_BA1 201 /* Beyond BA1 CPU architecture
*/
+#define EM_BA2 202 /* Beyond BA2 CPU architecture
*/
+#define EM_XCORE 203 /* XMOS xCORE processor family
*/
+#define EM_MCHP_PIC 204 /* Microchip 8-bit PIC(r)
family */
+#define EM_INTEL205 205 /* Reserved by Intel */
+#define EM_INTEL206 206 /* Reserved by Intel */
+#define EM_INTEL207 207 /* Reserved by Intel */
+#define EM_INTEL208 208 /* Reserved by Intel */
+#define EM_INTEL209 209 /* Reserved by Intel */
+#define EM_KM32 210 /* KM211 KM32 32-bit processor
*/
+#define EM_KMX32 211 /* KM211 KMX32 32-bit processor
*/
+#define EM_KMX16 212 /* KM211 KMX16 16-bit processor
*/
+#define EM_KMX8 213 /* KM211 KMX8 8-bit processor */
+#define EM_KVARC 214 /* KM211 KVARC processor */
+#define EM_CDP 215 /* Paneve CDP architecture
family */
+#define EM_COGE 216 /* Cognitive Smart Memory
Processor */
+#define EM_COOL 217 /* Bluechip Systems CoolEngine
*/
+#define EM_NORC 218 /* Nanoradio Optimized RISC */
+#define EM_CSR_KALIMBA 219 /* CSR Kalimba architecture
family */
+#define EM_Z80 220 /* Zilog Z80 */
+#define EM_VISIUM 221 /* Controls and Data Services
+ VISIUMcore processor */
+#define EM_FT32 222 /* FTDI Chip FT32 high
performance
+ 32-bit RISC architecture */
+#define EM_MOXIE 223 /* Moxie processor family */
+#define EM_AMDGPU 224 /* AMD GPU architecture */
+ /* 225 - 242 */
+#define EM_RISCV 243 /* RISC-V */
/* Non-standard */
-#define EM_ALPHA_EXP 0x9026 /* DEC ALPHA */
+/* not in spec! */
+/* #define EM_ALPHA_EXP 0x9026*/ /* DEC ALPHA */
+/* not in spec! */
+/* #define EM_NUM 22*/ /* number of machine types */
-#define EM_NUM 22 /* number of machine types */
-
-/* Version */
+/* e_version -- This member identifies the object file version. */
#define EV_NONE 0 /* Invalid */
#define EV_CURRENT 1 /* Current */
-#define EV_NUM 2 /* number of versions */
+/* not in spec!
+#define EV_NUM 2*/ /* number of versions */
+
+/*
+ * ELF Indentification
+ */
+/*
+ * e_ident[] identification indexes
+ */
+#define EI_MAG0 0 /* file ID */
+#define EI_MAG1 1 /* file ID */
+#define EI_MAG2 2 /* file ID */
+#define EI_MAG3 3 /* file ID */
+#define EI_CLASS 4 /* file class */
+#define EI_DATA 5 /* data encoding */
+#define EI_VERSION 6 /* ELF header version */
+#define EI_OSABI 7 /* OS/ABI ID */
+#define EI_ABIVERSION 8 /* ABI version */
+#define EI_PAD 9 /* start of pad bytes */
+/* there is also EI_NIDENT 16 defined here, but it's moved up
+ to make ELF header code compilable */
+
+/* e_ident[] magic number */
+#define ELFMAG0 0x7f /* e_ident[EI_MAG0] */
+#define ELFMAG1 'E' /* e_ident[EI_MAG1] */
+#define ELFMAG2 'L' /* e_ident[EI_MAG2] */
+#define ELFMAG3 'F' /* e_ident[EI_MAG3] */
+/* not in spec!
+#define ELFMAG "\177ELF"*/ /* magic */
+/* not in spec!
+#define SELFMAG 4*/ /* size of magic */
+
+/* e_ident[] file class */
+#define ELFCLASSNONE 0 /* invalid */
+#define ELFCLASS32 1 /* 32-bit objs */
+#define ELFCLASS64 2 /* 64-bit objs */
+/* not in spec!
+#define ELFCLASSNUM 3*/ /* number of classes */
+
+/* e_ident[] data encoding */
+#define ELFDATANONE 0 /* invalid */
+#define ELFDATA2LSB 1 /* Little-Endian */
+#define ELFDATA2MSB 2 /* Big-Endian */
+/* not in spec!
+#define ELFDATANUM 3*/ /* number of data encode defines */
+
+/* e_ident[] Operating System/ABI */
+#define ELFOSABI_SYSV 0 /* UNIX System V ABI */
+#define ELFOSABI_HPUX 1 /* HP-UX operating system */
+#define ELFOSABI_NETBSD 2 /* NetBSD */
+#define ELFOSABI_GNU 3 /* GNU */
+#define ELFOSABI_LINUX 3 /* Linux historical - alias
+ for ELFOSABI_GNU */
+/* not in spec!
+#define ELFOSABI_HURD 4*/ /* GNU/Hurd */
+/* not in spec!
+#define ELFOSABI_86OPEN 5*/ /* 86Open common IA32 ABI */
+#define ELFOSABI_SOLARIS 6 /* Solaris */
+#define ELFOSABI_AIX 7 /* AIX */
+#define ELFOSABI_IRIX 8 /* IRIX */
+#define ELFOSABI_FREEBSD 9 /* FreeBSD */
+#define ELFOSABI_TRU64 10 /* TRU64 UNIX */
+#define ELFOSABI_MODESTO 11 /* Novell Modesto */
+#define ELFOSABI_OPENBSD 12 /* OpenBSD */
+#define ELFOSABI_OPENVMS 13 /* OpenVMS */
+#define ELFOSABI_NSK 14 /* HP Non-Stop Kernel */
+#define ELFOSABI_AROS 15 /* Amiga Research OS */
+#define ELFOSABI_FENIXOS 16 /* The FenixOS highly scalable
+ multi-core OS */
+#define ELFOSABI_CLOUDABI 17 /* Nuxi CloudABI */
+#define ELFOSABI_OPENVOS 18 /* Stratus Technologies OpenVOS
*/
+ /* 64 - 255 Architecture-specific value range */
+/* not in spec!
+#define ELFOSABI_ARM 97*/ /* ARM */
+/* not in spec!
+#define ELFOSABI_STANDALONE 255*/ /* Standalone (embedded) application */
+
+/* e_version This member identifies the object file version. */
+#define EV_NONE 0 /* Invalid */
+#define EV_CURRENT 1 /* Current */
+/* not in spec!
+#define EV_NUM 2*/ /* number of versions */
+
+/*
+ * Sections
+ * http://www.sco.com/developers/gabi/latest/ch4.sheader.html
+ */
+
+/* Special Section Indexes */
+#define SHN_UNDEF 0 /* undefined */
+#define SHN_LORESERVE 0xff00 /* lower bounds of reserved
indexes */
+#define SHN_LOPROC 0xff00 /* reserved range for processor
lowend*/
+#define SHN_HIPROC 0xff1f /* reserved range for processor
hiend*/
+#define SHN_LOOS 0xff20 /* reserved range for OS lowend
*/
+#define SHN_HIOS 0xff3f /* reserved range for OS hiend
*/
+#define SHN_ABS 0xfff1 /* absolute value */
+#define SHN_COMMON 0xfff2 /* common symbol */
+#define SHN_XINDEX 0xffff /* represents escape value to
mark too
+ big index value */
+#define SHN_HIRESERVE 0xffff /* upper bounds of reserved
indexes */
+
/* Section Header */
typedef struct {
@@ -222,27 +517,18 @@ typedef struct {
} Elf32_Shdr;
typedef struct {
- Elf64_Half sh_name; /* section name */
- Elf64_Half sh_type; /* section type */
+ Elf64_Word sh_name; /* section name */
+ Elf64_Word sh_type; /* section type */
Elf64_Xword sh_flags; /* section flags */
Elf64_Addr sh_addr; /* virtual address */
Elf64_Off sh_offset; /* file offset */
Elf64_Xword sh_size; /* section size */
- Elf64_Half sh_link; /* link to another */
- Elf64_Half sh_info; /* misc info */
+ Elf64_Word sh_link; /* link to another */
+ Elf64_Word sh_info; /* misc info */
Elf64_Xword sh_addralign; /* memory alignment */
Elf64_Xword sh_entsize; /* table entry size */
} Elf64_Shdr;
-/* Special Section Indexes */
-#define SHN_UNDEF 0 /* undefined */
-#define SHN_LORESERVE 0xff00 /* lower bounds of reserved indexes */
-#define SHN_LOPROC 0xff00 /* reserved range for processor */
-#define SHN_HIPROC 0xff1f /* specific section indexes */
-#define SHN_ABS 0xfff1 /* absolute value */
-#define SHN_COMMON 0xfff2 /* common symbol */
-#define SHN_HIRESERVE 0xffff /* upper bounds of reserved indexes */
-
/* sh_type */
#define SHT_NULL 0 /* inactive */
#define SHT_PROGBITS 1 /* program defined information */
@@ -256,24 +542,87 @@ typedef struct {
#define SHT_REL 9 /* relation section without
addends */
#define SHT_SHLIB 10 /* reserved - purpose unknown */
#define SHT_DYNSYM 11 /* dynamic symbol table section */
-#define SHT_NUM 12 /* number of section types */
-#define SHT_LOPROC 0x70000000 /* reserved range for processor */
-#define SHT_HIPROC 0x7fffffff /* specific section header types */
+#define SHT_INIT_ARRAY 14 /* pointers to init functions */
+#define SHT_FINI_ARRAY 15 /* pointers to termination
functions */
+#define SHT_PREINIT_ARRAY 16 /* pointers to pre-init
functions */
+#define SHT_GROUP 17 /* section group */
+#define SHT_SYMTAB_SHNDX 18 /* symbol table section */
+#define SHT_LOOS 0x60000000 /* OS specific semantics
low-end */
+#define SHT_HIOS 0x6fffffff /* OS specific semantics hi-end
*/
+/* not in spec!
+#define SHT_NUM 12*/ /* number of section types */
+#define SHT_LOPROC 0x70000000 /* CPU specific semantics
low-end */
+#define SHT_HIPROC 0x7fffffff /* CPU specific semantics
hi-end */
#define SHT_LOUSER 0x80000000 /* reserved range for application */
#define SHT_HIUSER 0xffffffff /* specific indexes */
+/* sh_flags - Section Attribute Flags */
+#define SHF_WRITE 0x1 /* Writable */
+#define SHF_ALLOC 0x2 /* occupies memory */
+#define SHF_EXECINSTR 0x4 /* executable */
+#define SHF_MERGE 0x10 /* merge to eliminate
duplication */
+#define SHF_STRINGS 0x20 /* null-terminated strings */
+#define SHF_INFO_LINK 0x40 /* sh_info holds section header
index */
+#define SHF_LINK_ORDER 0x80 /* ordering requirements */
+#define SHF_OS_NONFONFORMING 0x100 /* OS specific processing
necessary */
+#define SHF_GROUP 0x200 /* member of a section group */
+#define SHF_TLS 0x400 /* thread local storage */
+#define SHF_COMPRESSED 0x800 /* marks section with
compressed data */
+#define SHF_MARKOS 0x0ff00000 /* reserved bits for OS */
+#define SHF_MASKPROC 0xf0000000 /* reserved bits for processor
*/
+
+/*
+ * Compression Header
+ */
+
+typedef struct {
+ Elf32_Word ch_type; /* compression algorithm */
+ Elf32_Word ch_size; /* size of uncompressed data */
+ Elf32_Word ch_addralign; /* required alignment for uncompressed
+ data */
+} Elf32_Chdr;
+
+typedef struct {
+ Elf64_Word ch_type; /* compression algorithm */
+ Elf64_Word ch_reserved;
+ Elf64_Xword ch_size; /* size of uncompressed data */
+ Elf64_Xword ch_addralign; /* required alignment for uncompressed
+ data */
+} Elf64_Chdr;
+
+/* ch_type ELF Compression Types */
+#define ELFCOMPRESS_ZLIB 1 /* ZLIB algorithm */
+#define ELFCOMPRESS_LOOS 0x60000000 /* OS spec. semantics
low-end */
+#define ELFCOMPRESS_HIOS 0x6fffffff /* OS spec. semantics
hi-end */
+#define ELFCOMPRESS_LOPROC 0x70000000 /* CPU spec. semantics
low-end*/
+#define ELFCOMPRESS_HIPROC 0x7fffffff /* CPU spec. semantics
hi-end*/
+
+
+/* Section Group Flags */
+#define GRP_COMDAT 0x1 /* COMDAT group */
+#define GRP_MASKOS 0x0ff00000 /* OS specific semantics */
+#define GRP_MASKPROC 0xf0000000 /* Processor specific semantics
*/
+
+/* Special Sections -- following sections definitions ELF_* are not
+ part of the spec. Specification however defines all the sections name
+ E.g. .bss, .comment, .data etc. so I leave those defines here too. */
/* Section names */
#define ELF_BSS ".bss" /* uninitialized data */
+#define ELF_COMMENT ".comment" /* version control information
*/
#define ELF_DATA ".data" /* initialized data */
-#define ELF_CTF ".SUNW_ctf" /* CTF data */
+#define ELF_DATA1 ".data1" /* initialized data */
+/* not in spec!
+#define ELF_CTF ".SUNW_ctf"*/ /* CTF data */
#define ELF_DEBUG ".debug" /* debug */
#define ELF_DYNAMIC ".dynamic" /* dynamic linking information */
#define ELF_DYNSTR ".dynstr" /* dynamic string table */
#define ELF_DYNSYM ".dynsym" /* dynamic symbol table */
#define ELF_FINI ".fini" /* termination code */
+#define ELF_FINI_ARR ".fini_array" /* termination functions array
*/
#define ELF_GOT ".got" /* global offset table */
#define ELF_HASH ".hash" /* symbol hash table */
#define ELF_INIT ".init" /* initialization code */
+#define ELF_INIT_ARR ".init_array" /* initialization functions
array */
#define ELF_REL_DATA ".rel.data" /* relocation data */
#define ELF_REL_FINI ".rel.fini" /* relocation termination code */
#define ELF_REL_INIT ".rel.init" /* relocation initialization code */
@@ -281,22 +630,28 @@ typedef struct {
#define ELF_REL_RODATA ".rel.rodata" /* relocation read-only data */
#define ELF_REL_TEXT ".rel.text" /* relocation code */
#define ELF_RODATA ".rodata" /* read-only data */
+#define ELF_RODATA1 ".rodata1" /* read-only data */
#define ELF_SHSTRTAB ".shstrtab" /* section header string table */
#define ELF_STRTAB ".strtab" /* string table */
#define ELF_SYMTAB ".symtab" /* symbol table */
-#define ELF_TEXT ".text" /* code */
+#define ELF_SYMTAB_SHNDX ".symtab_shndx" /* symbol table section
index
+ array */
+#define ELF_TBSS ".tbss" /* TLS uninitialized data */
+#define ELF_TDATA ".tdata" /* TLS initialized data */
+#define ELF_TDATA1 ".tdata1" /* TLS initialized data */
+#define ELF_TEXT ".text" /* code */
-/* Section Attribute Flags - sh_flags */
-#define SHF_WRITE 0x1 /* Writable */
-#define SHF_ALLOC 0x2 /* occupies memory */
-#define SHF_EXECINSTR 0x4 /* executable */
-#define SHF_TLS 0x400 /* thread local storage */
-#define SHF_MASKPROC 0xf0000000 /* reserved bits for processor */
- /* specific section attributes */
+/*
+ * Symbol Table
+ * http://www.sco.com/developers/gabi/latest/ch4.symtab.html
+ */
+
+/* Symbol table index */
+#define STN_UNDEF 0 /* undefined */
/* Symbol Table Entry */
-typedef struct elf32_sym {
+typedef struct {
Elf32_Word st_name; /* name - index into string table */
Elf32_Addr st_value; /* symbol value */
Elf32_Word st_size; /* symbol size */
@@ -306,17 +661,14 @@ typedef struct elf32_sym {
} Elf32_Sym;
typedef struct {
- Elf64_Half st_name; /* Symbol name index in str table */
- Elf_Byte st_info; /* type / binding attrs */
- Elf_Byte st_other; /* unused */
- Elf64_Quarter st_shndx; /* section index of symbol */
- Elf64_Xword st_value; /* value of symbol */
+ Elf64_Word st_name; /* Symbol name index in str table */
+ unsigned char st_info; /* type / binding attrs */
+ unsigned char st_other; /* unused */
+ Elf64_Half st_shndx; /* section index of symbol */
+ Elf64_Addr st_value; /* value of symbol */
Elf64_Xword st_size; /* size of symbol */
} Elf64_Sym;
-/* Symbol table index */
-#define STN_UNDEF 0 /* undefined */
-
/* Extract symbol info - st_info */
#define ELF32_ST_BIND(x) ((x) >> 4)
#define ELF32_ST_TYPE(x) (((unsigned int) x) & 0xf)
@@ -326,11 +678,18 @@ typedef struct {
#define ELF64_ST_TYPE(x) (((unsigned int) x) & 0xf)
#define ELF64_ST_INFO(b,t) (((b) << 4) + ((t) & 0xf))
+/* Extract symbol other attribute - st_other -- used for symbol visibility */
+#define ELF32_ST_VISIBILITY(o) ((o)&0x3)
+#define ELF64_ST_VISIBILITY(o) ((o)&0x3)
+
/* Symbol Binding - ELF32_ST_BIND - st_info */
#define STB_LOCAL 0 /* Local symbol */
#define STB_GLOBAL 1 /* Global symbol */
#define STB_WEAK 2 /* like global - lower precedence */
-#define STB_NUM 3 /* number of symbol bindings */
+#define STB_LOOS 10 /* OS specific semantics
low-end */
+#define STB_HIOS 12 /* OS specific semantics hi-end
*/
+/* not in spec!
+#define STB_NUM 3*/ /* number of symbol bindings */
#define STB_LOPROC 13 /* reserved range for processor */
#define STB_HIPROC 15 /* specific symbol bindings */
@@ -340,10 +699,27 @@ typedef struct {
#define STT_FUNC 2 /* function */
#define STT_SECTION 3 /* section */
#define STT_FILE 4 /* file */
+#define STT_COMMON 5 /* uninitialized common block */
#define STT_TLS 6 /* thread local storage */
+#define STT_LOOS 10 /* reserved range for OS */
+#define STT_HIOS 12 /* specific symbol types */
#define STT_LOPROC 13 /* reserved range for processor */
#define STT_HIPROC 15 /* specific symbol types */
+/* Symbol Visibility */
+#define STV_DEFAULT 0 /* default visibility for given
symbol's
+ binding type: global & weak are
+ visible. Locals are hidden */
+#define STV_INTERNAL 1 /* Visibility of this type is
defined
+ by processor supplement(s) */
+#define STV_HIDDEN 2 /* not visible symbol */
+#define STV_PROTECTED 3 /* visible but not preemptable
symbol */
+
+/*
+ * Relocation
+ * http://www.sco.com/developers/gabi/latest/ch4.reloc.html
+ */
+
/* Relocation entry with implicit addend */
typedef struct {
Elf32_Addr r_offset; /* offset of relocation */
@@ -357,26 +733,28 @@ typedef struct {
Elf32_Sword r_addend;
} Elf32_Rela;
-/* Extract relocation info - r_info */
-#define ELF32_R_SYM(i) ((i) >> 8)
-#define ELF32_R_TYPE(i) ((unsigned char) (i))
-#define ELF32_R_INFO(s,t) (((s) << 8) + (unsigned char)(t))
-
typedef struct {
- Elf64_Xword r_offset; /* where to do it */
+ Elf64_Addr r_offset; /* where to do it */
Elf64_Xword r_info; /* index & type of relocation */
} Elf64_Rel;
typedef struct {
- Elf64_Xword r_offset; /* where to do it */
+ Elf64_Addr r_offset; /* where to do it */
Elf64_Xword r_info; /* index & type of relocation */
Elf64_Sxword r_addend; /* adjustment value */
} Elf64_Rela;
+/* Extract relocation info - r_info */
+#define ELF32_R_SYM(i) ((i) >> 8)
+#define ELF32_R_TYPE(i) ((unsigned char) (i))
+#define ELF32_R_INFO(s,t) (((s) << 8) + (unsigned char)(t))
+
#define ELF64_R_SYM(info) ((info) >> 32)
#define ELF64_R_TYPE(info) ((info) & 0xFFFFFFFF)
-#define ELF64_R_INFO(s,t) (((s) << 32) + (__uint32_t)(t))
+#define ELF64_R_INFO(s,t) (((s) << 32) + (__uint32_t)((t)&0xFFFFFFFF))
+/* spec allows processor specific relocation types to be added. As this is
+ allowed, let's keep those here inside the spec. stuff */
#if defined(__mips64__) && defined(__MIPSEL__)
/*
* The 64-bit MIPS ELF ABI uses a slightly different relocation format
@@ -391,6 +769,10 @@ typedef struct {
#define ELF64_R_INFO(s,t) (((__uint64_t)swap32(t) << 32) +
(__uint32_t)(s))
#endif /* __mips64__ && __MIPSEL__ */
+/*
+ * Program Header
+ * http://www.sco.com/developers/gabi/latest/ch5.pheader.html
+ */
/* Program Header */
typedef struct {
Elf32_Word p_type; /* segment type */
@@ -404,8 +786,8 @@ typedef struct {
} Elf32_Phdr;
typedef struct {
- Elf64_Half p_type; /* entry type */
- Elf64_Half p_flags; /* flags */
+ Elf64_Word p_type; /* entry type */
+ Elf64_Word p_flags; /* flags */
Elf64_Off p_offset; /* offset */
Elf64_Addr p_vaddr; /* virtual address */
Elf64_Addr p_paddr; /* physical address */
@@ -428,19 +810,17 @@ typedef struct {
#define PT_LOPROC 0x70000000 /* reserved range for processor */
#define PT_HIPROC 0x7fffffff /* specific segment types */
-#define PT_GNU_EH_FRAME 0x6474e550 /* Exception handling
info */
-#define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */
-
-#define PT_OPENBSD_RANDOMIZE 0x65a3dbe6 /* fill with random data */
-#define PT_OPENBSD_WXNEEDED 0x65a3dbe7 /* program performs W^X
violations */
-#define PT_OPENBSD_BOOTDATA 0x65a41be6 /* section for boot arguments */
-
/* Segment flags - p_flags */
#define PF_X 0x1 /* Executable */
#define PF_W 0x2 /* Writable */
#define PF_R 0x4 /* Readable */
+#define PF_MASKOS 0x0ff00000 /* OS specific semantics */
#define PF_MASKPROC 0xf0000000 /* reserved bits for processor */
/* specific segment flags */
+/*
+ * Dynamic Linking
+ * http://www.sco.com/developers/gabi/latest/ch5.dynamic.html
+ */
/* Dynamic structure */
typedef struct {
@@ -451,14 +831,25 @@ typedef struct {
} d_un;
} Elf32_Dyn;
+/* spec also defines here:
+ extern Elf32_Dyn _DYNAMIC[];
+ symbol, but this is defined below using Elf_Dyn to avoid name clash
+ with 64bit _DYNAMIC[] */
+
typedef struct {
- Elf64_Xword d_tag; /* controls meaning of d_val */
+ Elf64_Sxword d_tag; /* controls meaning of d_val */
union {
- Elf64_Addr d_ptr;
Elf64_Xword d_val;
+ Elf64_Addr d_ptr;
} d_un;
} Elf64_Dyn;
+/* spec also defines here:
+ extern Elf64_Dyn _DYNAMIC[];
+ symbol, but this is defined below using Elf_Dyn to avoid name clash
+ with 32bit _DYNAMIC[] */
+
+
/* Dynamic Array Tags - d_tag */
#define DT_NULL 0 /* marks end of _DYNAMIC array
*/
#define DT_NEEDED 1 /* string table offset of needed lib */
@@ -495,16 +886,12 @@ typedef struct {
#define DT_ENCODING 31 /* further DT_* follow encoding rules */
#define DT_PREINIT_ARRAY 32 /* address of array of preinit func */
#define DT_PREINIT_ARRAYSZ 33 /* size of array of preinit func */
+#define DT_SYMTAB_SHNDX 34 /* address of symtab section */
#define DT_LOOS 0x6000000d /* reserved range for OS */
#define DT_HIOS 0x6ffff000 /* specific dynamic array tags
*/
#define DT_LOPROC 0x70000000 /* reserved range for processor */
#define DT_HIPROC 0x7fffffff /* specific dynamic array tags */
-/* some other useful tags */
-#define DT_RELACOUNT 0x6ffffff9 /* if present, number of RELATIVE */
-#define DT_RELCOUNT 0x6ffffffa /* relocs, which must come first */
-#define DT_FLAGS_1 0x6ffffffb
-
/* Dynamic Flags - DT_FLAGS .dynamic entry */
#define DF_ORIGIN 0x00000001
#define DF_SYMBOLIC 0x00000002
@@ -512,22 +899,6 @@ typedef struct {
#define DF_BIND_NOW 0x00000008
#define DF_STATIC_TLS 0x00000010
-/* Dynamic Flags - DT_FLAGS_1 .dynamic entry */
-#define DF_1_NOW 0x00000001
-#define DF_1_GLOBAL 0x00000002
-#define DF_1_GROUP 0x00000004
-#define DF_1_NODELETE 0x00000008
-#define DF_1_LOADFLTR 0x00000010
-#define DF_1_INITFIRST 0x00000020
-#define DF_1_NOOPEN 0x00000040
-#define DF_1_ORIGIN 0x00000080
-#define DF_1_DIRECT 0x00000100
-#define DF_1_TRANS 0x00000200
-#define DF_1_INTERPOSE 0x00000400
-#define DF_1_NODEFLIB 0x00000800
-#define DF_1_NODUMP 0x00001000
-#define DF_1_CONLFAT 0x00002000
-
/*
* Note header
*/
@@ -538,9 +909,9 @@ typedef struct {
} Elf32_Nhdr;
typedef struct {
- Elf64_Half n_namesz;
- Elf64_Half n_descsz;
- Elf64_Half n_type;
+ Elf64_Word n_namesz;
+ Elf64_Word n_descsz;
+ Elf64_Word n_type;
} Elf64_Nhdr;
/*
@@ -553,72 +924,62 @@ typedef struct {
} Elf32_Note;
typedef struct {
- Elf64_Half namesz;
- Elf64_Half descsz;
- Elf64_Half type;
+ Elf64_Word namesz;
+ Elf64_Word descsz;
+ Elf64_Word type;
} Elf64_Note;
/*
- * OpenBSD-specific core file information.
- *
- * OpenBSD ELF core files use notes to provide information about
- * the process's state. The note name is "OpenBSD" for information
- * that is global to the process, and "OpenBSD@nn", where "nn" is the
- * thread ID of the thread that the information belongs to (such as
- * register state).
- *
- * We use the following note identifiers:
- *
- * NT_OPENBSD_PROCINFO
- * Note is a "elfcore_procinfo" structure.
- * NT_OPENBSD_AUXV
- * Note is a a bunch of Auxilliary Vectors, terminated by
- * an AT_NULL entry.
- * NT_OPENBSD_REGS
- * Note is a "reg" structure.
- * NT_OPENBSD_FPREGS
- * Note is a "fpreg" structure.
- *
- * Please try to keep the members of the "elfcore_procinfo" structure
- * nicely aligned, and if you add elements, add them to the end and
- * bump the version.
+ * here comes the end of the specification. The definitions below are either
+ * generally usable (or historic) or OS specific
*/
-#define NT_OPENBSD_PROCINFO 10
-#define NT_OPENBSD_AUXV 11
+/* e_ident */
+#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \
+ (ehdr).e_ident[EI_MAG1] == ELFMAG1 && \
+ (ehdr).e_ident[EI_MAG2] == ELFMAG2 && \
+ (ehdr).e_ident[EI_MAG3] == ELFMAG3)
-#define NT_OPENBSD_REGS 20
-#define NT_OPENBSD_FPREGS 21
-#define NT_OPENBSD_XFPREGS 22
-#define NT_OPENBSD_WCOOKIE 23
+#define EM_AMD64 EM_X86_64 /* AMD x86-64 architecture */
+#define EM_ALPHA_EXP 0x9026 /* DEC ALPHA */
-struct elfcore_procinfo {
- /* Version 1 fields start here. */
- uint32_t cpi_version; /* netbsd_elfcore_procinfo version */
-#define ELFCORE_PROCINFO_VERSION 1
- uint32_t cpi_cpisize; /* sizeof(netbsd_elfcore_procinfo) */
- uint32_t cpi_signo; /* killing signal */
- uint32_t cpi_sigcode; /* signal code */
- uint32_t cpi_sigpend; /* pending signals */
- uint32_t cpi_sigmask; /* blocked signals */
- uint32_t cpi_sigignore; /* ignored signals */
- uint32_t cpi_sigcatch; /* signals being caught by user */
- int32_t cpi_pid; /* process ID */
- int32_t cpi_ppid; /* parent process ID */
- int32_t cpi_pgrp; /* process group ID */
- int32_t cpi_sid; /* session ID */
- uint32_t cpi_ruid; /* real user ID */
- uint32_t cpi_euid; /* effective user ID */
- uint32_t cpi_svuid; /* saved user ID */
- uint32_t cpi_rgid; /* real group ID */
- uint32_t cpi_egid; /* effective group ID */
- uint32_t cpi_svgid; /* saved group ID */
- int8_t cpi_name[32]; /* copy of pr->ps_comm */
-};
+#define ELFMAG "\177ELF" /* magic */
+#define SELFMAG 4 /* size of magic */
+/* this section type definition is used by vmd */
+#define ELF_CTF ".SUNW_ctf" /* CTF data */
+#define ELFDATANUM 3 /* number of data encode
defines */
+/* specific core file defines, used by devel/valgrind */
+#define NT_PRSTATUS 1
+#define NT_PRPSINFO 3
+
+/* some other useful tags */
+#define DT_RELACOUNT 0x6ffffff9 /* if present, number of
RELATIVE */
+#define DT_RELCOUNT 0x6ffffffa /* relocs, which must come
first */
+#define DT_FLAGS_1 0x6ffffffb
+
+/* Dynamic Flags - DT_FLAGS_1 .dynamic entry */
+#define DF_1_NOW 0x00000001
+#define DF_1_GLOBAL 0x00000002
+#define DF_1_GROUP 0x00000004
+#define DF_1_NODELETE 0x00000008
+#define DF_1_LOADFLTR 0x00000010
+#define DF_1_INITFIRST 0x00000020
+#define DF_1_NOOPEN 0x00000040
+#define DF_1_ORIGIN 0x00000080
+#define DF_1_DIRECT 0x00000100
+#define DF_1_TRANS 0x00000200
+#define DF_1_INTERPOSE 0x00000400
+#define DF_1_NODEFLIB 0x00000800
+#define DF_1_NODUMP 0x00001000
+#define DF_1_CONLFAT 0x00002000
+
+#define PT_GNU_EH_FRAME 0x6474e550 /* Exception handling
info */
+#define PT_GNU_RELRO 0x6474e552 /* Read-only after
relocation */
+
+#define PT_OPENBSD_RANDOMIZE 0x65a3dbe6 /* fill with random
data */
+#define PT_OPENBSD_WXNEEDED 0x65a3dbe7 /* program performs W^X
violations */
+#define PT_OPENBSD_BOOTDATA 0x65a41be6 /* section for boot
arguments */
-/*
- * XXX - these _KERNEL items aren't part of the ABI!
- */
#if defined(_KERNEL) || defined(_DYN_LOADER)
#define ELF32_NO_ADDR ((uint32_t) ~0) /* Indicates addr. not yet filled in */
@@ -631,7 +992,7 @@ typedef struct {
#define ELF64_NO_ADDR ((__uint64_t) ~0)/* Indicates addr. not yet filled in */
typedef struct {
- Elf64_Shalf au_id; /* 32-bit id */
+ Elf64_Sword au_id; /* 32-bit id */
Elf64_Xword au_v; /* 64-bit value */
} Aux64Info;
@@ -660,7 +1021,7 @@ struct elf_args {
u_long arg_phnum; /* Number of program headers */
};
-#endif
+#endif /* _KERNEL || _DYN_LOADER */
#if !defined(ELFSIZE) && defined(ARCH_ELFSIZE)
#define ELFSIZE ARCH_ELFSIZE
@@ -726,13 +1087,73 @@ struct elf_args {
#define ELF_NO_ADDR ELF64_NO_ADDR
#define AuxInfo Aux64Info
-#endif
+#else
+#error "wrong ELF size"
+#endif /* ELFSIZE */
#ifndef _KERNEL
extern Elf_Dyn _DYNAMIC[];
#endif
#ifdef _KERNEL
+/*
+ * OpenBSD-specific core file information.
+ *
+ * OpenBSD ELF core files use notes to provide information about
+ * the process's state. The note name is "OpenBSD" for information
+ * that is global to the process, and "OpenBSD@nn", where "nn" is the
+ * thread ID of the thread that the information belongs to (such as
+ * register state).
+ *
+ * We use the following note identifiers:
+ *
+ * NT_OPENBSD_PROCINFO
+ * Note is a "elfcore_procinfo" structure.
+ * NT_OPENBSD_AUXV
+ * Note is a a bunch of Auxilliary Vectors, terminated by
+ * an AT_NULL entry.
+ * NT_OPENBSD_REGS
+ * Note is a "reg" structure.
+ * NT_OPENBSD_FPREGS
+ * Note is a "fpreg" structure.
+ *
+ * Please try to keep the members of the "elfcore_procinfo" structure
+ * nicely aligned, and if you add elements, add them to the end and
+ * bump the version.
+ */
+
+#define NT_OPENBSD_PROCINFO 10
+#define NT_OPENBSD_AUXV 11
+
+#define NT_OPENBSD_REGS 20
+#define NT_OPENBSD_FPREGS 21
+#define NT_OPENBSD_XFPREGS 22
+#define NT_OPENBSD_WCOOKIE 23
+
+struct elfcore_procinfo {
+ /* Version 1 fields start here. */
+ uint32_t cpi_version; /* netbsd_elfcore_procinfo version */
+#define ELFCORE_PROCINFO_VERSION 1
+ uint32_t cpi_cpisize; /* sizeof(netbsd_elfcore_procinfo) */
+ uint32_t cpi_signo; /* killing signal */
+ uint32_t cpi_sigcode; /* signal code */
+ uint32_t cpi_sigpend; /* pending signals */
+ uint32_t cpi_sigmask; /* blocked signals */
+ uint32_t cpi_sigignore; /* ignored signals */
+ uint32_t cpi_sigcatch; /* signals being caught by user */
+ int32_t cpi_pid; /* process ID */
+ int32_t cpi_ppid; /* parent process ID */
+ int32_t cpi_pgrp; /* process group ID */
+ int32_t cpi_sid; /* session ID */
+ uint32_t cpi_ruid; /* real user ID */
+ uint32_t cpi_euid; /* effective user ID */
+ uint32_t cpi_svuid; /* saved user ID */
+ uint32_t cpi_rgid; /* real group ID */
+ uint32_t cpi_egid; /* effective group ID */
+ uint32_t cpi_svgid; /* saved group ID */
+ int8_t cpi_name[32]; /* copy of pr->ps_comm */
+};
+
struct exec_package;
int exec_elf_makecmds(struct proc *, struct exec_package *);
Index: usr.bin/nm/elf.c
===================================================================
RCS file: /cvs/src/usr.bin/nm/elf.c,v
retrieving revision 1.34
diff -u -p -u -r1.34 elf.c
--- usr.bin/nm/elf.c 9 Dec 2015 19:28:34 -0000 1.34
+++ usr.bin/nm/elf.c 15 Sep 2017 21:07:38 -0000
@@ -29,7 +29,7 @@
#include <sys/mman.h>
#include <unistd.h>
#include <a.out.h>
-#include <elf_abi.h>
+#include <elf.h>
#include <errno.h>
#include <err.h>
#include <stdint.h>
Index: usr.bin/nm/nm.c
===================================================================
RCS file: /cvs/src/usr.bin/nm/nm.c,v
retrieving revision 1.52
diff -u -p -u -r1.52 nm.c
--- usr.bin/nm/nm.c 12 Sep 2017 08:32:44 -0000 1.52
+++ usr.bin/nm/nm.c 15 Sep 2017 21:07:42 -0000
@@ -36,7 +36,7 @@
#include <sys/types.h>
#include <sys/mman.h>
#include <a.out.h>
-#include <elf_abi.h>
+#include <elf.h>
#include <ar.h>
#include <ranlib.h>
#include <unistd.h>
Index: usr.bin/rdist/isexec.c
===================================================================
RCS file: /cvs/src/usr.bin/rdist/isexec.c,v
retrieving revision 1.10
diff -u -p -u -r1.10 isexec.c
--- usr.bin/rdist/isexec.c 20 Jan 2015 09:00:16 -0000 1.10
+++ usr.bin/rdist/isexec.c 15 Sep 2017 21:07:47 -0000
@@ -30,7 +30,7 @@
*/
#include <sys/types.h>
-#include <elf_abi.h>
+#include <elf.h>
#include <fcntl.h>
#include <unistd.h>
Index: usr.sbin/installboot/i386_installboot.c
===================================================================
RCS file: /cvs/src/usr.sbin/installboot/i386_installboot.c,v
retrieving revision 1.30
diff -u -p -u -r1.30 i386_installboot.c
--- usr.sbin/installboot/i386_installboot.c 4 Jun 2017 13:57:29 -0000
1.30
+++ usr.sbin/installboot/i386_installboot.c 15 Sep 2017 21:08:18 -0000
@@ -54,7 +54,7 @@
#include <machine/cpu.h>
#include <machine/biosvar.h>
-#include <elf_abi.h>
+#include <elf.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
Index: usr.sbin/installboot/i386_nlist.c
===================================================================
RCS file: /cvs/src/usr.sbin/installboot/i386_nlist.c,v
retrieving revision 1.5
diff -u -p -u -r1.5 i386_nlist.c
--- usr.sbin/installboot/i386_nlist.c 19 Oct 2015 19:22:32 -0000 1.5
+++ usr.sbin/installboot/i386_nlist.c 15 Sep 2017 21:08:18 -0000
@@ -34,7 +34,7 @@
#include <sys/mman.h>
#include <sys/stat.h>
-#include <elf_abi.h>
+#include <elf.h>
#include <errno.h>
#include <fcntl.h>
#include <nlist.h>
Index: usr.sbin/kvm_mkdb/nlist.c
===================================================================
RCS file: /cvs/src/usr.sbin/kvm_mkdb/nlist.c,v
retrieving revision 1.50
diff -u -p -u -r1.50 nlist.c
--- usr.sbin/kvm_mkdb/nlist.c 10 Sep 2016 05:48:18 -0000 1.50
+++ usr.sbin/kvm_mkdb/nlist.c 15 Sep 2017 21:08:24 -0000
@@ -50,7 +50,7 @@
#include <sys/file.h>
#include <sys/sysctl.h>
-#include <elf_abi.h>
+#include <elf.h>
typedef struct nlist NLIST;
#define _strx n_un.n_strx