-
Notifications
You must be signed in to change notification settings - Fork 0
/
ElfHeaders.h
72 lines (63 loc) · 1.4 KB
/
ElfHeaders.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
68
69
70
71
72
#pragma once
#pragma pack(push)
#pragma pack(1)
struct elf_header {
struct {
unsigned int mMagic;
unsigned char mClass;
unsigned char mData;
unsigned char mVersion;
unsigned char mPadding[9];
} mIdent;
unsigned short mType;
unsigned short mMachine;
unsigned int mVersion;
unsigned int mEntryPoint;
unsigned int mPHOffset;
unsigned int mSHOffset;
unsigned int mFlags;
unsigned short mEHSize;
unsigned short mPHEntrySize;
unsigned short mPHEntryCount;
unsigned short mSHEntrySize;
unsigned short mSHEntryCount;
unsigned short mSHStringIndex;//String Table
static const int MAGIC = 0x464C457F;
};
struct elf_programheader {
unsigned int mType;
long mOffset;
unsigned int mVAddress;
unsigned int mPAddress;
unsigned int mFileSize;
unsigned int mMemorySize;
unsigned int mFlags;
unsigned int mAlign;
};
enum elf_sectionheader_type {
SHT_NULL = 0x00000000,
SHT_PROGBITS = 0x00000001,
SHT_STRTAB = 0x00000003,
SHT_NOBITS = 0x00000008,
SHT_PRXREL = 0x700000A0,
};
struct elf_sectionheader {
unsigned int mName;
unsigned int mType;
unsigned int mFlags;
unsigned int mAddress;
unsigned int mOffset;
unsigned int mSize;
unsigned int mLink;
unsigned int mInfo;
unsigned int mAddressAlign;
unsigned int mEntrySize;
};
struct elf_relocation {
unsigned int mOffset;
unsigned char mType;
unsigned char mOffsetBase;
unsigned char mAddrBase;
unsigned char mUnknown;
};
#pragma pack(pop)