|
1 /* |
|
2 * gelf.h - public header file for libelf. |
|
3 * Copyright (C) 2000 - 2006 Michael Riepe |
|
4 * |
|
5 * This library is free software; you can redistribute it and/or |
|
6 * modify it under the terms of the GNU Library General Public |
|
7 * License as published by the Free Software Foundation; either |
|
8 * version 2 of the License, or (at your option) any later version. |
|
9 * |
|
10 * This library is distributed in the hope that it will be useful, |
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 * Library General Public License for more details. |
|
14 * |
|
15 * You should have received a copy of the GNU Library General Public |
|
16 * License along with this library; if not, write to the Free Software |
|
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 */ |
|
19 |
|
20 /* @(#) $Id: gelf.h,v 1.15 2006/09/07 15:55:42 michael Exp $ */ |
|
21 |
|
22 #ifndef _GELF_H |
|
23 #define _GELF_H |
|
24 |
|
25 #if __LIBELF_INTERNAL__ |
|
26 #include <libelf.h> |
|
27 #else /* __LIBELF_INTERNAL__ */ |
|
28 #include <libelf/libelf.h> |
|
29 #endif /* __LIBELF_INTERNAL__ */ |
|
30 |
|
31 #if __LIBELF_NEED_LINK_H |
|
32 #include <link.h> |
|
33 #elif __LIBELF_NEED_SYS_LINK_H |
|
34 #include <sys/link.h> |
|
35 #endif /* __LIBELF_NEED_LINK_H */ |
|
36 |
|
37 #ifdef __cplusplus |
|
38 extern "C" { |
|
39 #endif /* __cplusplus */ |
|
40 |
|
41 #ifndef __P |
|
42 # if (__STDC__ + 0) || defined(__cplusplus) || defined(_WIN32) |
|
43 # define __P(args) args |
|
44 # else /* __STDC__ || defined(__cplusplus) */ |
|
45 # define __P(args) () |
|
46 # endif /* __STDC__ || defined(__cplusplus) */ |
|
47 #endif /* __P */ |
|
48 |
|
49 #if !__LIBELF64 |
|
50 |
|
51 #error "GElf is not supported on this system." |
|
52 |
|
53 #else /* __LIBELF64 */ |
|
54 |
|
55 typedef Elf64_Addr GElf_Addr; |
|
56 typedef Elf64_Half GElf_Half; |
|
57 typedef Elf64_Off GElf_Off; |
|
58 typedef Elf64_Sword GElf_Sword; |
|
59 typedef Elf64_Word GElf_Word; |
|
60 typedef Elf64_Sxword GElf_Sxword; |
|
61 typedef Elf64_Xword GElf_Xword; |
|
62 |
|
63 typedef Elf64_Ehdr GElf_Ehdr; |
|
64 typedef Elf64_Phdr GElf_Phdr; |
|
65 typedef Elf64_Shdr GElf_Shdr; |
|
66 typedef Elf64_Dyn GElf_Dyn; |
|
67 typedef Elf64_Rel GElf_Rel; |
|
68 typedef Elf64_Rela GElf_Rela; |
|
69 typedef Elf64_Sym GElf_Sym; |
|
70 |
|
71 /* |
|
72 * Symbol versioning |
|
73 */ |
|
74 #if __LIBELF_SYMBOL_VERSIONS |
|
75 typedef Elf64_Verdef GElf_Verdef; |
|
76 typedef Elf64_Verneed GElf_Verneed; |
|
77 typedef Elf64_Verdaux GElf_Verdaux; |
|
78 typedef Elf64_Vernaux GElf_Vernaux; |
|
79 #endif /* __LIBELF_SYMBOL_VERSIONS */ |
|
80 |
|
81 /* |
|
82 * These types aren't implemented (yet) |
|
83 * |
|
84 typedef Elf64_Move GElf_Move; |
|
85 typedef Elf64_Syminfo GElf_Syminfo; |
|
86 */ |
|
87 |
|
88 /* |
|
89 * Generic macros |
|
90 */ |
|
91 #define GELF_ST_BIND ELF64_ST_BIND |
|
92 #define GELF_ST_TYPE ELF64_ST_TYPE |
|
93 #define GELF_ST_INFO ELF64_ST_INFO |
|
94 |
|
95 #define GELF_R_TYPE ELF64_R_TYPE |
|
96 #define GELF_R_SYM ELF64_R_SYM |
|
97 #define GELF_R_INFO ELF64_R_INFO |
|
98 |
|
99 /* |
|
100 * Function declarations |
|
101 */ |
|
102 extern int gelf_getclass __P((Elf *__elf)); |
|
103 |
|
104 extern size_t gelf_fsize __P((Elf *__elf, Elf_Type __type, size_t __count, unsigned __ver)); |
|
105 |
|
106 extern Elf_Data *gelf_xlatetof __P((Elf *__elf, Elf_Data *__dst, const Elf_Data *__src, unsigned __encode)); |
|
107 extern Elf_Data *gelf_xlatetom __P((Elf *__elf, Elf_Data *__dst, const Elf_Data *__src, unsigned __encode)); |
|
108 |
|
109 extern GElf_Ehdr *gelf_getehdr __P((Elf *__elf, GElf_Ehdr *__dst)); |
|
110 extern int gelf_update_ehdr __P((Elf *__elf, GElf_Ehdr *__src)); |
|
111 extern unsigned long gelf_newehdr __P((Elf *__elf, int __elfclass)); |
|
112 |
|
113 extern GElf_Phdr *gelf_getphdr __P((Elf *__elf, int ndx, GElf_Phdr *__dst)); |
|
114 extern int gelf_update_phdr __P((Elf *__elf, int ndx, GElf_Phdr *__src)); |
|
115 extern unsigned long gelf_newphdr __P((Elf *__elf, size_t __phnum)); |
|
116 |
|
117 extern GElf_Shdr *gelf_getshdr __P((Elf_Scn *__scn, GElf_Shdr *__dst)); |
|
118 extern int gelf_update_shdr __P((Elf_Scn *__scn, GElf_Shdr *__src)); |
|
119 |
|
120 extern GElf_Dyn *gelf_getdyn __P((Elf_Data *__src, int __ndx, GElf_Dyn *__dst)); |
|
121 extern int gelf_update_dyn __P((Elf_Data *__dst, int __ndx, GElf_Dyn *__src)); |
|
122 |
|
123 extern GElf_Rel *gelf_getrel __P((Elf_Data *__src, int __ndx, GElf_Rel *__dst)); |
|
124 extern int gelf_update_rel __P((Elf_Data *__dst, int __ndx, GElf_Rel *__src)); |
|
125 |
|
126 extern GElf_Rela *gelf_getrela __P((Elf_Data *__src, int __ndx, GElf_Rela *__dst)); |
|
127 extern int gelf_update_rela __P((Elf_Data *__dst, int __ndx, GElf_Rela *__src)); |
|
128 |
|
129 extern GElf_Sym *gelf_getsym __P((Elf_Data *__src, int __ndx, GElf_Sym *__dst)); |
|
130 extern int gelf_update_sym __P((Elf_Data *__dst, int __ndx, GElf_Sym *__src)); |
|
131 |
|
132 extern long gelf_checksum __P((Elf *__elf)); |
|
133 |
|
134 /* |
|
135 * These functions aren't implemented (yet) |
|
136 * |
|
137 extern GElf_Move *gelf_getmove __P((Elf_Data *__src, int __ndx, GElf_Move *__src)); |
|
138 extern int gelf_update_move __P((Elf_Data *__dst, int __ndx, GElf_Move *__src)); |
|
139 * |
|
140 extern GElf_Syminfo* gelf_getsyminfo __P((Elf_Data *__src, int __ndx, GElf_Syminfo *__dst)); |
|
141 extern int gelf_update_syminfo __P((Elf_Data *__dst, int __ndx, GElf_Syminfo *__src)); |
|
142 */ |
|
143 |
|
144 /* |
|
145 * Extensions (not available in other versions of libelf) |
|
146 */ |
|
147 extern size_t gelf_msize __P((Elf *__elf, Elf_Type __type, size_t __count, unsigned __ver)); |
|
148 |
|
149 #endif /* __LIBELF64 */ |
|
150 |
|
151 #ifdef __cplusplus |
|
152 } |
|
153 #endif /* __cplusplus */ |
|
154 |
|
155 #endif /* _GELF_H */ |