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>
41 typedef void Elf_Void
;
47 ELF_C_NULL
= 0, /* must be first, 0 */
57 ELF_C_NUM
/* must be last */
64 #define ELF_F_DIRTY 0x1
65 #define ELF_F_LAYOUT 0x4
72 ELF_K_NONE
= 0, /* must be first, 0 */
76 ELF_K_NUM
/* must be last */
84 ELF_T_BYTE
= 0, /* must be first, 0 */
106 ELF_T_NUM
/* must be last */
110 typedef struct Elf Elf
;
111 typedef struct Elf_Scn Elf_Scn
;
115 * Archive member header
129 * Archive symbol table
134 unsigned long as_hash
;
145 off_t d_off
; /* offset into section */
146 size_t d_align
; /* alignment in section */
147 unsigned d_version
; /* elf version */
152 * Function declarations
154 Elf
*elf_begin(int, Elf_Cmd
, Elf
*);
155 int elf_cntl(Elf
*, Elf_Cmd
);
157 const char *elf_errmsg(int);
160 unsigned elf_flagdata(Elf_Data
*, Elf_Cmd
, unsigned);
161 unsigned elf_flagehdr(Elf
*, Elf_Cmd
, unsigned);
162 unsigned elf_flagelf(Elf
*, Elf_Cmd
, unsigned);
163 unsigned elf_flagphdr(Elf
*, Elf_Cmd
, unsigned);
164 unsigned elf_flagscn(Elf_Scn
*, Elf_Cmd
, unsigned);
165 unsigned elf_flagshdr(Elf_Scn
*, Elf_Cmd
, unsigned);
166 size_t elf32_fsize(Elf_Type
, size_t, unsigned);
167 Elf_Arhdr
*elf_getarhdr(Elf
*);
168 Elf_Arsym
*elf_getarsym(Elf
*, size_t *);
169 off_t
elf_getbase(Elf
*);
170 Elf_Data
*elf_getdata(Elf_Scn
*, Elf_Data
*);
171 Elf32_Ehdr
*elf32_getehdr(Elf
*);
172 char *elf_getident(Elf
*, size_t *);
173 Elf32_Phdr
*elf32_getphdr(Elf
*);
174 Elf_Scn
*elf_getscn(Elf
*elf
, size_t);
175 Elf32_Shdr
*elf32_getshdr(Elf_Scn
*);
176 int elf_getphnum(Elf
*, size_t *);
177 int elf_getphdrnum(Elf
*, size_t *);
178 int elf_getshnum(Elf
*, size_t *);
179 int elf_getshdrnum(Elf
*, size_t *);
180 int elf_getshstrndx(Elf
*, size_t *);
181 int elf_getshdrstrndx(Elf
*, size_t *);
182 unsigned long elf_hash(const char *);
183 uint_t
elf_sys_encoding(void);
184 long elf32_checksum(Elf
*);
185 Elf_Kind
elf_kind(Elf
*);
186 Elf
*elf_memory(char *, size_t);
187 size_t elf_ndxscn(Elf_Scn
*);
188 Elf_Data
*elf_newdata(Elf_Scn
*);
189 Elf32_Ehdr
*elf32_newehdr(Elf
*);
190 Elf32_Phdr
*elf32_newphdr(Elf
*, size_t);
191 Elf_Scn
*elf_newscn(Elf
*);
192 Elf_Scn
*elf_nextscn(Elf
*, Elf_Scn
*);
193 Elf_Cmd
elf_next(Elf
*);
194 size_t elf_rand(Elf
*, size_t);
195 Elf_Data
*elf_rawdata(Elf_Scn
*, Elf_Data
*);
196 char *elf_rawfile(Elf
*, size_t *);
197 char *elf_strptr(Elf
*, size_t, size_t);
198 off_t
elf_update(Elf
*, Elf_Cmd
);
199 unsigned elf_version(unsigned);
200 Elf_Data
*elf32_xlatetof(Elf_Data
*, const Elf_Data
*, unsigned);
201 Elf_Data
*elf32_xlatetom(Elf_Data
*, const Elf_Data
*, unsigned);
203 size_t elf64_fsize(Elf_Type
, size_t, unsigned);
204 Elf64_Ehdr
*elf64_getehdr(Elf
*);
205 Elf64_Phdr
*elf64_getphdr(Elf
*);
206 Elf64_Shdr
*elf64_getshdr(Elf_Scn
*);
207 long elf64_checksum(Elf
*);
208 Elf64_Ehdr
*elf64_newehdr(Elf
*);
209 Elf64_Phdr
*elf64_newphdr(Elf
*, size_t);
210 Elf_Data
*elf64_xlatetof(Elf_Data
*, const Elf_Data
*, unsigned);
211 Elf_Data
*elf64_xlatetom(Elf_Data
*, const Elf_Data
*, unsigned);
217 #endif /* _LIBELF_H */