Log in

No account? Create an account

Previous Entry | Next Entry

April 2012 GNU Toolchain Update

Hi Guys,

  There has been a lot of action in the GNU Toolchain over the last month.  Here are the highlights:

  * The linker and assembler now have support for generating Google Native Client binaries for the ARM, x86 and x86_64 architectures:  See  http://code.google.com/p/nativeclient/ for more information on this binary format.
  * GCC's -pedantic command line option has now been renamed to -Wpedantic in line with all the other command line options that control warnings.  The old -pedantic is still supported however.

  * GCC diagnostic messages that display a line of source code will now also show a caret indicating the column where the problem was detected.  Eg:

      fred.cc:4:19: fatal error: foo: No such file or directory
      #include <foo>
      compilation terminated.

    This behaviour can be turned off by using the -fno-diagnostics-show-caret command line option.
  * The -fsched-pressure command line option has been extended to allow the selection of the algorithm to use when scheduling pressure sensitive instructions:

    The default algorithm for -fsched-pressure is weighted but the new model algorithm can produce better results for some architectures (eg ARM).  For full details of the new algorithm see: http://gcc.gnu.org/ml/gcc-patches/2011-12/msg01684.html.  Note - currently this option is undocumented.

  * By default GCC will now produce DWARF version 4 debug information (rather than version 2) when it is producing DWARF debug output.  The old behaviour can be restored by -gdwarf=2.    

  * G++ will now issue warnings when compiling for the 2011 ISO C++ standard when a string or character literal is followed by a user defined suffix which does not begin with an underscore.  For example:

      #define BAR                 "bar"
      #define _PLUS_ONE   + 1
      char s[] = "foo"BAR;          // Warning: "invalid suffix on literal"
      char c = '3'_PLUS_ONE;    // No warning

    The reason that underscore prefixed suffixes are allowed is that they represent user-defined suffixes.  Suffixes without an underscore are language specific suffixes (eg U or F) and these should not be found after strings or character constants.  User defined suffixes that start with an underscore are actually in use already, for example in <inttypes.h>:

      #include <inttypes.h>    
      printf ("64-bit value is: %" __PRI64_PREFIX "d\n", foo);

  The warning can be disabled with -Wno-literal-suffix.
  * A new version of the C++ ABI has been introduced - version 7.  In this version nullptr_t is treated a builtin type.  The default ABI is still version 2 however.

  * The H8300 backend has a new command line option:  -mexr. This causes extended registers to be pushed onto the stack in monitor functions.

  * The x86 and x86_64 backends have some new built-in functions which can be used to determine the type of CPU in use:

       int __builtin_cpu_is (const char * cpuname)
       int __builtin_cpu_supports (const char * feature)

    The names currently recognised by __builtin_cpu_is () are as follows:

       intel, atom, core2, corei7, nehalem, westmere, sandybridge, amd, amdfam10h, barcelona, shanghai, istanbul, amdfam15h, bdver1, bdver2

    So for example:

       if (__builtin_cpu_is ("corei7"))
         do_corei7 ();
         do_generic ();

   Maenwhile  __builtin_cpu_supports() recognises these strings:
        cmov,  mmx, popcnt, sse, sse2, sse3, ssse3, sse4.1, sse4.2, avx, avx2


       if (__builtin_cpu_supports ("popcnt"))
         asm ("popcnt %1,%0" : "=r"(count) : "rm"(n) : "cc");
         count = generic_countbits (n);

    If these built-in functions are going to be used in an ifunc resolver then an init function has to be run first.  For example:

       static void (*resolve_memcpy (void)) (void)
         /* ifunc resolvers fire before constructors, therefore we must explicitly call the init function.  */
          __builtin_cpu_init ();

         if (__builtin_cpu_supports ("ssse3"))
           return ssse3_memcpy;
         return default_memcpy;

     void * memcpy (void *, const void *, size_t)   __attribute__ ((ifunc ("resolve_memcpy")));




Deep Thought

Latest Month

November 2015
Powered by LiveJournal.com
Designed by chasethestars