summaryrefslogtreecommitdiff
path: root/include/libelfu/types.h
blob: 46fbc6924092ba9c5c15830bdbda33f5870853b7 (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#ifndef __LIBELFU_TYPES_H__
#define __LIBELFU_TYPES_H__

#include <sys/queue.h>

#include <elf.h>
#include <gelf.h>


typedef struct ElfuSym {
  char *name;

  GElf_Addr value;
  GElf_Word size;

  unsigned char bind;
  unsigned char type;
  unsigned char other;

  struct ElfuScn *scnptr;
  int shndx;

  CIRCLEQ_ENTRY(ElfuSym) elem;
} ElfuSym;


typedef struct ElfuSymtab {
  CIRCLEQ_HEAD(Syms, ElfuSym) syms;
} ElfuSymtab;



typedef struct ElfuRel {
  char *name;

  GElf_Addr offset;
  GElf_Word info;

  GElf_Word sym;
  unsigned char type;

  int addendUsed;
  GElf_Sword addend;

  CIRCLEQ_ENTRY(ElfuRel) elem;
} ElfuRel;


typedef struct ElfuReltab {
  CIRCLEQ_HEAD(Rels, ElfuRel) rels;
} ElfuReltab;






typedef struct ElfuScn {
  GElf_Shdr shdr;

  Elf_Data data;

  struct ElfuScn *linkptr;
  struct ElfuScn *infoptr;

  struct ElfuScn *oldptr;

  struct ElfuSymtab symtab;
  struct ElfuReltab reltab;

  CIRCLEQ_ENTRY(ElfuScn) elemChildScn;
  CIRCLEQ_ENTRY(ElfuScn) elem;
} ElfuScn;


typedef struct ElfuPhdr {
  GElf_Phdr phdr;

  CIRCLEQ_HEAD(ChildScnList, ElfuScn) childScnList;
  CIRCLEQ_HEAD(ChildPhdrList, ElfuPhdr) childPhdrList;

  CIRCLEQ_ENTRY(ElfuPhdr) elemChildPhdr;
  CIRCLEQ_ENTRY(ElfuPhdr) elem;
} ElfuPhdr;


typedef struct {
  int elfclass;
  GElf_Ehdr ehdr;

  CIRCLEQ_HEAD(PhdrList, ElfuPhdr) phdrList;
  CIRCLEQ_HEAD(OrphanScnList, ElfuScn) orphanScnList;

  ElfuScn *shstrtab;
} ElfuElf;

#endif