ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

elf32.h
Go to the documentation of this file.
00001 /*-
00002  * Copyright (c) 1996-1998 John D. Polstra.
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  *
00014  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
00015  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00016  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00017  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
00018  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00019  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00020  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00021  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00022  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00023  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00024  * SUCH DAMAGE.
00025  *
00026  * $FreeBSD: src/sys/sys/elf32.h,v 1.8 2002/05/30 08:32:18 dfr Exp $
00027  */
00028 
00029 #ifndef _SYS_ELF32_H_
00030 #define _SYS_ELF32_H_ 1
00031 
00032 /*
00033  * ELF definitions common to all 32-bit architectures.
00034  */
00035 
00036 typedef ULONG32 Elf32_Addr;
00037 typedef USHORT  Elf32_Half;
00038 typedef ULONG32 Elf32_Off;
00039 typedef LONG32  Elf32_Sword;
00040 typedef ULONG32 Elf32_Word;
00041 typedef ULONG32 Elf32_Size;
00042 typedef Elf32_Off   Elf32_Hashelt;
00043 
00044 /*
00045  * ELF header.
00046  */
00047 
00048 typedef struct {
00049     unsigned char   e_ident[EI_NIDENT]; /* File identification. */
00050     Elf32_Half  e_type;     /* File type. */
00051     Elf32_Half  e_machine;  /* Machine architecture. */
00052     Elf32_Word  e_version;  /* ELF format version. */
00053     Elf32_Addr  e_entry;    /* Entry point. */
00054     Elf32_Off   e_phoff;    /* Program header file offset. */
00055     Elf32_Off   e_shoff;    /* Section header file offset. */
00056     Elf32_Word  e_flags;    /* Architecture-specific flags. */
00057     Elf32_Half  e_ehsize;   /* Size of ELF header in bytes. */
00058     Elf32_Half  e_phentsize;    /* Size of program header entry. */
00059     Elf32_Half  e_phnum;    /* Number of program header entries. */
00060     Elf32_Half  e_shentsize;    /* Size of section header entry. */
00061     Elf32_Half  e_shnum;    /* Number of section header entries. */
00062     Elf32_Half  e_shstrndx; /* Section name strings section. */
00063 } Elf32_Ehdr;
00064 
00065 /*
00066  * Section header.
00067  */
00068 
00069 typedef struct {
00070     Elf32_Word  sh_name;    /* Section name (index into the
00071                        section header string table). */
00072     Elf32_Word  sh_type;    /* Section type. */
00073     Elf32_Word  sh_flags;   /* Section flags. */
00074     Elf32_Addr  sh_addr;    /* Address in memory image. */
00075     Elf32_Off   sh_offset;  /* Offset in file. */
00076     Elf32_Size  sh_size;    /* Size in bytes. */
00077     Elf32_Word  sh_link;    /* Index of a related section. */
00078     Elf32_Word  sh_info;    /* Depends on section type. */
00079     Elf32_Size  sh_addralign;   /* Alignment in bytes. */
00080     Elf32_Size  sh_entsize; /* Size of each entry in section. */
00081 } Elf32_Shdr;
00082 
00083 /*
00084  * Program header.
00085  */
00086 
00087 typedef struct {
00088     Elf32_Word  p_type;     /* Entry type. */
00089     Elf32_Off   p_offset;   /* File offset of contents. */
00090     Elf32_Addr  p_vaddr;    /* Virtual address in memory image. */
00091     Elf32_Addr  p_paddr;    /* Physical address (not used). */
00092     Elf32_Size  p_filesz;   /* Size of contents in file. */
00093     Elf32_Size  p_memsz;    /* Size of contents in memory. */
00094     Elf32_Word  p_flags;    /* Access permission flags. */
00095     Elf32_Size  p_align;    /* Alignment in memory and file. */
00096 } Elf32_Phdr;
00097 
00098 /*
00099  * Dynamic structure.  The ".dynamic" section contains an array of them.
00100  */
00101 
00102 typedef struct {
00103     Elf32_Sword d_tag;      /* Entry type. */
00104     union {
00105         Elf32_Size  d_val;  /* Integer value. */
00106         Elf32_Addr  d_ptr;  /* Address value. */
00107     } d_un;
00108 } Elf32_Dyn;
00109 
00110 /*
00111  * Relocation entries.
00112  */
00113 
00114 /* Relocations that don't need an addend field. */
00115 typedef struct {
00116     Elf32_Addr  r_offset;   /* Location to be relocated. */
00117     Elf32_Word  r_info;     /* Relocation type and symbol index. */
00118 } Elf32_Rel;
00119 
00120 /* Relocations that need an addend field. */
00121 typedef struct {
00122     Elf32_Addr  r_offset;   /* Location to be relocated. */
00123     Elf32_Word  r_info;     /* Relocation type and symbol index. */
00124     Elf32_Sword r_addend;   /* Addend. */
00125 } Elf32_Rela;
00126 
00127 /* Macros for accessing the fields of r_info. */
00128 #define ELF32_R_SYM(info)   ((info) >> 8)
00129 #define ELF32_R_TYPE(info)  ((unsigned char)(info))
00130 
00131 /* Macro for constructing r_info from field values. */
00132 #define ELF32_R_INFO(sym, type) (((sym) << 8) + (unsigned char)(type))
00133 
00134 /*
00135  * Symbol table entries.
00136  */
00137 
00138 typedef struct {
00139     Elf32_Word  st_name;    /* String table index of name. */
00140     Elf32_Addr  st_value;   /* Symbol value. */
00141     Elf32_Size  st_size;    /* Size of associated object. */
00142     unsigned char   st_info;    /* Type and binding information. */
00143     unsigned char   st_other;   /* Reserved (not used). */
00144     Elf32_Half  st_shndx;   /* Section index of symbol. */
00145 } Elf32_Sym;
00146 
00147 /* Macros for accessing the fields of st_info. */
00148 #define ELF32_ST_BIND(info)     ((info) >> 4)
00149 #define ELF32_ST_TYPE(info)     ((info) & 0xf)
00150 
00151 /* Macro for constructing st_info from field values. */
00152 #define ELF32_ST_INFO(bind, type)   (((bind) << 4) + ((type) & 0xf))
00153 
00154 #endif /* !_SYS_ELF32_H_ */

Generated on Fri May 25 2012 04:31:33 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.