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.
This commit is contained in:
parent
1dcd4c8224
commit
25cd854413
@ -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)
|
||||
|
||||
/*
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -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_
|
||||
@ -108,6 +108,21 @@ typedef struct {
|
||||
} d_un;
|
||||
} 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.
|
||||
*/
|
||||
|
@ -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_
|
||||
@ -109,6 +109,21 @@ typedef struct {
|
||||
} d_un;
|
||||
} 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.
|
||||
*/
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user