-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathprogram.h
97 lines (80 loc) · 1.54 KB
/
program.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
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 RUNTIME_H
#define RUNTIME_H
#include "types.h"
static void
program_init(
Allocator *allocator,
Program *program,
Os os
);
static void
program_deinit(
Program *program
);
static inline void
program_resolve_label(
Program *program,
Virtual_Memory_Buffer *buffer,
Label *label
);
static void
program_set_label_offset(
Program *program,
Label *label,
u32 offset_in_section
);
static inline u32
program_resolve_label_to_rva(
const Program *program,
const Label *label
) {
return label->section->base_rva + label->offset_in_section;
}
static void
program_patch_labels(
Program *program
);
static Import_Library *
program_find_import_library(
const Program *program,
const Slice library_name
);
static Import_Symbol *
import_library_find_symbol(
const Import_Library *library,
const Slice symbol_name
);
static Import_Symbol *
program_find_import(
const Program *program,
const Slice library_name,
const Slice symbol_name
);
static Storage
import_symbol(
const Allocator *allocator,
Program *program,
const Slice library_name,
const Slice symbol_name
);
static void
program_jit(
Mass_Context *context,
Jit *jit
);
typedef struct {
void *(*load_library)(const char *name);
void *(*load_symbol)(void *handle, const char *name);
} Native_Library_Load_Callbacks;
static void
program_jit_imports(
Compilation *compilation,
Jit *jit,
Virtual_Memory_Buffer *ro_data_buffer,
const Native_Library_Load_Callbacks *callbacks
);
static void
program_jit_resolve_relocations(
Jit *jit
);
#endif // RUNTIME_H