summaryrefslogtreecommitdiff
path: root/other/burneye2/elf/elf_file.h
blob: 1f4eef5ac108405680b26b479973b88dadd14461 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/* libxelf - elf_file access routines include file
 *
 * by scut / teso
 */

#ifndef	ELF_FILE_H
#define	ELF_FILE_H

#include <elf.h>
#include <stdio.h>


/* core structure that represents an entire ELF file
 */
typedef struct {
	char *		pathname;
	FILE *		fp;

	Elf32_Ehdr	Ehdr;
	Elf32_Phdr *	Phdr;
	Elf32_Shdr *	Shdr;

	/* ELF section string table
	 * not loaded if sh_str is NULL. use elf_str_hdr to look them up.
	 */
	unsigned long int	sh_str_len;
	unsigned char *		sh_str;
} elf_file;

#include <elf_section.h>


/* elf_file_new
 *
 * allocate a new elf_file structure and set default values
 *
 * return a pointer to the new structure
 */

elf_file *
elf_file_new (void);


/* elf_file_destroy
 *
 * destroy an elf_file structure `elf', completely freeing any resources
 * it occupied.
 *
 * return in any case
 */

void
elf_file_destroy (elf_file *elf);


/* elf_load
 *
 * load an ELF file from `pathname' into an elf_file parse tree
 *
 * return parse tree on success
 * return NULL on failure
 */

elf_file *
elf_file_load (char *pathname);

#endif