nickclifton (nickclifton) wrote,

July 2012 GNU Toolchain Update

Hi Guys,

  It has been an eventful month for the GNU toolchain.  Here are the highlights of the changes:.
  * Readelf can now properly handle archives with 64-bit indicies.
    Ordinary archives use 32-bits in their symbol index, which limits them to 4Gb of contents.  There is an extended format which uses 64-bit indicies, although currentlty this format is very rare.  It is likely however that this larger format will become increasingly popular as applications, and especially their debug information, grow in size.  Note - the linker already supports 64-bit archives.

  * Gas for x86 targets now allows the 'rep bsf', 'rep bsr', and 'rep ret' syntax.

  * The compiler has a new optimization controlled by the following command line option:

    This option controls stack space reuse for user declared local variables and compiler generated temporaries.  A level of "all" (the default) enables stack reuse for all such variables.  A level of "named_vars" enables the reuse only for user defined local variables with names, and "none" disables stack reuse completely.

    The option is needed when the program extends the lifetime of a scoped local variable or a compiler generated temporary beyond the end point defined by the language.  When the lifetime of a variable ends, and if the variable lived on the stack, then the compiler has the freedom to reuse its stack space for other temporaries or local variables whose live range does not overlap with it.  For example:
        int local1;
        local1 = 10;
        int local2;
        local2 = 20;

    The stack slot assigned for local1 can be reused for local2.  Some programs however may erroneously extend the lifetime of the local variable beyond the end of its scope.  For example:
      int *p;
        int local1;
        p = & local1;
        local1 = 10;
        int local2;
        local2 = 20;

      if (*p == 10)  /* out of scope use of local1 */

    If a program relies upon the behaviour of older versions of gcc in which the stack space is not reused, then this optimization can lead to runtime errors.  Hence the need for a command line option to control the compiler's behaviour.

  * The compiler has a new command line option:


    This allows the compiler to optimize away instructions that may throw exceptions but don't otherwise contribute to the execution of the program.  This is enabled by default for Ada, but not for other languages.
  * The compiler has a new debugging command line option:

    This enables the generation of DWARFv3 .debug_pubnames and .debug_pubtypes sections.  These are special sections that speed up a debugger by providing a fast lookup path for debug information on functions and variables (.debug_pubnames) and on global types (.debug_pubtypes).  Including these sections in a object file can help speed up a debugger, but they do also make the object file larger.

  * A new optimization for targets with conditional move instructions has been added:


    This allows the compiler to speculatively hoist loads from both branches of an if-then-else construct if the loads are from adjacent locations in the same structure.  This optimization is enabled by default at -O2 and higher.

  * The tree-copyrename optimization has been extended with a couple of new enhancements:


    This tells the pass to attempt to combine small user-defined variables as well as compiler temporaries.  This may severely limit the ability to debug an optimized program compiled with -fno-var-tracking-assignments.  This option is enabled by default.

    This tells the pass to attempt to combine small user-defined variables as well, but only if they were inlined from other functions.  This may harm debug information of such inlined variables, but it will keep variables of the inlined-into function apart from each other, such that they are more likely to contain the expected values in a debugging session.  This was the default in GCC versions older than 4.7.

  * Another new optimization has been added to the compiler:


    This performs straight-line strength reduction on trees.  That is it recognizes related expressions involving multiplications and replaces them by less expensive calculations when possible.  This optimization is enabled by default at -O and higher.

  * The compiler has switched from using the PPL library to using the ISL library for manipulating sets of integers.  This is used by  the Graphite loop optimizing code in the compiler.

  * Related to the previous item, the compiler now has an experimental new optimization:


    This enables the ISL based loop nest optimizer.  This is a generic loop nest optimizer based on the Pluto optimization algorithms.  It calculates a loop structure optimized for data-locality and parallelism.  For more details see:

  * Support for the Cirrus floating point extensions has been removed from the ARM backend of the compiler.  No modern ARM silicon supports these extensions any more and removing the code has helped to clean up the ARM floating point support code.

  * The GNU Tools Cauldron was held in Prague last week.  It was a very useful meeting for anyone involved in the supporting the GNU toolchain.  A couple of points came up at the meeting which might be of interest to a wider audience:

      + Documentation for the toolchain, especially the compiler, is sorely lacking.  Anyone wanting to help improve matters is most welcome.

      + New blood is needed.  The "old guard" have been active in developing and maintaining the toolchain for a long time, but there is a need to attract new talent.  Part of the problem in attracting new people is the poor documentation.  But another part is the code itself which is often hard to understand.  Projects are underway to clean up the code and rewrite parts of it in more modern languages (eg C++).

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your IP address will be recorded