You are viewing nickclifton

Previous Entry | Next Entry

August 2014 GNU Toolchain Update

Hi Guys,

  Here are the highlights of this month's changes in the GNU Toolchain:

  * The linker now accepts --push-state and --pop-state command line options.  The --push-state option preserves the current state of the flags which govern the input file handling, such as --as-needed, --whole-archive and so on.  (The full list is in the linker documentation).  The idea is that components of a build system can safely insert options into the linker command line without having to be aware of what options may have previously been added.  So for example a tool could add:

      --pushstate --as-needed -libone -libtwo --pop-state

    at any point in the linker command line and be sure that it will work as expected, even if the rest of the command line was using --no-as-needed.

  * The x86/PE linker supports a new option: --high-entropy-va which marks the binary being generated as being compatible with 64-bit address space layout randomization (ASLR).

  * The compiler driver program (gcc or g++) will now pass:

      -z <foo>

    Directly on to the linker.  This allows slightly easier access to these linker command line options.

  
  * The compiler now supports some new warning options:

     -Wbool-compare

    Which warns about boolean expressions that are compared with an integer value different from true/false.  For example:

      int n = 5;
      if ((n > 1) == 2) { ....


     -Wc90-c99-compat

    This warns about features used in the program that are present in the ISO C99 standard but not present in ISO C90 standard.

     -Wc99-c11-compat
  
    Similarly this warns about the use of ISO C11 features that are not present in ISO C99.

     -Wno-designated-init

    This disables warnings about positional initialization of structs that requiring designated initializers.  (See below).

      -Wmemset-transposed-args

    This warns about suspicious calls to memset where the third argument is a literal zero and the second is not.  For example:

      memset (buf, sizeof buf, 0)

    where the second and third arguments are the wrong way around.
    
      -Wsuggest-final-types

    This warns about types with virtual methods where code quality would be improved if the type was declared with C++11 final specifier, or, if possible, declared in anonymous namespace.  This allows GCC to devritualize more aggressively the polymorphic calls.  This warning is more effective with link time optimization, where the information about the class hierarchy graph is more complete.

      -Wsuggest-final-methods

    Similarly this warns about virtual methods where code quality would be improved if the method was declared with C++11 final specifier, or, if possible, its type was declared in the anonymous namespace or with final specifier.
  
  * The compiler now supports a new type attribute called:
  
      designated_init
    
    This attribute may only be applied to structure types.  It indicates that any initialization of an object of this type must use designated initializers:

      struct point { int x; int y };
      struct point p = { .y = 1, .x = 2 };

    
    Rather than positional initializers:

      struct point p = { 2, 1 };
    
    The intent of this attribute is to allow the programmer to indicate that a structure's layout may change, and that therefore relying on positional initialization will result in future breakage.

    Attempts to use positional initialization on a structure annotated with this new attribute will generate a compile time warning unless the new -Wno-designated-init command line option is used.

  * The compiler's sanitizer has two new features:

    -fsanitize=kernel-address

     Which enables AddressSanitizer for Linux kernel.  See
     http://code.google.com/p/address-sanitizer/wiki/AddressSanitizerForKernel
     for more details.

     -fsanitize=alignment

     Which enables checking of alignment of pointers when they are dereferenced, or when a reference is bound to insufficiently aligned target, or when a method or constructor is invoked on insufficiently aligned object.

   * The C and C++ compilers have a new optimization which is enabled automatically at -O2 and above:

      -foptimize-strlen

     This optimizes various standard C string functions (e.g. strlen, strchr or strcpy) into faster alternatives, where this is possible.

Cheers
  Nick

Comments

Profile

Deep Thought
nickclifton
nickclifton

Latest Month

May 2015
S M T W T F S
     12
3456789
10111213141516
17181920212223
24252627282930
31      
Powered by LiveJournal.com
Designed by chasethestars