> compile NEMU
ysyx_22040000 李心杨 Linux calcite 6.6.19 #1-NixOS SMP PREEMPT_DYNAMIC Fri Mar 1 12:35:11 UTC 2024 x86_64 GNU/Linux 14:56:26 up 2:02, 2 users, load average: 0.65, 0.59, 0.65
This commit is contained in:
parent
1b44697a67
commit
3cc2e29178
1 changed files with 6 additions and 0 deletions
|
@ -12,6 +12,11 @@ func_t *func_table = NULL;
|
||||||
int func_table_len = 0, func_table_size = 8;
|
int func_table_len = 0, func_table_size = 8;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static int cmp_func_t(const void *a, const void *b) {
|
||||||
|
|
||||||
|
return ((func_t *)a)->start > ((func_t *)b)->start;
|
||||||
|
}
|
||||||
|
|
||||||
void init_elf(const char *path) {
|
void init_elf(const char *path) {
|
||||||
bool success = false;
|
bool success = false;
|
||||||
FILE *elf_file = fopen(path, "rb");
|
FILE *elf_file = fopen(path, "rb");
|
||||||
|
@ -65,6 +70,7 @@ void init_elf(const char *path) {
|
||||||
Assert(func_table, "Function table exceed memory limit");
|
Assert(func_table, "Function table exceed memory limit");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
qsort(func_table, func_table_len, sizeof(func_t), cmp_func_t);
|
||||||
success = true;
|
success = true;
|
||||||
failed:
|
failed:
|
||||||
for(int i = 0; i < func_table_len; i++) {
|
for(int i = 0; i < func_table_len; i++) {
|
||||||
|
|
Loading…
Reference in a new issue