1
/******************************************************************************
2
* Copyright (c) 2004, 2011 IBM Corporation
4
* This program and the accompanying materials
5
* are made available under the terms of the BSD License
6
* which accompanies this distribution, and is available at
7
* http://www.opensource.org/licenses/bsd-license.php
10
* IBM Corporation - initial implementation
11
*****************************************************************************/
22
/* ELF object file types */
23
#define ET_NONE 0 /* No file type */
24
#define ET_REL 1 /* Relocatable file */
25
#define ET_EXEC 2 /* Executable file */
26
#define ET_DYN 3 /* Shared object file */
27
#define ET_CORE 4 /* Core file */
29
/* Generic ELF header */
41
/* Section types (sh_type) */
42
#define SHT_NULL 0 /* Unused section header */
43
#define SHT_PROGBITS 1 /* Information defined by the program */
44
#define SHT_SYMTAB 2 /* Linker symbol table */
45
#define SHT_STRTAB 3 /* String table */
46
#define SHT_RELA 4 /* "Rela" type relocation entries */
47
#define SHT_HASH 5 /* Symbol hash table */
48
#define SHT_DYNAMIC 6 /* Dynamic linking tables */
49
#define SHT_NOTE 7 /* Note information */
50
#define SHT_NOBITS 8 /* Uninitialized space */
51
#define SHT_REL 9 /* "Rel" type relocation entries */
52
#define SHT_SHLIB 10 /* Reserved */
53
#define SHT_DYNSYM 11 /* Dynamic loader symbol table */
55
/* Section attributs (sh_flags) */
58
#define SHF_EXECINSTR 0x4
60
/* Segment types (p_type) */
61
#define PT_NULL 0 /* Unused entry */
62
#define PT_LOAD 1 /* Loadable segment */
63
#define PT_DYNAMIC 2 /* Dynamic linking tables */
64
#define PT_INTERP 3 /* Program interpreter path name */
65
#define PT_NOTE 4 /* Note sections */
68
int elf_load_file(void *file_addr, unsigned long *entry,
69
int (*pre_load)(void*, long),
70
void (*post_load)(void*, long));
71
int elf_load_file_to_addr(void *file_addr, void *addr, unsigned long *entry,
72
int (*pre_load)(void*, long),
73
void (*post_load)(void*, long));
75
unsigned int elf_load_segments32(void *file_addr, signed long offset,
76
int (*pre_load)(void*, long),
77
void (*post_load)(void*, long));
78
unsigned long elf_load_segments64(void *file_addr, signed long offset,
79
int (*pre_load)(void*, long),
80
void (*post_load)(void*, long));
82
long elf_get_base_addr(void *file_addr);
83
long elf_get_base_addr32(void *file_addr);
84
long elf_get_base_addr64(void *file_addr);
86
void elf_relocate64(void *file_addr, signed long offset);
88
int elf_forth_claim(void *addr, long size);
90
#endif /* __LIBELF_H */