#include "gelf.h"
+#include "base/bitfield.hh"
#include "base/loader/elf_object.hh"
#include "base/loader/symtab.hh"
#include "base/misc.hh"
} 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) {
fatal("Unknown/unsupported operating system.");
}
#elif THE_ISA == ARM_ISA
- if (objFile->getArch() != ObjectFile::Arm)
+ if (objFile->getArch() != ObjectFile::Arm &&
+ objFile->getArch() != ObjectFile::Thumb)
fatal("Object file architecture does not match compiled ISA (ARM).");
switch (objFile->getOpSys()) {
case ObjectFile::UnknownOpSys:
warn("Unknown operating system; assuming Linux.");
// fall through
case ObjectFile::Linux:
- process = new ArmLinuxProcess(params, objFile);
+ if (objFile->getArch() == ObjectFile::Thumb)
+ panic("Thumb processes not yet supported.\n");
+ else
+ process = new ArmLinuxProcess(params, objFile);
break;
case ObjectFile::LinuxArmOABI:
fatal("M5 does not support ARM OABI binaries. Please recompile with an"