Commit 0bed59e4 authored by Peter Wen's avatar Peter Wen Committed by Commit Bot

Supersize: Include other .so files

Other .so files were being skipped since we assumed only a single .so
file would be in each apk. Now they are added as .other symbols.

Bug: 829464
Change-Id: If23e124caac6e2097891015a183b19bfc8687ed8
Reviewed-on: https://chromium-review.googlesource.com/998527Reviewed-by: default avataragrieve <agrieve@chromium.org>
Commit-Queue: Peter Wen <wnwen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#548533}
parent bb7e3b08
......@@ -808,15 +808,15 @@ def _ParseDexSymbols(section_sizes, apk_path, output_directory):
return symbols
def _ParseApkOtherSymbols(section_sizes, apk_path):
def _ParseApkOtherSymbols(section_sizes, apk_path, apk_so_path):
apk_name = os.path.basename(apk_path)
apk_symbols = []
zip_info_total = 0
with zipfile.ZipFile(apk_path) as z:
for zip_info in z.infolist():
zip_info_total += zip_info.compress_size
# Skip shared library, pak, and dex files as they are accounted for.
if (zip_info.filename.endswith('.so')
# Skip main shared library, pak, and dex files as they are accounted for.
if (zip_info.filename == apk_so_path
or zip_info.filename.endswith('.dex')
or zip_info.filename.endswith('.pak')):
continue
......@@ -937,7 +937,8 @@ def CreateSectionSizesAndSymbols(
section_sizes, metadata, apk_elf_result)
raw_symbols.extend(
_ParseDexSymbols(section_sizes, apk_path, output_directory))
raw_symbols.extend(_ParseApkOtherSymbols(section_sizes, apk_path))
raw_symbols.extend(
_ParseApkOtherSymbols(section_sizes, apk_path, apk_so_path))
elif pak_files and pak_info_file:
pak_symbols_by_id = _FindPakSymbolsFromFiles(
pak_files, pak_info_file, output_directory)
......
......@@ -43,6 +43,7 @@ _TEST_APK_PATH = os.path.join(_TEST_OUTPUT_DIR, 'test.apk')
# Generated file paths relative to apk
_TEST_APK_SO_PATH = 'test.so'
_TEST_APK_SMALL_SO_PATH = 'smalltest.so'
_TEST_APK_DEX_PATH = 'test.dex'
update_goldens = False
......@@ -133,6 +134,9 @@ class IntegrationTest(unittest.TestCase):
elf_file.write(IntegrationTest._CreateBlankData(27))
with zipfile.ZipFile(_TEST_APK_PATH, 'w') as apk_file:
apk_file.write(_TEST_ELF_PATH, _TEST_APK_SO_PATH)
# Exactly 8MB of data (2^23).
apk_file.writestr(
_TEST_APK_SMALL_SO_PATH, IntegrationTest._CreateBlankData(23))
pak_rel_path = os.path.relpath(_TEST_APK_PAK_PATH, _TEST_APK_ROOT_DIR)
apk_file.write(_TEST_APK_PAK_PATH, pak_rel_path)
# Exactly 8MB of data (2^23).
......
apk_file_name=test.apk
apk_size=142613786
apk_size=151002494
elf_arch=arm
elf_build_id=WhatAnAmazingBuildId
elf_file_name=elf
......@@ -42,8 +42,8 @@ Section .pak.translations: has 100.0% of 6821 bytes accounted for from 207 symbo
* Padding accounts for 0 bytes (0.0%)
* Contains 0 aliases
* 0 symbols have shared ownership
Section .other: has 100.0% of 33984483 bytes accounted for from 2 symbols. 0 bytes are unaccounted for.
* Padding accounts for 33984483 bytes (100.0%)
Section .other: has 100.0% of 42373191 bytes accounted for from 3 symbols. 0 bytes are unaccounted for.
* Padding accounts for 33984583 bytes (80.2%)
* Contains 0 aliases
* 0 symbols have shared ownership
.data@2de7000(size_without_padding=4,padding=0,full_name=google::protobuf::internal::pLinuxKernelCmpxchg,object_path=base/base/page_allocator.o,source_path=base/page_allocator.cc,flags={},num_aliases=1)
......@@ -254,7 +254,8 @@ Section .other: has 100.0% of 33984483 bytes accounted for from 2 symbols. 0 byt
.dex@0(size_without_padding=975347,padding=0,full_name=org.chromium,object_path=test.apk/prebuilt/org/chromium,source_path=,flags={gen},num_aliases=1)
.dex@0(size_without_padding=1792,padding=0,full_name=org,object_path=test.apk/prebuilt/org,source_path=,flags={gen},num_aliases=1)
.dex@0(size_without_padding=4616803,padding=0,full_name=* Unattributed Dex,object_path=test.apk/prebuilt,source_path=,flags={gen},num_aliases=1)
.other@0(size_without_padding=0,padding=312,full_name=Overhead: APK file,object_path=,source_path=,flags={},num_aliases=1)
.other@0(size_without_padding=8388608,padding=0,full_name=smalltest.so,object_path=test.apk/other/smalltest.so,source_path=,flags={},num_aliases=1)
.other@0(size_without_padding=0,padding=412,full_name=Overhead: APK file,object_path=,source_path=,flags={},num_aliases=1)
.other@0(size_without_padding=0,padding=33984171,full_name=Overhead: ELF file,object_path=,source_path=,flags={},num_aliases=1)
.rodata@266e600(size_without_padding=5,padding=0,full_name=string literal,object_path=base/base/page_allocator.o,source_path=base/page_allocator.cc,flags={},num_aliases=2)
.rodata@266e600(size_without_padding=5,padding=0,full_name=string literal,object_path=third_party/icu/icuuc/ucnv_ext.o,source_path=third_party/icu/ucnv_ext.c,flags={gen},num_aliases=2)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment