GNU Toolchain Update – Spring 2018
The GNU Toolchain is a collection of programming tools produced by the GNU Project. The tools are often packaged together due to their common use for developing software applications, operating systems, and low-level software for embedded systems.
This blog is part of a series (see: Fall 2017 Update) covering the latest changes and improvements in the components that make up this Toolchain. Apart from the announcement of new releases, the features described here are at the bleeding edge of software development in the tools. This means that it may be awhile before they make it into production releases, and they might not be fully functional yet. But anyone who is interested in experimenting with them can build their own copy of the Toolchain and then try them out.
Version 2.27 is now out; there are loads of new features and bug fixes in this release. Some of the highlights include:
- The library can now be compiled with support for building static PIE executables.
- The abort function terminates the process immediately, without flushing stdio streams. Previous glibc versions used to flush streams, resulted in deadlocks and further data corruption.
- Support for memory protection keys was added. The <sys/mman.h> header now declares the functions pkey_alloc, pkey_free, pkey_mprotect, pkey_set, pkey_get.
- The copy_file_range function has been added.
- Support for the RISC-V ISA running on Linux has been added.
For full details see:
Version 2.30 is now out; there are several new features in this release, including:
- Assembler support for location views in DWARF debug line information.
- The bfd linker now has a -z separate-code command line option to generate a separate code PT_LOAD segment.
- The bfd linker also now has a -z undefs command line option as the inverse of the -z defs option.
- The gold linker now has a -z text-unlikely-segment option which will move all .text.unlikely sections to a separate segment.
- The DWARF dumping tools (readelf, objdump) now support options to display and follow links to separate debug information files.
For full details see:
Version 8.1 of GDB is now out, which includes the following new features:
- Breakpoints on C++ functions are now set on all scopes by default (“wild” matching).
- Improved Rust support; in particular, Trait objects can now be inspected when debugging Rust code.
- The enable and disable commands now accept a range of breakpoint locations.
- New rbreak command to insert a number of breakpoints via a regular expression pattern.
For full details see:
Version 3.0.0 of the newlib C library is now out; this version includes:
- K&R support is removed in code and docs.
- 64-bit time_t support.
- RISC-V platform support added.
- New expf, exp2f, logf, and powf implementations.
- New long double complex math routines.
Meanwhile GCC is fast approaching the branch date for version 8. Even so, several new features have been added in the past few months:
- Control Flow Protection
The new option -fcf-protection=[full|branch|return|none] enables or disables instrumentation of branches and return instructions to make sure that their destinations are valid. Currently the x86 GNU/Linux target provides an implementation based on Intel Control-flow Enforcement Technology (CET). Instrumentation for x86 is controlled by target-specific options:
-mcet, -mibt and -mshstk.
- Stack Clash Protection
The new option -fstack-clash-protection generates code to prevent stack clash style attacks. When this option is enabled, the compiler will only allocate one page of stack space at a time and each page is accessed immediately after allocation.
- Patchable Function Entry Points
The new option -fpatchable-function-entry=N[,M] generates N nop instructions right at the beginning of each function, with the function entry point before the M’th nop. The nop instructions reserve extra space which can be used to patch in any desired instrumentation at run time, provided that the code segment is writeable. The amount of space is controllable indirectly via the number of nops.
- Support for new C and C++ Standards
The -std= command line option now accepts c17, c++17, and c++2a as standard names. These correspond to the ISO C17 standard, the 2017 ISO C++ standard, and the next revision of the ISO C++ standard, tentatively planned for 2020.
- New Warning Options
Warn when a declaration of a function is missing one or more attributes that a related function is declared with and whose absence may adversely affect the correctness or efficiency of generated code. Automatically enabled with -Wall.
Warn for calls to bounded string manipulation functions such as strncat, strncpy, and stpncpy that may either truncate the copied string or leave the destination unchanged.
Warn whenever a pointer is cast such that the required alignment of the target is increased. For example, warn if a char * is cast to an int *.
Warn when a function pointer is cast to an incompatible function pointer. In a cast involving function types with a variable argument list, only the types of initial arguments that are provided are considered.
Warn if a structure field with explicitly specified alignment in a packed struct or union is misaligned.
- Improved Debug Location Support
Several new command line options have been added to enable the generation of better debugging information:
Informs the compiler that the assembler supports .loc directives, and that it can use them to generate DWARF line number tables. This is generally desirable because assembler-generated line-number tables are a lot more compact than those the compiler can generate itself.
Informs the compiler that the assembler supports view assignment and reset assertion checking in .loc directives. This results in even better assembler generated line number tables.
Will augment variable location lists with progressive view numbers implied from the line number table. This enables debug information consumers to inspect state at certain points of the program, even if no instructions associated with the corresponding source locations are present at that point.
Will make the compiler generate extended debug information for inlined functions. Location view tracking markers are inserted at inlined entry points, so that address and view numbers can be computed and output in debug information.
- New Sanitization Options
Enables the instrumentation of comparison operations when used with pointer operands.
Enables the instrumentation of subtraction operations with pointer operands.
Enables the instrumentation of addition operations with pointer operands.
Enables the instrumentation of arguments to selected builtin functions.
Enables dataflow guided fuzzing code instrumentation.
That’s all for now. We will be back in the summer for more!