summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShih-wei Liao <sliao@google.com>2012-03-24 13:18:46 -0700
committerShih-wei Liao <sliao@google.com>2012-03-26 21:12:15 -0700
commit8e5e9788d636f37d13d6c3f7b4050b18360f3141 (patch)
treea7256f3cc26ec4959119fc122b45719e58001c26
parent42d4d7385578e61333a7da5ddb399ba6944d129c (diff)
downloadart-8e5e9788d636f37d13d6c3f7b4050b18360f3141.zip
art-8e5e9788d636f37d13d6c3f7b4050b18360f3141.tar.gz
art-8e5e9788d636f37d13d6c3f7b4050b18360f3141.tar.bz2
Fix dalvik-dev build. Handle the case of no input dex.
(cherry picked from commit a5dd6bef562dd5bafdf84eb0f0a00703218f97b6) Change-Id: Ia003c972ead98d0affb32f13142ef2d3ba178857
-rw-r--r--src/oat_writer.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/oat_writer.cc b/src/oat_writer.cc
index df809d5..c69f619 100644
--- a/src/oat_writer.cc
+++ b/src/oat_writer.cc
@@ -115,12 +115,17 @@ size_t OatWriter::InitDexFiles(size_t offset) {
}
size_t OatWriter::InitOatElfImages(size_t offset) {
- // Offset to ELF image table should be rounded up to 4-byte aligned, so that
- // we can read the uint32_t directly.
- offset = RoundUp(offset, 4);
- oat_header_->SetElfImageTableOffset(offset);
+ size_t n = elf_images_.size();
+ if (n != 0) {
+ // Offset to ELF image table should be rounded up to 4-byte aligned, so that
+ // we can read the uint32_t directly.
+ offset = RoundUp(offset, 4);
+ oat_header_->SetElfImageTableOffset(offset);
+ } else {
+ oat_header_->SetElfImageTableOffset(0);
+ }
- for (size_t i = 0, n = elf_images_.size(); i < n; ++i) {
+ for (size_t i = 0; i < n; ++i) {
OatElfImage* oat_elf_image = new OatElfImage(elf_images_[i]);
oat_elf_images_.push_back(oat_elf_image);
offset += oat_elf_image->SizeOf();