diff options
author | jdp <jdp@FreeBSD.org> | 1998-09-14 20:30:13 +0000 |
---|---|---|
committer | jdp <jdp@FreeBSD.org> | 1998-09-14 20:30:13 +0000 |
commit | c3165880f698a7f3ecd2147fe2657f3e102f90b3 (patch) | |
tree | cded75c750eb75d27b609a0e400bb767a5a4aefb | |
parent | 1f8a10e6301fb1c73f9702beccf31f5b48ec4556 (diff) | |
download | FreeBSD-src-c3165880f698a7f3ecd2147fe2657f3e102f90b3.zip FreeBSD-src-c3165880f698a7f3ecd2147fe2657f3e102f90b3.tar.gz |
Add generic defines ELF_ARCH, ELF_CLASS, and ELF_DATA. These give
the relevant characteristics of the native machine, for building
and checking Elf_Ehdr structures.
Add structures to represent ELF "note" headers. Add defines for the
note types used in ELF core files.
-rw-r--r-- | sys/alpha/include/elf.h | 4 | ||||
-rw-r--r-- | sys/amd64/include/elf.h | 4 | ||||
-rw-r--r-- | sys/i386/include/elf.h | 4 | ||||
-rw-r--r-- | sys/sys/elf32.h | 17 | ||||
-rw-r--r-- | sys/sys/elf64.h | 17 | ||||
-rw-r--r-- | sys/sys/elf_common.h | 7 | ||||
-rw-r--r-- | sys/sys/elf_generic.h | 13 |
7 files changed, 59 insertions, 7 deletions
diff --git a/sys/alpha/include/elf.h b/sys/alpha/include/elf.h index 216bead..3972adb 100644 --- a/sys/alpha/include/elf.h +++ b/sys/alpha/include/elf.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: elf.h,v 1.3 1998/06/28 00:50:35 dfr Exp $ + * $Id: elf.h,v 1.4 1998/08/17 08:05:55 dfr Exp $ */ #ifndef _MACHINE_ELF_H_ @@ -38,6 +38,8 @@ #define __ELF_WORD_SIZE 64 /* Used by <sys/elf_generic.h> */ #include <sys/elf_generic.h> +#define ELF_ARCH EM_ALPHA + #define ELF_MACHINE_OK(x) ((x) == EM_ALPHA) /* diff --git a/sys/amd64/include/elf.h b/sys/amd64/include/elf.h index 2c13a1f..5605b6f 100644 --- a/sys/amd64/include/elf.h +++ b/sys/amd64/include/elf.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: elf.h,v 1.2 1997/08/30 18:59:48 peter Exp $ + * $Id: elf.h,v 1.3 1998/08/16 03:03:31 jdp Exp $ */ #ifndef _MACHINE_ELF_H_ @@ -38,6 +38,8 @@ #define __ELF_WORD_SIZE 32 /* Used by <sys/elf_generic.h> */ #include <sys/elf_generic.h> +#define ELF_ARCH EM_386 + /* * Auxiliary vector entries for passing information to the interpreter. * diff --git a/sys/i386/include/elf.h b/sys/i386/include/elf.h index 2c13a1f..5605b6f 100644 --- a/sys/i386/include/elf.h +++ b/sys/i386/include/elf.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: elf.h,v 1.2 1997/08/30 18:59:48 peter Exp $ + * $Id: elf.h,v 1.3 1998/08/16 03:03:31 jdp Exp $ */ #ifndef _MACHINE_ELF_H_ @@ -38,6 +38,8 @@ #define __ELF_WORD_SIZE 32 /* Used by <sys/elf_generic.h> */ #include <sys/elf_generic.h> +#define ELF_ARCH EM_386 + /* * Auxiliary vector entries for passing information to the interpreter. * diff --git a/sys/sys/elf32.h b/sys/sys/elf32.h index a37fb95..092a4c4 100644 --- a/sys/sys/elf32.h +++ b/sys/sys/elf32.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: elf32.h,v 1.3 1998/07/07 23:32:55 jdp Exp $ + * $Id: elf32.h,v 1.4 1998/08/16 03:03:38 jdp Exp $ */ #ifndef _SYS_ELF32_H_ @@ -109,6 +109,21 @@ typedef struct { } Elf32_Dyn; /* + * Note header. The ".note" section contains an array of notes. Each + * begins with this header, aligned to a word boundary. Immediately + * following the note header is n_namesz bytes of name, padded to the + * next word boundary. Then comes n_descsz bytes of contents, again + * padded to a word boundary. The values of n_namesz and n_descsz do + * not include the padding. + */ + +typedef struct { + Elf32_Size n_namesz; /* Length of name. */ + Elf32_Size n_descsz; /* Length of descriptor. */ + Elf32_Word n_type; /* Type of this note. */ +} Elf32_Note; + +/* * Relocation entries. */ diff --git a/sys/sys/elf64.h b/sys/sys/elf64.h index 888488b..35f2275 100644 --- a/sys/sys/elf64.h +++ b/sys/sys/elf64.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: elf64.h,v 1.5 1998/09/05 23:07:59 jb Exp $ + * $Id: elf64.h,v 1.6 1998/09/12 08:36:09 dfr Exp $ */ #ifndef _SYS_ELF64_H_ @@ -110,6 +110,21 @@ typedef struct { } Elf64_Dyn; /* + * Note header. The ".note" section contains an array of notes. Each + * begins with this header, aligned to a word boundary. Immediately + * following the note header is n_namesz bytes of name, padded to the + * next word boundary. Then comes n_descsz bytes of descriptor, again + * padded to a word boundary. The values of n_namesz and n_descsz do + * not include the padding. + */ + +typedef struct { + Elf64_Size n_namesz; /* Length of name. */ + Elf64_Size n_descsz; /* Length of descriptor. */ + Elf64_Word n_type; /* Type of this note. */ +} Elf64_Note; + +/* * Relocation entries. */ diff --git a/sys/sys/elf_common.h b/sys/sys/elf_common.h index e9f846a..79cf597 100644 --- a/sys/sys/elf_common.h +++ b/sys/sys/elf_common.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: elf_common.h,v 1.1 1998/08/16 03:03:38 jdp Exp $ + * $Id: elf_common.h,v 1.2 1998/09/08 20:38:06 jdp Exp $ */ #ifndef _SYS_ELF_COMMON_H_ @@ -179,6 +179,11 @@ #define DT_COUNT 24 /* Number of defined d_tag values. */ +/* Values for n_type. Used in core files. */ +#define NT_PRSTATUS 1 /* Process status. */ +#define NT_FPREGSET 2 /* Floating point registers. */ +#define NT_PRPSINFO 3 /* Process state info. */ + /* Symbol Binding - ELFNN_ST_BIND - st_info */ #define STB_LOCAL 0 /* Local symbol */ #define STB_GLOBAL 1 /* Global symbol */ diff --git a/sys/sys/elf_generic.h b/sys/sys/elf_generic.h index ca50924..7ab479e 100644 --- a/sys/sys/elf_generic.h +++ b/sys/sys/elf_generic.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: elf_generic.h,v 1.1 1998/08/16 03:03:38 jdp Exp $ */ #ifndef _SYS_ELF_GENERIC_H_ @@ -40,6 +40,16 @@ #error "__ELF_WORD_SIZE must be defined as 32 or 64" #endif +#define ELF_CLASS __CONCAT(ELFCLASS,__ELF_WORD_SIZE) + +#if BYTE_ORDER == LITTLE_ENDIAN +#define ELF_DATA ELFDATA2LSB +#elif BYTE_ORDER == BIG_ENDIAN +#define ELF_DATA ELFDATA2MSB +#else +#error "Unknown byte order" +#endif + #define __ElfN(x) __CONCAT(__CONCAT(__CONCAT(Elf,__ELF_WORD_SIZE),_),x) #define __ELFN(x) __CONCAT(__CONCAT(__CONCAT(ELF,__ELF_WORD_SIZE),_),x) #define __ElfType(x) typedef __ElfN(x) __CONCAT(Elf_,x) @@ -54,6 +64,7 @@ __ElfType(Ehdr); __ElfType(Shdr); __ElfType(Phdr); __ElfType(Dyn); +__ElfType(Note); __ElfType(Rel); __ElfType(Rela); __ElfType(Sym); |