Log in

November 2014 GNU Toolchain Update

Hi Guys,

  There is lots to report this month...

  * GCC now has experimental support for offloading.
    Offloading is the ability for the compiler to separate out portions of the program to be compiled by a second, different compiler.  Normally this second compiler would target a different architecture which can be accessed from the primary architecture.  Like a CPU offloading work onto a GPU in a graphics card.

    Currently only the Intel MIC architecture is supported.  See here for more information:  https://gcc.gnu.org/wiki/Offloading

  * The strings program from the binutils package now defaults to using the --all option to scan the entire file.  Before the default used to be --data, which would only scan data sections in the file.

    The reason for the change is that the --data option uses the BFD library to locate data sections within the binary, which exposes the strings program to any flaws in that library.  Since security researchers often use strings to examine potential viruses this meant that these flaws could affect them.

  * GCC now has built-in pointer boundary checking: -fcheck-pointer-bounds
    This adds pointer bounds checking instrumentation to the generated code.  Warning messages about memmory access errors may also be produced at compile time unless disabled by -Wno-chkp.  Additional options can be used to disable bounds checking in certain situations, eg on reads or writes etc.  It is also possible to use attributes to disable bounds checking on specific functions and structures.

  * GCC now has some built-in functions to perform integer arithmetic with overflow checking.  For example:

       bool __builtin_sadd_overflow (int a, int b, int *res)
        bool __builtin_ssubl_overflow (long int a, long int b, long int *res)
       bool __builtin_umul_overflow (unsigned int a, unsigned int b, unsigned int *res)

    These built-in functions promote the first two operands into infinite precision signed type and perform addition (or subtraction or multiplication) on those promoted operands.  The result is then cast to the type the third pointer argument points to and stored there.  If the stored result is equal to the infinite precision result, the built-in functions return false, otherwise they return true.

  * GCC now has experimental support for NVidia's NVPTX architecure. Currently only compilation is supported.  Assembly and linking are not yet available.

  * Two new options to disable warnings have been introduced to GCC:

    Stops warnings about shifts by a negative amount.
    Stops warnings when the shift amount being more than the width of the type being shifted.

  * A new optimization has been added to GCC: -flra-remat   
    This enables "rematerialization" during the register assignment pass (lra).  What happens is that instead of storing a value in a register the optimizations chooses to recaclulate the value when needed.  Thus freeing up the register for other purposes.  Obviously this is only done when the optimization calculates that it will be worth it.  This new optimization is enabled automatically at -O2, -O3 and -Os.

  * A new profling option has been added to GCC: -fauto-profile[=<file>]
    This enables sampling based feedback directed optimizations, and optimizations generally profitable only with profile feedback available.  If <file> is specified, GCC looks in <file> to find the profile feedback data files.

    In order to collect the profile data you need to have:

    1. A linux system with linux perf support.

    2. (optional) An Intel processor with last branch record (LBR) support. This is to guarantee accurate instruction level profile, which is important for AutoFDO performance.

    To collect the profile, first use linux perf to collect raw profile.  (See https://perf.wiki.kernel.org/).  For example:
     perf record -e br_inst_retired:near_taken -b -o perf.data -- <your_program>

    Then use create_gcov tool, which takes raw profile and unstripped binary to generate AutoFDO profile that can be used by GCC.  (See https://github.com/google/autofdo).

      create_gcov --binary=your_program.unstripped --profile=perf.data --gcov=profile.afdo

  * New optimization has been added to GCC: -fschedule-fusion
    This performs a target dependent pass over the instruction stream to schedule instructions of same type together because target machine can execute them more efficiently if they are adjacent to each other in the instruction flow.

    Enabled by default at levels -O2, -O3, -Os.

  * The ARM backend to GCC now supports a new option: -masm-syntax-unified
    This tells the backend that it should assume that any inline assembler is using unified asm syntax.  This matters for targets which only support Thumb1 as be defaul they assume that divided syntax is being used.

  * The MIPS backend to GCC now supports two additional variants of the o32 ABI.  These are intended to enable a transition from 32-bit to 64-bit registers.  These are FPXX (-mfpxx) and FP64A  (-mfp64 -mno-odd-spreg).
    The FPXX extension mandates that all code must execute correctly when run using 32-bit or 64-bit registers.  The code can be interlinked with either FP32 or FP64, but not both.

    The FP64A extension is similar to the FP64 extension but forbids the use of odd-numbered single-precision registers.  This can be used in conjunction with the FRE mode of FPUs in MIPS32R5 processors and allows both FP32 and FP64A code to interlink and run in the same process without changing FPU modes.

  * The linker supports a new command line option: --fix-cortex-a53-835769
    This enables a link-time workaround for erratum 835769 present on certain early revisions of Cortex-A53 processors.  The workaround is disabled by default.

  * The linker supports a new command line option: --print-sysroot

    This will display the sysroot that was configured into the linker when it was built.  If the linker was configured without sysroot support nothing will be printed.


October 2014 GNU Toolchain Update

  In this month's news we have:
  * GDB now supports hardware watchpoints on x86 GNU Hurd.

  * GDB has a new command:

       queue-signal <signal-name-or-number>

    This queues a signal to be delivered to the thread when it is resumed.

  * GCC supports a new variable attribute:

     __attribute__((io (<addr>)))

    This specifies that the variable is used to address a memory mapped peripheral.  If an address is specified the variable is always assigned to that address.  For example:

     volatile int porta __attribute__((io (0x22)));

    Even without an address assigned to it, a variable with this attribute will always be accessed using in/out instructions if supported by the target hardware.

    There are two variations on this attribute:

      __attribute__((io_low <addr>)
      __attribute__((address <addr>)

    These are like the "io" attribute except that they additionally inform the compiler that the variable falls within the lower half of the I/O area (for "io_low") or outside the I/O area (for "address"), which may make a difference to the instructions generated to access the variable.

  * GCC's sanitizer has a couple of new options:


    This option enables instrumentation of memory references using the __builtin_object_size function.  Various out of bounds pointer accesses can be detected in this way.


    This option enables instrumentation of loads from bool.  If a value other than 0/1 is loaded, a run-time error is issued.


    This option enables instrumentation of loads from an enum type.  If a value outside the range of values for the enum type is loaded, a run-time error is issued.

  * The inter-procedural analysis pass now supports a new optimization:

    This performs identical code folding for functions and/or read-only variables.  The optimization reduces code size, but it may disturb unwind stacks by replacing a function by an equivalent one with a different name.

    The optimization works more effectively with link time optimization enabled.  The optimization is similar to the ICF optimization performed by the GOLD linker, but it works at a different level and it may find equivalences that GOLD misses.

  * The AArch64 target now supports a workaround for ARM Cortex-A53 erratum number 835769:


    When enabled it inserts a NOP instruction between memory instructions and 64-bit integer multiply-accumulate instructions.


September 2014 GNU Toolchain Update

Hi Guys,

  In this month's news we have:
  * The GDB project is removing support for the following platforms:
    - MIPS IRIX (mips*-sgi-irix5*, mips*-sgi-irix6*)
    - Alpha Tru64 (alpha*-*-osf*)

    This only affect code maintained by GDB project (not binutils or GCC).  Also, support for any other target on MIPS (including embedded ones) will be maintained as is.

  * GCC now supports the MIPS R6 and ARM CORTEX-A17 architecture variants.

  * The is a new gcc attribute called no_reorder.  This tells GCC not to change the order of the marked functions and variables, relative to each other.  (Unmarked functions and variables can still be reordered).  This attribute is similar to the -fno-topleve-reorder option, except that it only applies to the marked symbols.

  * There is a new GCC command line optionn: -freport-bug

    This tells GCC to collect and dump debug information into temporary file if an internal compiler error occurs.  This information can be helpful to whomever has to fix the bug.


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:


    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) { ....


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

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


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


    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.

    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.


    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:
    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:


     Which enables AddressSanitizer for Linux kernel.  See
     for more details.


     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:


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


July 2014 GNU Toolchain Update

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:


    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:


    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.

    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).


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

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


    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:

    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:


    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.

June 2014 GNU Toolchain Update

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:


    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:


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


    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.


May 2014 GNU Toolchan Update

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.

April 2014 GNU Toolchain Update

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:

      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:


    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:


   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.


March 2014 GNU Toolchain update

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.


February 2014 GNU Toolchain Update

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:


    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:


    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:

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


     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:


      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.