]> granicus.if.org Git - file/commitdiff
*** empty log message ***
authorChristos Zoulas <christos@zoulas.com>
Sat, 5 Oct 1996 18:13:09 +0000 (18:13 +0000)
committerChristos Zoulas <christos@zoulas.com>
Sat, 5 Oct 1996 18:13:09 +0000 (18:13 +0000)
src/readelf.h

index 78a34c1c0b0da87f069390c8f3d3a965bbb46f52..08f9ccc32bcfb7290607bdcb23c51fd271baa5e5 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * readelf.h 
- * @(#)$Id: readelf.h,v 1.1 1996/06/22 22:04:22 christos Exp $
+ * @(#)$Id: readelf.h,v 1.2 1996/10/05 18:13:09 christos Exp $
  *
  * Provide elf data structures for non-elf machines, allowing file
  * non-elf hosts to determine if an elf binary is stripped.
@@ -15,9 +15,16 @@ typedef unsigned int Elf32_Off;
 typedef unsigned int   Elf32_Word;
 typedef unsigned char  Elf32_Char;
 
+/* XXX: We need 64 bit numbers here */
+typedef unsigned int   Elf64_Addr[2];
+typedef unsigned short Elf64_Half;
+typedef unsigned int   Elf64_Off[2];
+typedef unsigned int   Elf64_Word;
+typedef unsigned char  Elf64_Char;
+
 #define EI_NIDENT      16
 
-typedef struct elfhdr{
+typedef struct {
     Elf32_Char e_ident[EI_NIDENT];
     Elf32_Half e_type;
     Elf32_Half e_machine;
@@ -34,14 +41,40 @@ typedef struct elfhdr{
     Elf32_Half e_shstrndx;
 } Elf32_Ehdr;
 
+typedef struct {
+    Elf64_Char e_ident[EI_NIDENT];
+    Elf64_Half e_type;
+    Elf64_Half e_machine;
+    Elf64_Word e_version;
+    Elf64_Addr e_entry;  /* Entry point */
+    Elf64_Off  e_phoff;
+    Elf64_Off  e_shoff;
+    Elf64_Word e_flags;
+    Elf64_Half e_ehsize;
+    Elf64_Half e_phentsize;
+    Elf64_Half e_phnum;
+    Elf64_Half e_shentsize;
+    Elf64_Half e_shnum;
+    Elf64_Half e_shstrndx;
+} Elf64_Ehdr;
+
+/* e_type */
+#define ET_CORE                4
+
 /* sh_type */
 #define SHT_SYMTAB     2
+#define SHT_NOTE       7
 
 /* elf type */
 #define ELFDATANONE    0               /* e_ident[EI_DATA] */
 #define ELFDATA2LSB    1
 #define ELFDATA2MSB    2
 
+/* elf class */
+#define ELFCLASSNONE   0
+#define ELFCLASS32     1
+#define ELFCLASS64     2
+
 /* magic number */
 #define        EI_MAG0         0               /* e_ident[] indexes */
 #define        EI_MAG1         1
@@ -58,6 +91,26 @@ typedef struct elfhdr{
 #define        ELFMAG3         'F'
 #define        ELFMAG          "\177ELF"
 
+typedef struct {
+    Elf32_Word p_type;
+    Elf32_Off  p_offset;
+    Elf32_Addr p_vaddr;
+    Elf32_Addr p_paddr;
+    Elf32_Word p_filesz;
+    Elf32_Word p_memsz;
+    Elf32_Word p_flags;
+    Elf32_Word p_align;
+} Elf32_Phdr;
+
+#define        PT_NULL         0               /* p_type */
+#define        PT_LOAD         1
+#define        PT_DYNAMIC      2
+#define        PT_INTERP       3
+#define        PT_NOTE         4
+#define        PT_SHLIB        5
+#define        PT_PHDR         6
+#define        PT_NUM          7
+
 typedef struct {
     Elf32_Word sh_name;
     Elf32_Word sh_type;
@@ -71,4 +124,17 @@ typedef struct {
     Elf32_Word sh_entsize;
 } Elf32_Shdr;
 
+typedef struct {
+    Elf64_Word sh_name;
+    Elf64_Word sh_type;
+    Elf64_Off  sh_flags;
+    Elf64_Addr sh_addr;
+    Elf64_Off  sh_offset;
+    Elf64_Off  sh_size;
+    Elf64_Word sh_link;
+    Elf64_Word sh_info;
+    Elf64_Off  sh_addralign;
+    Elf64_Off  sh_entsize;
+} Elf64_Shdr;
+
 #endif