Running nm --size-sort --reverse-sort --radix=d lib.unstripped/libchrome.so
reveals that one of the largest symbols is:
00146178 r i18n::phonenumbers::(anonymous namespace)::data
It turns out that this is an embedded proto file, which is parsed the first time that it's needed.
Since it's just data that is being parsed, there's no benefit to storing it in the .so uncompressed (that I can think of anyways).
In terms of implementing this, we could:
a) Add an option to have the file passed into the library rather than hardcoded as static data
b) Keep it as static data, but compress it
Having the file passed in might have the advantage of smaller patch sizes (speculation)
I tested its compressed size as follows:
cd third_party/libphonenumber/dist/cpp/src/phonenumbers
gcc -fpic -shared -I.. metadata.cc
objdump -h a.out | grep .rodata | awk '{print "dd if='a.out' of='b.out' bs=1 count=$[0x" $3 "] skip=$[0x" $6 "]"}' | bash
gzip < b.out > b.out.gz
../../../../../../out-gn/Release/clang_x64/bro --input b.out --output b.out.bro
zopfli -c b.out > b.out.zop
ls -l b.out*
-rw-r--r-- 1 agrieve eng 158219 Feb 3 21:29 b.out
-rw-r--r-- 1 agrieve eng 43665 Feb 3 21:41 b.out.gz
-rw-r--r-- 1 agrieve eng 41404 Feb 3 21:44 b.out.zop
-rw-r--r-- 1 agrieve eng 37027 Feb 3 21:29 b.out.bro
Comment 1 by benhenry@chromium.org
, Feb 13 2017