> 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
 00:40:48  up  10:16,  2 users,  load average: 0.51, 0.62, 0.58
This commit is contained in:
tracer-ysyx 2024-03-17 00:40:48 +08:00 committed by xinyangli
parent 39f0f75bf4
commit a20136aec5

View file

@ -10,6 +10,7 @@
#define FAILED_GOTO(tag, exp) do {if((exp)) goto tag;} while(0)
void init_elf(const char *path) {
bool success = false;
FILE *elf_file = fopen(path, "rb");
Elf32_Ehdr header;
Elf32_Shdr section_header[200], *psh;
@ -49,12 +50,12 @@ void init_elf(const char *path) {
FAILED_GOTO(failed, fgets(func, 30, elf_file) <= 0);
puts(func);
}
free(sym);
return;
success = true;
failed:
free(sym);
failed_shstrtab:
free(shstrtab);
failed_nosym:
Error("Failed reading elf file");
if(success) return;
else Error("Failed reading elf file");
}