> 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:
tracer-ysyx 2024-03-20 14:56:26 +08:00 committed by xinyangli
parent 1b44697a67
commit 3cc2e29178

View file

@ -12,6 +12,11 @@ func_t *func_table = NULL;
int func_table_len = 0, func_table_size = 8;
#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) {
bool success = false;
FILE *elf_file = fopen(path, "rb");
@ -65,6 +70,7 @@ void init_elf(const char *path) {
Assert(func_table, "Function table exceed memory limit");
}
}
qsort(func_table, func_table_len, sizeof(func_t), cmp_func_t);
success = true;
failed:
for(int i = 0; i < func_table_len; i++) {