code-size.rst
changeset 279 061995ef35d2
equal deleted inserted replaced
278:a58e223b692f 279:061995ef35d2
       
     1 -*- mode: outline; coding: utf-8 -*-
       
     2 
       
     3 * Common.
       
     4 
       
     5 ** Configuration.
       
     6 
       
     7 Configure build with disabling unused features e.g.:
       
     8 
       
     9   $ ./configure --without-png
       
    10 
       
    11 ** Link dynamically.
       
    12 
       
    13 Link dynamically instead statically (on your platform shared library may be
       
    14 already present).
       
    15 
       
    16 ** Avoid debug build.
       
    17 
       
    18 Make release/final build instead debug.
       
    19 
       
    20 ** Packer.
       
    21 
       
    22 Use packers. Packer compress binary so binary smaller. When program load
       
    23 decompress itself, so startup time increase.
       
    24 
       
    25   http://upx.sourceforge.net
       
    26                 home page
       
    27 
       
    28 * GCC.
       
    29 
       
    30 Use -Os when produce *.o files.
       
    31 
       
    32 Use -s when produce executable.
       
    33 And "--remove-section=.comment and --remove-section=.note".
       
    34 
       
    35 Use:
       
    36 
       
    37   $ strip --strip-all <executable>
       
    38 
       
    39 and
       
    40 
       
    41   $ gcc -ffunction-sections -fdata-sections -c -o my.o my.c
       
    42   $ gcc -Wl,--gc-sections -o my my.o
       
    43 
       
    44 * MSVC.
       
    45 
       
    46 Use /Os when produce *.obj files.
       
    47