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/patchoat/patchoat.cc b/patchoat/patchoat.cc
index 72ad9a5..bbdf3a3 100644
--- a/patchoat/patchoat.cc
+++ b/patchoat/patchoat.cc
@@ -823,22 +823,12 @@
if (log_options) {
LOG(INFO) << "patchoat: option[" << i << "]=" << argv[i];
}
- // TODO: GetInstructionSetFromString shouldn't LOG(FATAL).
if (option.starts_with("--instruction-set=")) {
isa_set = true;
const char* isa_str = option.substr(strlen("--instruction-set=")).data();
- if (!strcmp("arm", isa_str)) {
- isa = kArm;
- } else if (!strcmp("arm64", isa_str)) {
- isa = kArm64;
- } else if (!strcmp("x86", isa_str)) {
- isa = kX86;
- } else if (!strcmp("x86_64", isa_str)) {
- isa = kX86_64;
- } else if (!strcmp("mips", isa_str)) {
- isa = kMips;
- } else {
- Usage("Unknown instruction set %s", isa_str);
+ isa = GetInstructionSetFromString(isa_str);
+ if (isa == kNone) {
+ Usage("Unknown or invalid instruction set %s", isa_str);
}
} else if (option.starts_with("--input-oat-location=")) {
if (have_input_oat) {