ART: Relax GetInstructionSetFromString
Do not abort on an unknown instruction set string. Instead return
kNone and let the caller handle this.
Also simplify the patchoat tool to use this.
Bug: 17136416
(cherry picked from commit aabbb2066a715b3fd8e752291f74c6d77b970450)
Change-Id: I24131914bcf91c04ae93179bf809a2907f1f2b7a
diff --git a/runtime/instruction_set.cc b/runtime/instruction_set.cc
index d8a38f4..644e055 100644
--- a/runtime/instruction_set.cc
+++ b/runtime/instruction_set.cc
@@ -42,21 +42,18 @@
InstructionSet GetInstructionSetFromString(const char* isa_str) {
CHECK(isa_str != nullptr);
- if (!strcmp("arm", isa_str)) {
+ if (strcmp("arm", isa_str) == 0) {
return kArm;
- } else if (!strcmp("arm64", isa_str)) {
+ } else if (strcmp("arm64", isa_str) == 0) {
return kArm64;
- } else if (!strcmp("x86", isa_str)) {
+ } else if (strcmp("x86", isa_str) == 0) {
return kX86;
- } else if (!strcmp("x86_64", isa_str)) {
+ } else if (strcmp("x86_64", isa_str) == 0) {
return kX86_64;
- } else if (!strcmp("mips", isa_str)) {
+ } else if (strcmp("mips", isa_str) == 0) {
return kMips;
- } else if (!strcmp("none", isa_str)) {
- return kNone;
}
- LOG(FATAL) << "Unknown ISA " << isa_str;
return kNone;
}