summaryrefslogtreecommitdiffstats
path: root/patchoat
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2014-08-19 17:28:06 -0700
committerAndreas Gampe <agampe@google.com>2014-08-20 15:25:48 -0700
commit20c89303a9d89ba857bf969ad14a31f12c3be878 (patch)
treeb7072ce69f3c6896e70e84cfb7ae1058e7e7a55f /patchoat
parent192da5675b2e219f26a107bd7b60c755cd46ba74 (diff)
downloadart-20c89303a9d89ba857bf969ad14a31f12c3be878.zip
art-20c89303a9d89ba857bf969ad14a31f12c3be878.tar.gz
art-20c89303a9d89ba857bf969ad14a31f12c3be878.tar.bz2
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
Diffstat (limited to 'patchoat')
-rw-r--r--patchoat/patchoat.cc16
1 files changed, 3 insertions, 13 deletions
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 @@ static int patchoat(int argc, char **argv) {
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) {