Phoenix
Object-oriented orthogonally persistent operating system
|
00001 /* 00002 * gelf.h - public header file for libelf. 00003 * Copyright (C) 2000 - 2006 Michael Riepe 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 00018 */ 00019 00020 /* @(#) $Id: gelf.h 172 2010-12-13 07:54:26Z vagran $ */ 00021 00022 #ifndef _GELF_H 00023 #define _GELF_H 00024 00025 #include <elf/libelf.h> 00026 00027 #if __LIBELF_NEED_LINK_H 00028 #include <link.h> 00029 #elif __LIBELF_NEED_SYS_LINK_H 00030 #include <sys/link.h> 00031 #endif /* __LIBELF_NEED_LINK_H */ 00032 00033 #ifdef __cplusplus 00034 extern "C" { 00035 #endif /* __cplusplus */ 00036 00037 #ifndef __P 00038 # if (__STDC__ + 0) || defined(__cplusplus) || defined(_WIN32) 00039 # define __P(args) args 00040 # else /* __STDC__ || defined(__cplusplus) */ 00041 # define __P(args) () 00042 # endif /* __STDC__ || defined(__cplusplus) */ 00043 #endif /* __P */ 00044 00045 #if !__LIBELF64 00046 00047 #error "GElf is not supported on this system." 00048 00049 #else /* __LIBELF64 */ 00050 00051 typedef Elf64_Addr GElf_Addr; 00052 typedef Elf64_Half GElf_Half; 00053 typedef Elf64_Off GElf_Off; 00054 typedef Elf64_Sword GElf_Sword; 00055 typedef Elf64_Word GElf_Word; 00056 typedef Elf64_Sxword GElf_Sxword; 00057 typedef Elf64_Xword GElf_Xword; 00058 00059 typedef Elf64_Ehdr GElf_Ehdr; 00060 typedef Elf64_Phdr GElf_Phdr; 00061 typedef Elf64_Shdr GElf_Shdr; 00062 typedef Elf64_Dyn GElf_Dyn; 00063 typedef Elf64_Rel GElf_Rel; 00064 typedef Elf64_Rela GElf_Rela; 00065 typedef Elf64_Sym GElf_Sym; 00066 00067 /* 00068 * Symbol versioning 00069 */ 00070 #if __LIBELF_SYMBOL_VERSIONS 00071 typedef Elf64_Verdef GElf_Verdef; 00072 typedef Elf64_Verneed GElf_Verneed; 00073 typedef Elf64_Verdaux GElf_Verdaux; 00074 typedef Elf64_Vernaux GElf_Vernaux; 00075 #endif /* __LIBELF_SYMBOL_VERSIONS */ 00076 00077 /* 00078 * These types aren't implemented (yet) 00079 * 00080 typedef Elf64_Move GElf_Move; 00081 typedef Elf64_Syminfo GElf_Syminfo; 00082 */ 00083 00084 /* 00085 * Generic macros 00086 */ 00087 #define GELF_ST_BIND ELF64_ST_BIND 00088 #define GELF_ST_TYPE ELF64_ST_TYPE 00089 #define GELF_ST_INFO ELF64_ST_INFO 00090 00091 #define GELF_R_TYPE ELF64_R_TYPE 00092 #define GELF_R_SYM ELF64_R_SYM 00093 #define GELF_R_INFO ELF64_R_INFO 00094 00095 /* 00096 * Function declarations 00097 */ 00098 extern int gelf_getclass __P((Elf *__elf)); 00099 00100 extern size_t gelf_fsize __P((Elf *__elf, Elf_Type __type, size_t __count, unsigned __ver)); 00101 00102 extern Elf_Data *gelf_xlatetof __P((Elf *__elf, Elf_Data *__dst, const Elf_Data *__src, unsigned __encode)); 00103 extern Elf_Data *gelf_xlatetom __P((Elf *__elf, Elf_Data *__dst, const Elf_Data *__src, unsigned __encode)); 00104 00105 extern GElf_Ehdr *gelf_getehdr __P((Elf *__elf, GElf_Ehdr *__dst)); 00106 extern int gelf_update_ehdr __P((Elf *__elf, GElf_Ehdr *__src)); 00107 extern unsigned long gelf_newehdr __P((Elf *__elf, int __elfclass)); 00108 00109 extern GElf_Phdr *gelf_getphdr __P((Elf *__elf, int ndx, GElf_Phdr *__dst)); 00110 extern int gelf_update_phdr __P((Elf *__elf, int ndx, GElf_Phdr *__src)); 00111 extern unsigned long gelf_newphdr __P((Elf *__elf, size_t __phnum)); 00112 00113 extern GElf_Shdr *gelf_getshdr __P((Elf_Scn *__scn, GElf_Shdr *__dst)); 00114 extern int gelf_update_shdr __P((Elf_Scn *__scn, GElf_Shdr *__src)); 00115 00116 extern GElf_Dyn *gelf_getdyn __P((Elf_Data *__src, int __ndx, GElf_Dyn *__dst)); 00117 extern int gelf_update_dyn __P((Elf_Data *__dst, int __ndx, GElf_Dyn *__src)); 00118 00119 extern GElf_Rel *gelf_getrel __P((Elf_Data *__src, int __ndx, GElf_Rel *__dst)); 00120 extern int gelf_update_rel __P((Elf_Data *__dst, int __ndx, GElf_Rel *__src)); 00121 00122 extern GElf_Rela *gelf_getrela __P((Elf_Data *__src, int __ndx, GElf_Rela *__dst)); 00123 extern int gelf_update_rela __P((Elf_Data *__dst, int __ndx, GElf_Rela *__src)); 00124 00125 extern GElf_Sym *gelf_getsym __P((Elf_Data *__src, int __ndx, GElf_Sym *__dst)); 00126 extern int gelf_update_sym __P((Elf_Data *__dst, int __ndx, GElf_Sym *__src)); 00127 00128 extern long gelf_checksum __P((Elf *__elf)); 00129 00130 /* 00131 * These functions aren't implemented (yet) 00132 * 00133 extern GElf_Move *gelf_getmove __P((Elf_Data *__src, int __ndx, GElf_Move *__src)); 00134 extern int gelf_update_move __P((Elf_Data *__dst, int __ndx, GElf_Move *__src)); 00135 * 00136 extern GElf_Syminfo* gelf_getsyminfo __P((Elf_Data *__src, int __ndx, GElf_Syminfo *__dst)); 00137 extern int gelf_update_syminfo __P((Elf_Data *__dst, int __ndx, GElf_Syminfo *__src)); 00138 */ 00139 00140 /* 00141 * Extensions (not available in other versions of libelf) 00142 */ 00143 extern size_t gelf_msize __P((Elf *__elf, Elf_Type __type, size_t __count, unsigned __ver)); 00144 00145 #endif /* __LIBELF64 */ 00146 00147 #ifdef __cplusplus 00148 } 00149 #endif /* __cplusplus */ 00150 00151 #endif /* _GELF_H */