aboutsummaryrefslogtreecommitdiff
path: root/pk/elf.c
diff options
context:
space:
mode:
Diffstat (limited to 'pk/elf.c')
-rw-r--r--pk/elf.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/pk/elf.c b/pk/elf.c
index f5da5a6..5f7210c 100644
--- a/pk/elf.c
+++ b/pk/elf.c
@@ -84,15 +84,20 @@ void load_elf(const char* fn, elf_info* info)
} \
} while(0)
- info->elf64 = IS_ELF64(eh64);
- if (info->elf64)
+ if (IS_ELF64(eh64))
{
+#ifndef __riscv64
+ panic("can't run 64-bit ELF on 32-bit arch");
+#endif
Elf64_Ehdr* eh;
Elf64_Phdr* ph;
LOAD_ELF;
}
else if (IS_ELF32(eh64))
{
+#ifdef __riscv64
+ panic("can't run 32-bit ELF on 64-bit arch");
+#endif
Elf32_Ehdr* eh;
Elf32_Phdr* ph;
LOAD_ELF;