blob: 54176905e32bef857b7e12f481ed290caa9831f8 (
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
|
#pragma once
#include "elf_reader.h"
#include "cafe.h"
class cafe_loader {
elf_reader<elf32> *m_elf;
uint32 m_relocAddr;
uint32 m_externStart;
uint32 m_externEnd;
struct import {
uint32 addr;
uint32 orig;
const char *name;
};
std::vector<import> m_imports;
public:
cafe_loader(elf_reader<elf32> *elf);
void apply();
private:
void applySegments();
void applySegment(uint32 sel,
const char *data,
uint32 addr,
uint32 size,
const char *name,
const char *sclass,
uchar perm,
uchar align,
bool load);
void applyRelocations();
void processImports();
void processExports();
void swapSymbols();
void applySymbols();
};
|