google / bloaty

Bloaty: a size profiler for binaries

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"-d inlines" no longer works on Android shared library

jrose-signal opened this issue · comments

The attached library (built from a private branch of signalapp/libsignal) does not show any source information for bloaty -d inlines. I traced this regression to #280 via git bisect, which in retrospect isn't so surprising.

It seems to me this issue may be rephrased as "-d inlines no longer works for ELF" regardless of Android. The commit mentioned in issue breaks output of -d inlines even on the test file used by one of the tests:

Output of commit before (bc595880708195d059b9fc2650ec4c245c079070d):

$ ./bloaty -d inlines ../source/tests/testdata/misc/03-small-binary-that-crashed-inlines.bin  -n 0
    FILE SIZE        VM SIZE
 --------------  --------------
  14.4%  1.78Ki   0.0%       0    [Unmapped]
  12.8%  1.59Ki   0.0%       0    [section .symtab]
   9.6%  1.19Ki   0.0%       0    [section .debug_info]
   6.1%     778   0.0%       0    [section .debug_str]
   5.7%     728   0.0%       0    [section .debug_loc]
   4.9%     624   0.0%       0    [section .debug_line]
   4.1%     524   0.0%       0    [section .debug_abbrev]
   4.0%     512  19.1%     448    [section .dynamic]
   3.8%     482   0.0%       0    [section .strtab]
   3.0%     379   0.0%       0    [section .shstrtab]
   2.9%     368   0.0%       0    [section .debug_aranges]
   2.5%     320   0.0%       0    [ELF Headers]
   2.2%     276   9.1%     212    [section .eh_frame]
   1.9%     240   0.0%       0    [section .debug_ranges]
   1.8%     223   9.5%     223    [section .text]
   1.3%     159   4.1%      95    [section .dynstr]
   1.2%     152   6.5%     152    [LOAD #2 [RX]]
   1.2%     146   0.0%       0    [section .comment]
   1.1%     136   3.1%      72    [section .dynsym]
   0.9%     120   5.1%     120    elf-init.c:88
   0.9%     112   2.1%      48    [section .rela.dyn]
   0.9%     108   1.9%      44    [section .eh_frame_hdr]
   0.8%     104   4.4%     104    elf-init.c:87
   0.8%      96   1.4%      32    [section .gnu.version_r]
   0.8%      96   1.4%      32    [section .note.ABI-tag]
   0.7%      92   1.2%      28    [section .interp]
   0.7%      88   1.0%      24    [section .got.plt]
   0.7%      88   1.0%      24    [section .hash]
   0.6%      80   0.7%      16    [section .data]
   0.6%      80   0.7%      16    [section .got]
   0.6%      72   0.3%       8    [section .fini_array]
   0.6%      72   0.3%       8    [section .init_array]
   0.6%      70   0.3%       6    [section .gnu.version]
   0.5%      64   0.0%       0    [section .rodata]
   0.4%      56   2.4%      56    [LOAD #0 [RX]]
   0.4%      56   2.4%      56    [LOAD #1 [R]]
   0.4%      56   2.4%      56    [LOAD #3 [RW]]
   0.4%      56   2.4%      56    [LOAD #4 [RW]]
   0.4%      56   2.4%      56    [LOAD #5 [R]]
   0.4%      56   2.4%      56    [LOAD #6 [R]]
   0.4%      56   2.4%      56    [LOAD #7 [RW]]
   0.4%      56   2.4%      56    [LOAD #8 [R]]
   0.2%      22   0.9%      22    <stdin>:1
   0.2%      22   0.9%      22    elf-init.c:68
   0.2%      20   0.9%      20    elf-init.c:89
   0.1%      17   0.7%      17    elf-init.c:86
   0.1%       8   0.3%       8    ../sysdeps/x86_64/crtn.S:45
   0.0%       0   0.3%       8    [section .bss]
   0.1%       7   0.3%       7    ../sysdeps/x86_64/crti.S:66
   0.1%       7   0.3%       7    ../sysdeps/x86_64/start.S:107
   0.1%       7   0.3%       7    ../sysdeps/x86_64/start.S:108
   0.1%       7   0.3%       7    ../sysdeps/x86_64/start.S:110
   0.0%       6   0.3%       6    ../sysdeps/x86_64/start.S:120
   0.0%       5   0.2%       5    elf-init.c:83
   0.0%       4   0.2%       4    ../sysdeps/x86_64/crti.S:64
   0.0%       4   0.2%       4    ../sysdeps/x86_64/crti.S:80
   0.0%       4   0.2%       4    ../sysdeps/x86_64/crtn.S:40
   0.0%       4   0.2%       4    ../sysdeps/x86_64/crtn.S:44
   0.0%       4   0.2%       4    ../sysdeps/x86_64/start.S:90
   0.0%       4   0.2%       4    elf-init.c:106
   0.0%       3   0.1%       3    ../sysdeps/x86_64/crti.S:67
   0.0%       3   0.1%       3    ../sysdeps/x86_64/start.S:79
   0.0%       3   0.1%       3    ../sysdeps/x86_64/start.S:88
   0.0%       2   0.1%       2    ../sysdeps/x86_64/crti.S:68
   0.0%       2   0.1%       2    ../sysdeps/x86_64/crti.S:69
   0.0%       2   0.1%       2    ../sysdeps/x86_64/start.S:63
   0.0%       1   0.0%       1    ../sysdeps/x86_64/crtn.S:41
   0.0%       1   0.0%       1    ../sysdeps/x86_64/start.S:122
   0.0%       1   0.0%       1    ../sysdeps/x86_64/start.S:85
   0.0%       1   0.0%       1    ../sysdeps/x86_64/start.S:93
   0.0%       1   0.0%       1    ../sysdeps/x86_64/start.S:97
 100.0%  12.4Ki 100.0%  2.29Ki    TOTAL

Output of commit after (90bac14):

$ ./bloaty -d inlines ../source/tests/testdata/misc/03-small-binary-that-crashed-inlines.bin  -n 0
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  14.4%  1.78Ki   0.0%       0    [Unmapped]
  12.8%  1.59Ki   0.0%       0    [section .symtab]
   9.6%  1.19Ki   0.0%       0    [section .debug_info]
   6.1%     778   0.0%       0    [section .debug_str]
   5.7%     728   0.0%       0    [section .debug_loc]
   5.1%     642  24.7%     578    [section .text]
   4.9%     624   0.0%       0    [section .debug_line]
   4.1%     524   0.0%       0    [section .debug_abbrev]
   4.0%     512  19.1%     448    [section .dynamic]
   3.8%     482   0.0%       0    [section .strtab]
   3.0%     379   0.0%       0    [section .shstrtab]
   2.9%     368   0.0%       0    [section .debug_aranges]
   2.2%     276   9.1%     212    [section .eh_frame]
   1.9%     240   0.0%       0    [section .debug_ranges]
   1.3%     159   4.1%      95    [section .dynstr]
   1.2%     157   6.7%     157    [LOAD #2 [RX]]
   1.2%     146   0.0%       0    [section .comment]
   1.1%     136   3.1%      72    [section .dynsym]
   1.0%     128   0.0%       0    [ELF Headers]
   0.9%     112   2.1%      48    [section .rela.dyn]
   0.9%     108   1.9%      44    [section .eh_frame_hdr]
   0.8%      96   1.4%      32    [section .gnu.version_r]
   0.8%      96   1.4%      32    [section .note.ABI-tag]
   0.7%      92   1.2%      28    [section .interp]
   0.7%      88   1.0%      24    [section .got.plt]
   0.7%      88   1.0%      24    [section .hash]
   0.7%      87   1.0%      23    [section .init]
   0.6%      80   0.7%      16    [section .data]
   0.6%      80   0.7%      16    [section .got]
   0.6%      73   0.4%       9    [section .fini]
   0.6%      72   0.3%       8    [section .fini_array]
   0.6%      72   0.3%       8    [section .init_array]
   0.6%      70   0.3%       6    [section .gnu.version]
   0.5%      68   0.2%       4    [section .rodata]
   0.4%      56   2.4%      56    [LOAD #0 [RX]]
   0.4%      56   2.4%      56    [LOAD #1 [R]]
   0.4%      56   2.4%      56    [LOAD #3 [RW]]
   0.4%      56   2.4%      56    [LOAD #4 [RW]]
   0.4%      56   2.4%      56    [LOAD #5 [R]]
   0.4%      56   2.4%      56    [LOAD #6 [R]]
   0.4%      56   2.4%      56    [LOAD #7 [RW]]
   0.4%      56   2.4%      56    [LOAD #8 [R]]
   0.0%       0   0.3%       8    [section .bss]
 100.0%  12.4Ki 100.0%  2.29Ki    TOTAL

@haberman, mind having a look? This seems like a quite significant breaking change.

I would also suggest improving one of the tests so that it asserts something like non-zero total file size over all entries corresponding to inlines.