> 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:
parent
39f0f75bf4
commit
a20136aec5
1 changed files with 4 additions and 3 deletions
|
@ -10,6 +10,7 @@
|
||||||
#define FAILED_GOTO(tag, exp) do {if((exp)) goto tag;} while(0)
|
#define FAILED_GOTO(tag, exp) do {if((exp)) goto tag;} while(0)
|
||||||
|
|
||||||
void init_elf(const char *path) {
|
void init_elf(const char *path) {
|
||||||
|
bool success = false;
|
||||||
FILE *elf_file = fopen(path, "rb");
|
FILE *elf_file = fopen(path, "rb");
|
||||||
Elf32_Ehdr header;
|
Elf32_Ehdr header;
|
||||||
Elf32_Shdr section_header[200], *psh;
|
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);
|
FAILED_GOTO(failed, fgets(func, 30, elf_file) <= 0);
|
||||||
puts(func);
|
puts(func);
|
||||||
}
|
}
|
||||||
free(sym);
|
success = true;
|
||||||
return;
|
|
||||||
failed:
|
failed:
|
||||||
free(sym);
|
free(sym);
|
||||||
failed_shstrtab:
|
failed_shstrtab:
|
||||||
free(shstrtab);
|
free(shstrtab);
|
||||||
failed_nosym:
|
failed_nosym:
|
||||||
Error("Failed reading elf file");
|
if(success) return;
|
||||||
|
else Error("Failed reading elf file");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue