aboutsummaryrefslogtreecommitdiff
path: root/pk/elf.c
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2013-03-25 16:50:22 -0700
committerAndrew Waterman <waterman@cs.berkeley.edu>2013-03-25 16:50:22 -0700
commit5ba0377b291ceb5d1e96674831cb6fd15eebf980 (patch)
tree09a12c1edac6ace9585ef18882808f3296f4f144 /pk/elf.c
parent1cc5f32ea1bee3d7bce14d064651ea417a68e148 (diff)
downloadriscv-pk-5ba0377b291ceb5d1e96674831cb6fd15eebf980.zip
riscv-pk-5ba0377b291ceb5d1e96674831cb6fd15eebf980.tar.gz
riscv-pk-5ba0377b291ceb5d1e96674831cb6fd15eebf980.tar.bz2
add clean-room elf.h to avoid GPL entanglement
Diffstat (limited to 'pk/elf.c')
-rw-r--r--pk/elf.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/pk/elf.c b/pk/elf.c
index ca44645..7365779 100644
--- a/pk/elf.c
+++ b/pk/elf.c
@@ -43,15 +43,17 @@ long load_elf(const char* fn, int* user64)
} while(0)
long entry;
- if(eh64->e_ident[EI_CLASS] == ELFCLASS32)
+ *user64 = 0;
+ if (IS_ELF32(*eh64))
{
Elf32_Ehdr* eh;
Elf32_Phdr* ph;
LOAD_ELF;
entry = eh->e_entry;
}
- else if(eh64->e_ident[EI_CLASS] == ELFCLASS64)
+ else if (IS_ELF64(*eh64))
{
+ *user64 = 1;
Elf64_Ehdr* eh;
Elf64_Phdr* ph;
LOAD_ELF;
@@ -60,8 +62,6 @@ long load_elf(const char* fn, int* user64)
else
goto fail;
- *user64 = eh64->e_ident[EI_CLASS] == ELFCLASS64;
-
file_decref(file);
return entry;