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

elf64.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/elf64.h,v 1.10 2002/05/30 08:32:18 dfr Exp $
00027  */
00028 
00029 #ifndef _SYS_ELF64_H_
00030 #define _SYS_ELF64_H_ 1
00031 
00032 /*
00033  * ELF definitions common to all 64-bit architectures.
00034  */
00035 
00036 typedef ULONG64 Elf64_Addr;
00037 typedef ULONG32 Elf64_Half;
00038 typedef ULONG64 Elf64_Off;
00039 typedef LONG64  Elf64_Sword;
00040 typedef ULONG64 Elf64_Word;
00041 typedef ULONG64 Elf64_Size;
00042 typedef USHORT  Elf64_Quarter;
00043 
00044 /*
00045  * Types of dynamic symbol hash table bucket and chain elements.
00046  *
00047  * This is inconsistent among 64 bit architectures, so a machine dependent
00048  * typedef is required.
00049  */
00050 
00051 #ifdef _ALPHA_
00052 typedef Elf64_Off   Elf64_Hashelt;
00053 #else
00054 typedef Elf64_Half  Elf64_Hashelt;
00055 #endif
00056 
00057 /*
00058  * ELF header.
00059  */
00060 
00061 typedef struct {
00062     unsigned char   e_ident[EI_NIDENT]; /* File identification. */
00063     Elf64_Quarter   e_type;     /* File type. */
00064     Elf64_Quarter   e_machine;  /* Machine architecture. */
00065     Elf64_Half  e_version;  /* ELF format version. */
00066     Elf64_Addr  e_entry;    /* Entry point. */
00067     Elf64_Off   e_phoff;    /* Program header file offset. */
00068     Elf64_Off   e_shoff;    /* Section header file offset. */
00069     Elf64_Half  e_flags;    /* Architecture-specific flags. */
00070     Elf64_Quarter   e_ehsize;   /* Size of ELF header in bytes. */
00071     Elf64_Quarter   e_phentsize;    /* Size of program header entry. */
00072     Elf64_Quarter   e_phnum;    /* Number of program header entries. */
00073     Elf64_Quarter   e_shentsize;    /* Size of section header entry. */
00074     Elf64_Quarter   e_shnum;    /* Number of section header entries. */
00075     Elf64_Quarter   e_shstrndx; /* Section name strings section. */
00076 } Elf64_Ehdr;
00077 
00078 /*
00079  * Section header.
00080  */
00081 
00082 typedef struct {
00083     Elf64_Half  sh_name;    /* Section name (index into the
00084                        section header string table). */
00085     Elf64_Half  sh_type;    /* Section type. */
00086     Elf64_Size  sh_flags;   /* Section flags. */
00087     Elf64_Addr  sh_addr;    /* Address in memory image. */
00088     Elf64_Off   sh_offset;  /* Offset in file. */
00089     Elf64_Size  sh_size;    /* Size in bytes. */
00090     Elf64_Half  sh_link;    /* Index of a related section. */
00091     Elf64_Half  sh_info;    /* Depends on section type. */
00092     Elf64_Size  sh_addralign;   /* Alignment in bytes. */
00093     Elf64_Size  sh_entsize; /* Size of each entry in section. */
00094 } Elf64_Shdr;
00095 
00096 /*
00097  * Program header.
00098  */
00099 
00100 typedef struct {
00101     Elf64_Half  p_type;     /* Entry type. */
00102     Elf64_Half  p_flags;    /* Access permission flags. */
00103     Elf64_Off   p_offset;   /* File offset of contents. */
00104     Elf64_Addr  p_vaddr;    /* Virtual address in memory image. */
00105     Elf64_Addr  p_paddr;    /* Physical address (not used). */
00106     Elf64_Size  p_filesz;   /* Size of contents in file. */
00107     Elf64_Size  p_memsz;    /* Size of contents in memory. */
00108     Elf64_Size  p_align;    /* Alignment in memory and file. */
00109 } Elf64_Phdr;
00110 
00111 /*
00112  * Dynamic structure.  The ".dynamic" section contains an array of them.
00113  */
00114 
00115 typedef struct {
00116     Elf64_Size  d_tag;      /* Entry type. */
00117     union {
00118         Elf64_Size  d_val;  /* Integer value. */
00119         Elf64_Addr  d_ptr;  /* Address value. */
00120     } d_un;
00121 } Elf64_Dyn;
00122 
00123 /*
00124  * Relocation entries.
00125  */
00126 
00127 /* Relocations that don't need an addend field. */
00128 typedef struct {
00129     Elf64_Addr  r_offset;   /* Location to be relocated. */
00130     Elf64_Size  r_info;     /* Relocation type and symbol index. */
00131 } Elf64_Rel;
00132 
00133 /* Relocations that need an addend field. */
00134 typedef struct {
00135     Elf64_Addr  r_offset;   /* Location to be relocated. */
00136     Elf64_Size  r_info;     /* Relocation type and symbol index. */
00137     Elf64_Off   r_addend;   /* Addend. */
00138 } Elf64_Rela;
00139 
00140 /* Macros for accessing the fields of r_info. */
00141 #define ELF64_R_SYM(info)   ((info) >> 32)
00142 #define ELF64_R_TYPE(info)  ((unsigned char)(info))
00143 
00144 /* Macro for constructing r_info from field values. */
00145 #define ELF64_R_INFO(sym, type) (((sym) << 32) + (unsigned char)(type))
00146 
00147 /*
00148  * Symbol table entries.
00149  */
00150 
00151 typedef struct {
00152     Elf64_Half  st_name;    /* String table index of name. */
00153     unsigned char   st_info;    /* Type and binding information. */
00154     unsigned char   st_other;   /* Reserved (not used). */
00155     Elf64_Quarter   st_shndx;   /* Section index of symbol. */
00156     Elf64_Addr  st_value;   /* Symbol value. */
00157     Elf64_Size  st_size;    /* Size of associated object. */
00158 } Elf64_Sym;
00159 
00160 /* Macros for accessing the fields of st_info. */
00161 #define ELF64_ST_BIND(info)     ((info) >> 4)
00162 #define ELF64_ST_TYPE(info)     ((info) & 0xf)
00163 
00164 /* Macro for constructing st_info from field values. */
00165 #define ELF64_ST_INFO(bind, type)   (((bind) << 4) + ((type) & 0xf))
00166 
00167 #endif /* !_SYS_ELF64_H_ */

Generated on Sun May 27 2012 04:33:08 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.