summaryrefslogtreecommitdiff
path: root/src/base/loader/elf_object.cc
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2010-06-02 12:58:00 -0500
committerGabe Black <gblack@eecs.umich.edu>2010-06-02 12:58:00 -0500
commit3951afd2fa6140f85a94c9636ac2d9e9d3a1c764 (patch)
treec87b78c2a3e450fb5cbc4529e15446fb97b2571f /src/base/loader/elf_object.cc
parentebb273bb7b8a871c1c5c07e00593e0194985aa46 (diff)
downloadgem5-3951afd2fa6140f85a94c9636ac2d9e9d3a1c764.tar.xz
ARM: Detect thumb mode elf images.
Diffstat (limited to 'src/base/loader/elf_object.cc')
-rw-r--r--src/base/loader/elf_object.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/base/loader/elf_object.cc b/src/base/loader/elf_object.cc
index 60f0f99b4..6096cb2e3 100644
--- a/src/base/loader/elf_object.cc
+++ b/src/base/loader/elf_object.cc
@@ -34,6 +34,7 @@
#include "gelf.h"
+#include "base/bitfield.hh"
#include "base/loader/elf_object.hh"
#include "base/loader/symtab.hh"
#include "base/misc.hh"
@@ -96,7 +97,11 @@ ElfObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data)
} else if (ehdr.e_ident[EI_CLASS] == ELFCLASS64) {
arch = ObjectFile::Alpha;
} else if (ehdr.e_machine == EM_ARM) {
- arch = ObjectFile::Arm;
+ if (bits(ehdr.e_entry, 0)) {
+ arch = ObjectFile::Thumb;
+ } else {
+ arch = ObjectFile::Arm;
+ }
} else if (ehdr.e_machine == EM_PPC &&
ehdr.e_ident[EI_CLASS] == ELFCLASS32) {
if (ehdr.e_ident[EI_DATA] == ELFDATA2MSB) {