You are viewing nickclifton

July 2014 GNU Toolchain Update

Deep Thought
Hi Guys,

  More toolchain goodness this month, with several new features making their way into the sources:

  * GCC can now produced compressed DWARF debug information, if it is supported by the rest of the toolchain:

     -gz[=type]

    The type parameter is optional, and is used to specify the sort of compression to be used.  Accepted values are:

       * none      (don't compress debug sections)
       * zlib         (use zlib compression in ELF gABI format)
       * zlib-gnu (use zlib compression in traditional GNU format)

  * GCC has a new option to improve the optimization of ELF DSOs:

     -fno-semantic-interposition

    Without this option the compiler has to assume that global symbols might be replaced by the dynamic linker and so it cannot perform any inter-procedural propagation, inlining and other optimizations on them.  While this feature is useful, for example, to rewrite memory allocation functions by a debugging implementation, it is expensive in the terms of code quality.

    With the new option enabled the compiler assumes that if interposition happens for functions the overwritting function will have precisely the same semantics (and side effects).  Similarly if interposition happens for variables, the constructor of the variable will be the same.

  * GCC has a couple of new options to disable warning messages.
  
    -Wno-incompatible-pointer-types

    This disables warning about conversions between pointers that have incompatible types.  The option affects warnings that are not disabled by the -Wno-pointer-sign option (which only stops warnings about signed vs unsigned pointers).

     -Wno-int-conversion

    Stops warnings about implicit incompatible integer to pointer and pointer to integer conversions.

    There is also a new option to enable a new warning:

     -Wsizeof-array-argument

    which warns when the sizeof operator is applied to a parameter that is declared as an array in a function definition.

  * The GOLD linker now has support for the AArch64 and MIPS architectures.

  * The NEWLIB C library can now be configured with a very small footprint I/O library (--enable-newlib-nano-formatted-io).  Whilst a lot smaller in size than the default I/O support, it does have a few restrictions:

      + Long doubles are not supported.
    
      + Floating point support has to be explicitly requested by the program linking to either or both of: _printf_float and/or _scanf_float.

      + Wide character I/O functions are not affected by this configure option.
  
  * The STRINGS program supports a new command line option:

      --include-all-whitespace
    
    which makes it include \n and \r characters in the strings that it displays.

  * The LD linker for COFF and PE based targets now supports a command line option:

      --insert-timestamp

    which makes it insert a real timestamp into the image, rather than the default value of zero.  This means that two identical binaries built at different times will compare differently, but it also means that the binaries will work with proprietary tools which cannot cope with zero timestamps.

  * The BINUTILS now have support for the AVR Tiny microcontrollers.

  * GCOV-TOOL is a new tool for manipulating profiling data.  With it you can:

      + Merge two sets of profiling data.
      + Scale or normalize the data.
      + Remove a subset of the data.

   This tool is part of the GCC sources.
    
Cheers
  Nick

June 2014 GNU Toolchain Update

Deep Thought
Hi Guys,

  A lot has happened this month, so standby for the highlights:

  * The GDB 7.8 branch has just been created.  A release will probably happen next month.  The release will also mark a switch from using BZIP2 to using XZ to compress the source tarball.

  * Support for MIPS32R3, MIPS32R5, MIPS64R3 and MIPS64R5 variants has been added to GCC.

  * Support for the DragonFly BSD variant has been added to the toolchain.

  * A new feature of G++ allows warnings to be produced about things that will change when different versions of the C++ ABI are used:

     -Wabi=<n>

    will warn about changes between ABI version <n> and the current ABI version (as set by -fabi-version= option).

  * The sanitizer feature of gcc now has a couple of new checks that can be enabled:

      -fsanitize=float-cast-overflow

    This option enables floating-point to integer conversion checking, and warns when overflow occurs.

     -fsanitize=bounds

    This option enables instrumentation of array bounds.  Various out of bounds accesses are detected.  Flexible array members are not instrumented, as well as initializers of variables with static storage.

  * A new command line option -Wswitch-bool will produce a warning whenever a switch statement has an index of boolean type.  The warning is enabled by default for C and C++ programs, so the option exists in order to disable the warnings.

  * A new command line option -Wlogical-not-parentheses will produce warnings about a logical NOT being used on the left hand side of a comparison.  Its purpose is to detect suspicious code like the following:

     int a; ... ; if (!a > 1) { ... }

    It is possible to suppress the warning by wrapping the left hand side in parentheses like this:
  
     int a; ... ; if ((!a) > 1) { ... }

  * The AArch64 target now supports some built-in functions:

      unsigned int __builtin_aarch64_get_fpcr (void)
      void              __builtin_aarch64_set_fpcr (unsigned int)
      unsigned int __builtin_aarch64_get_fpsr (void)
      void             __builtin_aarch64_set_fpsr (unsigned int)


    These read and write the FPCR and FPSR control registers.

    There are also a set of new intrinsic functions for accessing the optional CRC instructions available with the AArch64 ISA.  These are:  
 
     uint32_t __crc32b (uint32_t, uint8_t)
      uint32_t __crc32h (uint32_t, uint16_t)
      uint32_t __crc32w (uint32_t, uint32_t)
      uint32_t __crc32d (uint32_t, uint64_t)
      uint32_t __crc32cb (uint32_t, uint8_t)
      uint32_t __crc32ch (uint32_t, uint16_t)
      uint32_t __crc32cw (uint32_t, uint32_t)
      uint32_t __crc32cd (uint32_t, uint64_t)


  * Similar to the above, the ARM target now supports a couple of built-in functions for accessing FPSCR control register:

     unsigned int __builtin_arm_get_fpscr (void)
      void         __builtin_arm_set_fpscr (unsigned int)


  * The RX target now supports arguments to the "interrupt" function attribute.  These arguments can be numbers, which assign the function to numbered interrupt vector in the current interrupt table.  They can also be strings, which specify the name of the interrupt table to be used by any following numbers, or the magic value "$default" which causes the function to be used for any unfilled slots in the current table.

    So, for example:

    void __attribute__ ((interrupt (1,"foo",2,"dct","$default")))  txd1_handler ();
  
    specifies that the tdx1_handler function should occupy slot 1 in the default table, slot 2 in the "foo" table and any empty slot in the "dct" table.

Cheers
  Nick

May 2014 GNU Toolchan Update

Deep Thought
Hi Guys,

  There are several interesting things to report in this month's update:

  * Firstly GDB 7.7.1 has been released.  This provides the following fixes and improvements to GDB 7.7:

    + PR win32/14018 (pc register not available error on Windows)
    + PR python/16547 (GDB crashing on gdb.python/py-linetable.exp)
    + PR build/16550 (64-bit GDB doesn't build on Solaris)
    + PR gdb/16626 (auto-load regression: gdb uses wrong file to test safeness)
    + PR breakpoints/16292 (GDB oversteps a range in some cases.)
    + PR gdb/16575 (stale breakpoint instructions in the code cache)
    + PR gdb/16696 (AIX 32-bit cores, high section addresses)
    + PR gdb/16721 (Erroneous backtrace on AVR)
    + PR gdb/16832 (Erroneous backtrace on avrxmega architectures)
    + PR build/16873 (GDB 7.7 does not build with GCC 4.9)

  * GCC and the Binutils now have support for the R3 and R5 variants of the MIPS architecture, both in 32-bit and 64-bit modes.

  * By default instance variables in Objective-C can be accessed as if  they were local variables from within the methods of the class they're declared in.  This can lead to shadowing between instance variables and other variables declared either locally inside a class method or globally with the same name.  Specifying the new option -fno-local-ivars disables this behavior thus avoiding variable shadowing issues.

    Alternatively the new warning option -Wshadow-ivar can be used to detect such occurrences and then the programmer can fix them individually.

  * GCC frequently warns about qualifiers on pointers being discarded, eg when const char * is passed to a function that takes a char *.  The new compiler option -Wno-discarded-qualifiers can now be used to disable these warnings - although only for C.

  * The code sanitizer has been extended to catch the division by zero of floating point values.  The new option -fsanitize=float-divide-by-zero enables this behaviour, but this has to be done explicitly since floating-point division by zero can be a legitimate way of obtaining infinities and NaNs.
  
Cheers
  Nick

April 2014 GNU Toolchain Update

Deep Thought
Hi Guys,

  It has been quite an active month in GNU Toolchain land.  Here are the highlights:

  * The GCC 4.9 branch has been created and the first releas candidate has been made available.

  * The Openrisc and OR32 ports of the binutils have been replaced by a single new target: OR1K, which also includes support for the OpenRISC 1000 architecture.
  
  * Support for TI's RTOS has been added to Newlib.

  * A change has been made in the way Cygwin and MingGW targets add a default manifest resource to executables.  This used to be done automagically by the linker, but now it is the gcc toolchain driver program that performs this operation.

  * Support has been added to the linker to generate a build-id for COFF/PE binaries.

  * The ARM port of GAS has been enhanced to accept the assembler output from the CodeComposer Studio tool.

  * As an extension to the C language specification, GCC now accepts variable-length arrays as a member of a structure or a union.  For example:

     void
      foo (int n)
      {
        struct S { int x[n]; };
        [... use S ...]
      }


  * The compiler now supports a new warning option for checking calls to printf, scanf, etc:

      -Wformat-signedness

    This enables warnings if the format string requires an unsigned argument and the argument is signed and vice versa.

  * The compiler has a couple of new options for controlling the sanitizer:

    -fno-sanitize-recover
     -fsanitize-undefined-trap-on-error


   The -fno-sanitize-recover option changes the default behaviour of the sanitizer so that when it encounters an error the compiler stops and returns an non-zero exit value.  The default is to carry on compiling, possibly encountering further sanitization problems, and then to return an exit code dependent upon whether it was able to generate a binary.
   
   The -fsanitize-undefined-trap-on-error instructs the compiler to report undefined behavior using __builtin_trap () rather than a libubsan library routine.  The advantage of this is that the libubsan library is not needed and will not be linked in, so this is usable even for use in freestanding environments.

Cheers
  Nick

March 2014 GNU Toolchain update

Deep Thought
Hi Guys,

  It has been a fairly quite month in GNU toolchain land this month.  The GCC mainline is getting very close to being ready to branch for the 4.9 release and the GDB and BINUTILS projects have mainly been working on bugfixes.  But there are a few things worth noting:

  * The ARM simulator now has some tracing options so that you can follow the instructions as they are simulated.

  * The linker now automatically add a a default manifest to any fully linked cygwin or MingGW binary.  This is necessary in order to be able to execute the binary under Windows 8 (or later).  If an application supplies its own manifest then the default one will not be used.

  * The ARM port of the linker has a new command line option --long-plt which enables the generation of larger PLT entries that can support up to 4Gb of code.  The default is to use smaller PLT entries that only support up to 512Mb of code.

    The ARM linker can now also support generating PLT entries that use only Thumb2 instructions for those cores which do not support the ARM instruction set.

  * One limitation of the PE file format, used mainly by Windows binaries, is that it only supports a maximum of 2^15 sections.  This can be an issue with big projects, especially if gcc command line options like -ffunction-sections and -fdata-sections are used.  Microsoft recently released a little variation of the PE format that extends a few fields to support up to 2**31 sections, and the GNU linker now supports this extension.

  * The MIPS gcc port now supports a command line option -mvirt to enable the use of the MIPS Virtualization Application Specific instructions.

  * The TileGX gcc port now supports both big-endian and little-endian targets.

Cheers
  Nick

February 2014 GNU Toolchain Update

Deep Thought
Hi Guys,

  There are only a few new features to report this month:

  * GCC now supports a couple of new function attributes to improve its pointer alignment analysis:

     __attribute__((alloc_align(N)))

    Tells gcc that the annotated function returns a pointer to memory whose alignment is specified by parameter N (counting from 1).  So for example:

      void * my_alloc (size_t A, size_t B) __attribute__((alloc_align(2)));

    tells gcc that my_alloc returns memory aligned to the value of the B parameter.

    If the alignment is fixed a different function attribute can be used:

    __attribute__((assume_aligned(N)))

    This tells gcc that the function returns a pointer to memory that is aligned to a N-byte boundary.
  

  * The x86 port of GCC now supports a couple of new command line options:
  
      -mlong-double-128

    This makes the long double type 128 bits long, which is compatible with the 64-bit Bionic C library.

      -m16

     Generates code that can run in 16-bit mode.  The int, long and pointer types are still 32-bits long, but the code will work in a 16-bit environment.


   * The ARM port of GCC now accepts v7ve as an architecture name. This is the arm V7-A architecture with the virtualization extensions supported.


Starting this month, I am going to try to report changes in GDB as well.  I am not a GDB expert so feel free to let me know of any mistakes I make or features I miss.  To start with though I am just going to cheat and reproduce some of the information found in the gdb/NEWS file about changes made to the development version of GDB since the 7.7 release:


    * GDB now has support for scripting using Guile (version 2.0.9 or later).  Whether this feature is actually is available in a specific gdb executable is determined at configure time.  A couple of new commands are available to make use of the feature:

       guile <code>   Passes <code> to the Guile interpreter.
       guile-repl        Starts a Guile interactive prompt.
       set guile print-stack (none|message|full)
                                 Displays a stack trace when an error is encountered in a Guile script.

      The source command is now capable of sourcing Guile scripts.

    * GDB now supports the PowerPC64 GNU/Linux little-endian target.

    * The GDBserver has support for a new command line option:

       --debug-format=timestamps

      This enables the generation of timestamps to accompany any text output.
      It is intended that the --debug-format= option will be extended with other parameters in the future.

    * The command record function-call-history supports a new modifier /c to indent the function names based on their call stack depth.

    * The btrace record target now supports the record goto command.  For locations inside the execution trace, the back trace is computed based on the information stored in the execution trace.
      The btrace record target now also supports limited reverse execution and replay.  But the target does not record data and therefore does not allow reading memory or registers.

Cheers
  Nick

January 2014 GNU Toolchain Update

Deep Thought
Hi Guys,

  It has been 2 months since my last posting so quite a few things have happened:

  * The binutils now have support for the Andes NDS32 architecture.  This means that the GCC port can now be built and tested.
  
  * GCC now has support for the Altera Nios II architecture.

  * The objcopy program now has an option to dump a section as raw binary data, rather than in some formatted form.  This makes the new --dump-section option the compliment of the --add-section option.

  * The linker will now produce deterministic COFF and PE binaries by default.  This means that the timestamps in the binaries are set to zero so that two runs of the linker on identical inputs will produce identical outputs.  If a timestamp is needed the new --insert-timestamp command line option can be used to request this.
  
  * GCC has a new warning option -Wfloat-conversion which will complain about implicit conversions that reduce the precision of a real value.

  * GCC's sanitizer feature can now be tweaked to specify exactly what sorts of behaviour are being caught:

    -fsanitize=leak enables a memory leak detector.  This option only matters for linking of executables and if neither -fsanitize=address nor -fsanitize=thread is used.  In that case it will link the executable against a library that overrides malloc and other allocator functions.  For more details see:
    https://code.google.com/p/address-sanitizer/wiki/LeakSanitizer

    -fsanitize=shift enables checking that the result of a shift operation is not undefined.  Note that what exactly is considered undefined differs slightly between C and C++, as well as between ISO C90 and C99, etc.

   -fsanitize=integer-divide-by-zero Detect integer division by zero as well as INT_MIN / -1 division.

    -fsanitize=unreachable turns the __builtin_unreachable() call into a diagnostics message call instead.

   -fsanitize=vla-bound instructs the compiler to check that the size of a variable length array is positive.  This option does not have any effect in -std=c++1y mode, as the standard requires the exception be thrown instead.

   -fsanitize=null enables pointer checking.  Particularly, the application built with this option turned on will issue an error message when it tries to dereference a NULL pointer, or if a reference (possibly an rvalue reference) is bound to a NULL pointer.

   -fsanitize=return enables return statement checking.  Programs built with this option turned on will issue an error message when the end of a non-void function is reached without actually returning a value.  This option works in C++ only.

   -fsanitize=signed-integer-overflow enables signed integer overflow checking.  It checks that the result of +, *, and both unary and binary - does not overflow in the signed arithmetics.


  * The C++ ABI requires multiple entry points for constructors and destructors: one for a base subobject, one for a complete object, and one for a virtual destructor that calls operator delete afterwards.  For a hierarchy with virtual bases, the base and complete variants are clones, which means two copies of the function.  With the new option -fdeclone-ctor-dtor option the base and complete variants are changed to be thunks that call a common implementation.  This optimization is enabled by default when -Os is specified.

  * The new -fprofile-reorder-functions command line option uses profiling data to change the order of functions in a program. This can provide enhanced performance through code locality and shorter branches.
  
  * The ARM port of GCC now has builtin functions for the CRC32 opcodes that are supported by some ARMv8 chips.  It also has a new command line option: -mslow-flash-data which tells gcc to assume loading data from flash is slower than fetching instructions.  Hence literal loads are minimized for better performance.

Cheers
  Nick

November 2013 GNU Toolchain Update

Deep Thought
Hi Guys,

  There is lots to report this month:

  * A port to the Andes NDS32 architecture has been accepted into GCC.  Unfortunately the accompanying binutils port has yet to be accepted.

  * GCC now has a pointer checking system to detect out of bounds pointer references.  Enabled via the new -fcheck-pointer-bounds command line option it adds extra code to compiled functions when a special set of built-in functions are used.  Here is a small  example:
  
    void *
      __wrap_malloc (size_t n)
      {
         void * p = (void *) __real_malloc (n);
         return __builtin___bnd_set_ptr_bounds (p, n);
      }


    This tells GCC that the returned pointer refers to memory between p and p + n - 1.  (If pointer checking is not enable, the built-in function still works, it just returns its first argument).

    There is a whole set of these built-in functions to cover various different situations.  This has the advantage that the boundary checking code is only added when a pointer affected by one of these built-ins is used.

    In related news support for the old mudflap pointer boundary checker has now been removed from GCC.

  * GCC has a new warning option  -Wdate-time This generates warning when the macros __TIME__, __DATE__ or __TIMESTAMP__ are encountered in the source code as they might prevent bit-wise-identical reproducible compilations.

  * A new GCC command line optimization option -flive-range-shrinkage attempts to improve register usage by reducing the range over which a particular value or variable has to be held in a register.  This is usually helpful on fast processors with small or moderate size register sets.

  * Another new GCC command line option -fisolate-erroneous-paths detects pieces of code which trigger erroneous or undefined behaviour.  The optimization then isolates these regions from the main control flow and replaces them with a trap.

  * The RS6000/PowerPC port's -mabi= command line option can accept two new parameters:

    -mabi=elfv1
      -mabi=elfv2


    These control the selection of the old ELFv1 ABI and the new ELFv2 ABI.  The v1 ABI is the default for big-endian PowerPC targets and the v2 ABI is the default for little-endian PowerPC targets.

Cheers
  Nick

October 2013 GNU Toolchain Update

Deep Thought
Hi Guys,

  It has been a quiet month for GNU Toolchain developments.  But there are a few new features worth mentioning:

  * A port of the compiler to the Synopsys DesignWare ARC architecture has been contributed.

  * Function prototypes can now be annotated with a returns_nonnull attribute which lets the compile know that the return value will never be a null pointer.  This can allow the compiler to implement extra optimizations.

  * The AArch64 and ARM targets now support a command line option -mlra to enable the use of the Local Register Allocator as a replacement for the, sometimes troublesome, reload pass.

  * The MIPS target now supports a -mmsa command line option to enable or disable the use of the MIPS SIMD Architecture Extension instructions.

Cheers
  Nick

September 2013 GNU Toolchain Update

Deep Thought
Hi Guys,

  There have been several developments in the GNU Toolchain in the
  course of the last month:

  * The binutils 2.24 branch has been created.  A release is expected to happen within the next month.

  * A port of GCC to the Texas Instruments MSP430 series of processors has been contributed.

  * A new feature has been added to the C compiler.  Enabled via the command line option:

     -fsanitize=undefined

    This adds code to the generated executable to detect undefined mathematical behavior, e.g.: division by zero or various overflows.  This is similar to the -ftrapv option, but whereas that option causes a trap to occur the -fsanitize=undefined option generates a diagnostic message.

  * A new feature has been added to the C++ compiler.  Enabled via the command line option:

    -fdevirtualize-speculatively

    This attempts to convert calls to virtual functions into speculative direct calls.  Based on the analysis of the type inheritance graph, determine for a given call the set of likely targets. If the set is small, preferably of size 1, change the call into an conditional deciding on direct and indirect call.  The speculative calls enable more optimizations, such as inlining.  When they seem useless after further optimization, they are converted back into original form.

  * A new C++ warning has been implemented:

     -Wdelete-incomplete

    This issues a warning when the compiler detects an attempt to delete a pointer to incomplete type.  This may cause undefined behavior at runtime.  The warning is enabled by default.

  * The x86 port of GCC now includes support for the AVX512F, AVX512PF, AVX512ER, AVX512CD, FXSR, XSAVE and XSAVEOPT instruction set extensions.

  * The Aarch64 port of GCC now includes support for the CRC extensions to the instruction set.

Cheers
  Nick