Merge symbol tables. (Not fully ELF conformant)
[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
13   GElf_Addr value;
14   GElf_Word size;
15
16   unsigned char bind;
17   unsigned char type;
18   unsigned char other;
19
20   struct ElfuScn *scnptr;
21   int shndx;
22
23   CIRCLEQ_ENTRY(ElfuSym) elem;
24 } ElfuSym;
25
26
27 typedef struct ElfuSymtab {
28   CIRCLEQ_HEAD(Syms, ElfuSym) syms;
29 } ElfuSymtab;
30
31
32
33 typedef struct ElfuRel {
34   char *name;
35
36   GElf_Addr offset;
37   GElf_Word info;
38
39   GElf_Word sym;
40   unsigned char type;
41
42   int addendUsed;
43   GElf_Sword addend;
44
45   CIRCLEQ_ENTRY(ElfuRel) elem;
46 } ElfuRel;
47
48
49 typedef struct ElfuReltab {
50   CIRCLEQ_HEAD(Rels, ElfuRel) rels;
51 } ElfuReltab;
52
53
54
55
56
57
58 typedef struct ElfuScn {
59   GElf_Shdr shdr;
60
61   Elf_Data data;
62
63   struct ElfuScn *linkptr;
64   struct ElfuScn *infoptr;
65
66   struct ElfuScn *oldptr;
67
68   struct ElfuSymtab symtab;
69   struct ElfuReltab reltab;
70
71   CIRCLEQ_ENTRY(ElfuScn) elemChildScn;
72   CIRCLEQ_ENTRY(ElfuScn) elem;
73 } ElfuScn;
74
75
76 typedef struct ElfuPhdr {
77   GElf_Phdr phdr;
78
79   CIRCLEQ_HEAD(ChildScnList, ElfuScn) childScnList;
80   CIRCLEQ_HEAD(ChildPhdrList, ElfuPhdr) childPhdrList;
81
82   CIRCLEQ_ENTRY(ElfuPhdr) elemChildPhdr;
83   CIRCLEQ_ENTRY(ElfuPhdr) elem;
84 } ElfuPhdr;
85
86
87 typedef struct {
88   int elfclass;
89   GElf_Ehdr ehdr;
90
91   CIRCLEQ_HEAD(PhdrList, ElfuPhdr) phdrList;
92   CIRCLEQ_HEAD(OrphanScnList, ElfuScn) orphanScnList;
93
94   ElfuScn *shstrtab;
95
96   ElfuScn *symtab;
97 } ElfuElf;
98
99 #endif