diff options
author | Andreas Gampe <agampe@google.com> | 2015-01-21 22:25:24 -0800 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2015-01-21 22:25:24 -0800 |
commit | 6f6114140fbc09c5c7bec441922412635a7f7ff1 (patch) | |
tree | 4da7b68fddff767b668ffc4faeadb632ae310165 /patchoat | |
parent | 3cfbb4aff30f32e49b3b57c7483ee0b5cb580e7b (diff) | |
download | art-6f6114140fbc09c5c7bec441922412635a7f7ff1.zip art-6f6114140fbc09c5c7bec441922412635a7f7ff1.tar.gz art-6f6114140fbc09c5c7bec441922412635a7f7ff1.tar.bz2 |
ART: Refactor common ELF->InstructionSet code
Move code into instruction_set.h/cc.
Change-Id: I34d5c82791042c68629df84e0f4b9321231d51b9
Diffstat (limited to 'patchoat')
-rw-r--r-- | patchoat/patchoat.cc | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/patchoat/patchoat.cc b/patchoat/patchoat.cc index 6c86c7b..2059a96 100644 --- a/patchoat/patchoat.cc +++ b/patchoat/patchoat.cc @@ -48,30 +48,6 @@ namespace art { -static InstructionSet ElfISAToInstructionSet(Elf32_Word isa, Elf32_Word e_flags) { - switch (isa) { - case EM_ARM: - return kArm; - case EM_AARCH64: - return kArm64; - case EM_386: - return kX86; - case EM_X86_64: - return kX86_64; - case EM_MIPS: - if (((e_flags & EF_MIPS_ARCH) == EF_MIPS_ARCH_32R2) || - ((e_flags & EF_MIPS_ARCH) == EF_MIPS_ARCH_32R6)) { - return kMips; - } else if ((e_flags & EF_MIPS_ARCH) == EF_MIPS_ARCH_64R6) { - return kMips64; - } else { - return kNone; - } - default: - return kNone; - } -} - static bool LocationToFilename(const std::string& location, InstructionSet isa, std::string* filename) { bool has_system = false; @@ -219,7 +195,7 @@ bool PatchOat::Patch(File* input_oat, const std::string& image_location, off_t d LOG(ERROR) << "unable to read elf header"; return false; } - isa = ElfISAToInstructionSet(elf_hdr.e_machine, elf_hdr.e_flags); + isa = GetInstructionSetFromELF(elf_hdr.e_machine, elf_hdr.e_flags); } const char* isa_name = GetInstructionSetString(isa); std::string image_filename; |