4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
21 /* Copyright (c) 1988 AT&T */
22 /* All Rights Reserved */
25 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
26 * Use is subject to license terms.
27 * Copyright 2014 PALO, Richard. All rights reserved.
33 #include <sys/types.h>
42 #if defined(_ILP32) && (_FILE_OFFSET_BITS != 32)
43 #error "large files are not supported by libelf"
46 typedef void Elf_Void
;
52 ELF_C_NULL
= 0, /* must be first, 0 */
62 ELF_C_NUM
/* must be last */
69 #define ELF_F_DIRTY 0x1
70 #define ELF_F_LAYOUT 0x4
77 ELF_K_NONE
= 0, /* must be first, 0 */
81 ELF_K_NUM
/* must be last */
89 ELF_T_BYTE
= 0, /* must be first, 0 */
111 ELF_T_NUM
/* must be last */
115 typedef struct Elf Elf
;
116 typedef struct Elf_Scn Elf_Scn
;
120 * Archive member header
134 * Archive symbol table
139 unsigned long as_hash
;
150 off_t d_off
; /* offset into section */
151 size_t d_align
; /* alignment in section */
152 unsigned d_version
; /* elf version */
157 * Function declarations
159 Elf
*elf_begin(int, Elf_Cmd
, Elf
*);
160 int elf_cntl(Elf
*, Elf_Cmd
);
162 const char *elf_errmsg(int);
165 unsigned elf_flagdata(Elf_Data
*, Elf_Cmd
, unsigned);
166 unsigned elf_flagehdr(Elf
*, Elf_Cmd
, unsigned);
167 unsigned elf_flagelf(Elf
*, Elf_Cmd
, unsigned);
168 unsigned elf_flagphdr(Elf
*, Elf_Cmd
, unsigned);
169 unsigned elf_flagscn(Elf_Scn
*, Elf_Cmd
, unsigned);
170 unsigned elf_flagshdr(Elf_Scn
*, Elf_Cmd
, unsigned);
171 size_t elf32_fsize(Elf_Type
, size_t, unsigned);
172 Elf_Arhdr
*elf_getarhdr(Elf
*);
173 Elf_Arsym
*elf_getarsym(Elf
*, size_t *);
174 off_t
elf_getbase(Elf
*);
175 Elf_Data
*elf_getdata(Elf_Scn
*, Elf_Data
*);
176 Elf32_Ehdr
*elf32_getehdr(Elf
*);
177 char *elf_getident(Elf
*, size_t *);
178 Elf32_Phdr
*elf32_getphdr(Elf
*);
179 Elf_Scn
*elf_getscn(Elf
*elf
, size_t);
180 Elf32_Shdr
*elf32_getshdr(Elf_Scn
*);
181 int elf_getphnum(Elf
*, size_t *);
182 int elf_getphdrnum(Elf
*, size_t *);
183 int elf_getshnum(Elf
*, size_t *);
184 int elf_getshdrnum(Elf
*, size_t *);
185 int elf_getshstrndx(Elf
*, size_t *);
186 int elf_getshdrstrndx(Elf
*, size_t *);
187 unsigned long elf_hash(const char *);
188 uint_t
elf_sys_encoding(void);
189 long elf32_checksum(Elf
*);
190 Elf_Kind
elf_kind(Elf
*);
191 Elf
*elf_memory(char *, size_t);
192 size_t elf_ndxscn(Elf_Scn
*);
193 Elf_Data
*elf_newdata(Elf_Scn
*);
194 Elf32_Ehdr
*elf32_newehdr(Elf
*);
195 Elf32_Phdr
*elf32_newphdr(Elf
*, size_t);
196 Elf_Scn
*elf_newscn(Elf
*);
197 Elf_Scn
*elf_nextscn(Elf
*, Elf_Scn
*);
198 Elf_Cmd
elf_next(Elf
*);
199 size_t elf_rand(Elf
*, size_t);
200 Elf_Data
*elf_rawdata(Elf_Scn
*, Elf_Data
*);
201 char *elf_rawfile(Elf
*, size_t *);
202 char *elf_strptr(Elf
*, size_t, size_t);
203 off_t
elf_update(Elf
*, Elf_Cmd
);
204 unsigned elf_version(unsigned);
205 Elf_Data
*elf32_xlatetof(Elf_Data
*, const Elf_Data
*, unsigned);
206 Elf_Data
*elf32_xlatetom(Elf_Data
*, const Elf_Data
*, unsigned);
208 #if defined(_LP64) || defined(_LONGLONG_TYPE)
209 size_t elf64_fsize(Elf_Type
, size_t, unsigned);
210 Elf64_Ehdr
*elf64_getehdr(Elf
*);
211 Elf64_Phdr
*elf64_getphdr(Elf
*);
212 Elf64_Shdr
*elf64_getshdr(Elf_Scn
*);
213 long elf64_checksum(Elf
*);
214 Elf64_Ehdr
*elf64_newehdr(Elf
*);
215 Elf64_Phdr
*elf64_newphdr(Elf
*, size_t);
216 Elf_Data
*elf64_xlatetof(Elf_Data
*, const Elf_Data
*, unsigned);
217 Elf_Data
*elf64_xlatetom(Elf_Data
*, const Elf_Data
*, unsigned);
218 #endif /* (defined(_LP64) || defined(_LONGLONG_TYPE) */
224 #endif /* _LIBELF_H */