I'm debugging a dynamic shared library in linux, the name of the library is libMNN.so
.
Here is the size of all sections of libMNN.so
got by size -A ./libMNN.so
:
section size addr
.note.gnu.build-id 36 512
.hash 2288 552
.dynsym 7368 2840
.dynstr 11637 10208
.gnu.version 614 21846
.gnu.version_r 64 22464
.rela.dyn 78720 22528
.rela.plt 3960 101248
.plt 2672 105216
.text 804416 107904
.rodata 17772 912320
.eh_frame_hdr 21460 930092
.eh_frame 79160 951552
.note.android.ident 152 1030712
.init_array 1400 1097864
.fini_array 16 1099264
.data.rel.ro 33232 1099280
.dynamic 560 1132512
.got 1512 1133072
.data 8 1134592
.bss 392 1134608
.comment 100 0
Total 1067539
We can see that the size of ".text" is 804416 and the size of ".rodata" is 17772.
Here is the sum of symbol size got by command readelf -D -sW ./libMNN.so | awk '{print $4}' | awk '{s+=$1} END {print s}'
:
79000
The sum of symbol size is much less than ".text" and ".rodata", why?
libMNN.so can be downloaded from https://github.com/alibaba/MNN/releases/download/1.0.0/Android.zip
LibMNN
does not export static, internal and inline functions (by setting their visibility to "hidden") so you do not see symbols for them. Some more space is wasted due to symbol alignments and literal pools (which are stored in .text
on ARM).