37e25fa6c574553e290451c47a33bfc5be11e6c6
[centaur.git] / include / libelfu / types.h
1 #ifndef __LIBELFU_TYPES_H__
2 #define __LIBELFU_TYPES_H__
3
4 #include <sys/queue.h>
5
6 #include <elf.h>
7 #include <gelf.h>
8
9
10 typedef struct ElfuSym {
11   GElf_Word name;
12   char *nameptr;
13
14   GElf_Addr value;
15   GElf_Word size;
16
17   unsigned char bind;
18   unsigned char type;
19   unsigned char other;
20
21   struct ElfuScn *scnptr;
22   int shndx;
23
24   CIRCLEQ_ENTRY(ElfuSym) elem;
25 } ElfuSym;
26
27
28 typedef struct ElfuSymtab {
29   CIRCLEQ_HEAD(Syms, ElfuSym) syms;
30 } ElfuSymtab;
31
32
33
34 typedef struct ElfuRel {
35   char *name;
36
37   GElf_Addr offset;
38   GElf_Word info;
39
40   GElf_Word sym;
41   unsigned char type;
42
43   int addendUsed;
44   GElf_Sword addend;
45
46   CIRCLEQ_ENTRY(ElfuRel) elem;
47 } ElfuRel;
48
49
50 typedef struct ElfuReltab {
51   CIRCLEQ_HEAD(Rels, ElfuRel) rels;
52 } ElfuReltab;
53
54
55
56
57
58
59 typedef struct ElfuScn {
60   GElf_Shdr shdr;
61
62   Elf_Data data;
63
64   struct ElfuScn *linkptr;
65   struct ElfuScn *infoptr;
66
67   struct ElfuScn *oldptr;
68
69   struct ElfuSymtab symtab;
70   struct ElfuReltab reltab;
71
72   CIRCLEQ_ENTRY(ElfuScn) elemChildScn;
73   CIRCLEQ_ENTRY(ElfuScn) elem;
74 } ElfuScn;
75
76
77 typedef struct ElfuPhdr {
78   GElf_Phdr phdr;
79
80   CIRCLEQ_HEAD(ChildScnList, ElfuScn) childScnList;
81   CIRCLEQ_HEAD(ChildPhdrList, ElfuPhdr) childPhdrList;
82
83   CIRCLEQ_ENTRY(ElfuPhdr) elemChildPhdr;
84   CIRCLEQ_ENTRY(ElfuPhdr) elem;
85 } ElfuPhdr;
86
87
88 typedef struct {
89   int elfclass;
90   GElf_Ehdr ehdr;
91
92   CIRCLEQ_HEAD(PhdrList, ElfuPhdr) phdrList;
93   CIRCLEQ_HEAD(OrphanScnList, ElfuScn) orphanScnList;
94
95   ElfuScn *shstrtab;
96
97   ElfuScn *symtab;
98 } ElfuElf;
99
100 #endif