diff options
author | Andrew Waterman <andrew@sifive.com> | 2020-01-25 20:29:50 -0800 |
---|---|---|
committer | Chih-Min Chao <chihmin.chao@sifive.com> | 2020-02-12 23:08:01 -0800 |
commit | a5de8578b903c6502c52a7f2633d3a98f92ee3b6 (patch) | |
tree | a1629cdc4cbb91ad6c50af85e5afc2ca36eddd8b /fesvr | |
parent | 0dc2193e6f7ba34a528086ed724d13f9a7526251 (diff) | |
download | spike-a5de8578b903c6502c52a7f2633d3a98f92ee3b6.zip spike-a5de8578b903c6502c52a7f2633d3a98f92ee3b6.tar.gz spike-a5de8578b903c6502c52a7f2633d3a98f92ee3b6.tar.bz2 |
Allow EM_NONE ELFs, too
Diffstat (limited to 'fesvr')
-rw-r--r-- | fesvr/elf.h | 2 | ||||
-rw-r--r-- | fesvr/elfloader.cc | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/fesvr/elf.h b/fesvr/elf.h index c791685..a213832 100644 --- a/fesvr/elf.h +++ b/fesvr/elf.h @@ -7,6 +7,7 @@ #define ET_EXEC 2 #define EM_RISCV 243 +#define EM_NONE 0 #define EV_CURRENT 1 #define IS_ELF(hdr) \ @@ -19,6 +20,7 @@ #define IS_ELFBE(hdr) (IS_ELF(hdr) && (hdr).e_ident[5] == 2) #define IS_ELF_EXEC(hdr) (IS_ELF(hdr) && (hdr).e_type == ET_EXEC) #define IS_ELF_RISCV(hdr) (IS_ELF(hdr) && (hdr).e_machine == EM_RISCV) +#define IS_ELF_EM_NONE(hdr) (IS_ELF(hdr) && (hdr).e_machine == EM_NONE) #define IS_ELF_VCURRENT(hdr) (IS_ELF(hdr) && (hdr).e_version == EV_CURRENT) #define PT_LOAD 1 diff --git a/fesvr/elfloader.cc b/fesvr/elfloader.cc index fe0fbf0..a4bae1e 100644 --- a/fesvr/elfloader.cc +++ b/fesvr/elfloader.cc @@ -33,7 +33,7 @@ std::map<std::string, uint64_t> load_elf(const char* fn, memif_t* memif, reg_t* assert(IS_ELF32(*eh64) || IS_ELF64(*eh64)); assert(IS_ELFLE(*eh64)); assert(IS_ELF_EXEC(*eh64)); - assert(IS_ELF_RISCV(*eh64)); + assert(IS_ELF_RISCV(*eh64) || IS_ELF_EM_NONE(*eh64)); assert(IS_ELF_VCURRENT(*eh64)); std::vector<uint8_t> zeros; |