summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dex2oat/dex2oat.cc18
1 files changed, 17 insertions, 1 deletions
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 3e8adc01eb..e26fa7ff03 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -993,7 +993,18 @@ class Dex2Oat FINAL {
}
}
- char_backing_storage_.reserve((dex_locations_.size() - 1) * 2);
+ std::string base_symbol_oat;
+ if (!oat_unstripped_.empty()) {
+ base_symbol_oat = oat_unstripped_[0];
+ size_t last_symbol_oat_slash = base_symbol_oat.rfind('/');
+ if (last_symbol_oat_slash == std::string::npos) {
+ Usage("--multi-image used with unusable symbol filename %s", base_symbol_oat.c_str());
+ }
+ base_symbol_oat = base_symbol_oat.substr(0, last_symbol_oat_slash + 1);
+ }
+
+ const size_t num_expanded_files = 2 + (base_symbol_oat.empty() ? 0 : 1);
+ char_backing_storage_.reserve((dex_locations_.size() - 1) * num_expanded_files);
// Now create the other names. Use a counted loop to skip the first one.
for (size_t i = 1; i < dex_locations_.size(); ++i) {
@@ -1005,6 +1016,11 @@ class Dex2Oat FINAL {
std::string oat_name = CreateMultiImageName(dex_locations_[i], prefix, infix, ".oat");
char_backing_storage_.push_back(base_oat + oat_name);
oat_filenames_.push_back((char_backing_storage_.end() - 1)->c_str());
+
+ if (!base_symbol_oat.empty()) {
+ char_backing_storage_.push_back(base_symbol_oat + oat_name);
+ oat_unstripped_.push_back((char_backing_storage_.end() - 1)->c_str());
+ }
}
}