Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What is all the weight in that "touch" binary? It can't be code. My guess would be that the format is just not optimized for size and contains a bunch of boilerplate records whose minimum size is in the kilobytes.


I just ran Bloaty (https://github.com/google/bloaty) on /usr/bin/touch from Catalina, and I got this:

    $ bloaty `which touch` -d segments,sections --domain=file
       FILE SIZE
    ---------------
     55.1%  19.6Ki    __LINKEDIT
       91.7%  18.0Ki    Code Signature
        2.7%     544    Symbol Table
        1.9%     376    Lazy Binding Info
        1.6%     328    String Table
        1.2%     232    Indirect Symbol Table
        0.6%     112    Binding Info
        0.2%      32    Export Info
        0.1%      24    Function Start Addresses
        0.0%       8    Rebase Info
        0.0%       8    Table of Non-instructions
        0.0%       0    [__LINKEDIT]
     22.2%  7.90Ki    __TEXT
       35.0%  2.77Ki    __TEXT,__text
       33.6%  2.65Ki    [__TEXT]
       17.2%  1.36Ki    [Mach-O Headers]
        4.2%     339    __TEXT,__cstring
        3.4%     274    __TEXT,__const
        3.3%     266    __TEXT,__stub_helper
        1.9%     150    __TEXT,__stubs
        1.5%     120    __TEXT,__unwind_info
     11.2%  4.00Ki    __DATA
       94.9%  3.80Ki    [__DATA]
        4.9%     200    __DATA,__la_symbol_ptr
        0.2%       8    __DATA,__data
     11.2%  4.00Ki    __DATA_CONST
       98.4%  3.94Ki    [__DATA_CONST]
        1.6%      64    __DATA_CONST,__got
      0.3%     104    [Mach-O Headers]
    100.0%  35.6Ki    TOTAL
So 2.77Ki of actual code in "__TEXT,__text".

Those [__TEXT], [__DATA], and [__DATA_CONST] sections are the part that is lost to padding, so 10.4Ki or so.

Disclosure: I am the author of Bloaty.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: