-
Notifications
You must be signed in to change notification settings - Fork 0
/
internals.h
67 lines (56 loc) · 1.29 KB
/
internals.h
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
#ifndef TYPES_H
#define TYPES_H
#ifdef __linux__
#include <elf.h>
#else
#include "elf.h"
#endif
#include <fcntl.h>
#include "arch/target/relocs.h"
#include "arch/target/types.h"
typedef uint32_t Elf_Hashtab;
// musl libc says on "S390x" systems hashtab_t is `uint64_t`, what's that?
// https://en.wikipedia.org/wiki/Linux_on_IBM_Z
typedef uint32_t Elf_GHashtab;
struct Elf_loadsegs {
void *addr;
size_t phdr_ndx;
};
struct Elf_loadmap {
unsigned short version, nsegs;
struct Elf_loadsegs segs[];
};
struct Elf_mapping_info_t {
void *base;
size_t addr_min, addr_max;
off_t off_start;
struct Elf_loadmap *loadmap;
};
struct Elf_dynamic_info_t {
Elf_Addr vaddr;
char *strtab;
void *got;
Elf_Sym *symtab;
Elf_Hashtab *hashtab; // sysv hashtab
Elf_GHashtab *ghashtab; // gnu hashtab
int16_t *gversym; // gnu version
};
struct Elf_reloc_info_t {
size_t relro_start, relro_end;
};
struct Elf_handle_t {
int fd;
Elf_Ehdr header;
Elf_Phdr *phdr;
Elf_Shdr *shdr;
struct Elf_mapping_info_t *mapping_info;
struct Elf_dynamic_info_t *dl_info;
struct Elf_reloc_info_t *reloc_info;
};
struct link_map {
Elf_Addr l_addr;
char *l_name;
Elf_Dyn *l_ld;
struct link_map *l_next, *l_prev;
};
#endif // TYPES_H