[lkml]   [2006]   [Aug]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Subject[PATCH 0/4] Compile kernel with -fwhole-program --combine
    If you are compiling multiple source files, this option tells the
    driver to pass all the source files to the compiler at once (for
    those languages for which the compiler can handle this). This
    will allow intermodule analysis (IMA) to be performed by the
    compiler. Currently the only language for which this is supported
    is C. If you pass source files for multiple languages to the
    driver, using this option, the driver will invoke the compiler(s)
    that support IMA once each, passing each compiler all the source
    files appropriate for it. For those languages that do not support
    IMA this option will be ignored, and the compiler will be invoked
    once for each source file in that language. If you use this
    option in conjunction with `-save-temps', the compiler will
    generate multiple pre-processed files (one for each source file),
    but only one (combined) `.o' or `.s' file.

    Assume that the current compilation unit represents whole program
    being compiled. All public functions and variables with the
    exception of `main' and those merged by attribute
    `externally_visible' become static functions and in a affect gets
    more aggressively optimized by interprocedural optimizers. While
    this option is equivalent to proper use of `static' keyword for
    programs consisting of single file, in combination with option
    `--combine' this flag can be used to compile most of smaller scale
    C programs since the functions and variables become local for the
    whole combined compilation unit, not for the single source file

    Using a combination of these two compiler options for building kernel
    code leads to some useful optimisation -- especially with modules which
    are made up of a bunch of incestuous C files, where none of the global
    symbols actually _need_ to be visible outside the directory they reside
    in. File systems are a prime example of this -- on PPC64 I see a
    reduction in size of ext3.ko by 2.6%, jffs2.ko by 5%, cifs.ko by 8% and
    befs.ko by a scary 14%. Strangely, udf.ko seems to have _grown_ by 6.6%
    -- that'll probably be another optimisation bug like GCC PR28755.

    The same benefits can be extended to the vmlinux too, although there are
    caveats with making _everything_ static. However, it's relatively simple
    to make EXPORT_SYMBOL() automatically set the 'externally_visible'
    attribute on the symbol in question, and to introduce a new '__global'
    tag which does the same for those symbols which aren't exported to
    modules but which _are_ needed as a global symbol in vmlinux.

    Size results from a test build on ppc64 are shown at -- the format is
    <old size>,<new size>,<delta>,<percentage * 100>,<object name>

    The same file with objects where the size didn't change omitted, and
    sorted on percentage is

    There are a bunch of GCC bugs which make this interesting:

    Fixes (or workarounds) for some of these are at

    (Actual patches will follow, to only)


    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2006-08-24 17:27    [W:0.031 / U:6.684 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site