GNU C library

(Part 5)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 regular series covering the latest changes and improvements in the components that make up this Toolchain. Apart from the announcement of new releases, however, the features described here are at the bleeding edge of software development in the tools. This does mean that it may be a while 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.

GLIBC

Version 2.25 of the GNU C Library is now available. In this version you will find:

  • Provisional support for ISO/IEC TR 24731-1:2010 which provides replacement versions of many of the memory allocation functions that include bounds checking.
  • Provisional support for ISO/IEC TR 24731-2:2010 which provides replacement versions of many of the memory allocation functions that use dynamically allocated memory to ensure that buffer overflow does not occur.
  • Provisional support for some of the new features that are defined in ISO/IEC TS 18661-4:2015, which is an implementation of the ISO/IEC/IEEE 60559:2011 floating point standard.
  • Full support for ISO/IEC TS 18661-1:2014 standard which implements support for binary floating-point arithmetic conforming to ISO/IEC/IEEE 60559:2011. This does not cover decimal floating-point arithmetic, nor does it cover many of the optional features of IEC 60559.
  • Glibc can now be built with the stack-smashing protector enabled. This means that distributions can build glibc with --enable-stack-protector=strong defined and expect it to work.
  • The function explicit_bzero, from OpenBSD, has been added to glibc. It is intended to be used instead of memset() to erase sensitive data after use; the compiler will not optimize out calls to explicit_bzero even if they are "unnecessary" (in the sense that no _correct_ program can observe the effects of the memory clear).
  • On ColdFire, MicroBlaze, Nios II and SH3, the float_t type is now defined to float instead of double. This does not affect the ABI of any libraries that are part of the GNU C Library but may affect the ABI of other libraries that use this type in their interfaces.
  • On x86_64, when compiling with -mfpmath=387 or -mfpmath=sse+387, the float_t, and double_t types are now defined to long double instead of float and double. These options are not the default, and this does not affect the ABI of any libraries that are part of the GNU C Library, but it may affect the ABI of other libraries that use this type in their interfaces if they are compiled or used with those options.
  • The getentropy and getrandom functions and the <sys/random.h> header file has been added.
  • The buffer size for byte-oriented stdio streams is now limited to 8192 bytes by default. Previously, on Linux, the default buffer size on most file systems was 4096 bytes (and thus remains unchanged), except on network file systems, where the buffer size was unpredictable and could be as large as several megabytes.
  • GDB pretty printers have been added for mutex and condition variable structures in POSIX Threads. When installed and loaded in gdb these pretty printers show various pthread variables in human-readable form when read using the 'print' or 'display' commands in gdb.
  • A tunables feature has been added to allow tweaking of the runtime for an application program. This feature can be enabled with the --enable-tunables configure flag when glibc is built. The GNU C Library manual has details on usage and README.tunables file has instructions on adding new tunables to the library.

Meanwhile, in the mainline development sources of glibc you can also find these new features:

  • Unicode 9.0.0 Support: Character encoding, character type info and transliteration tables are all updated to Unicode 9.0.0.
  • The rpcgen, librpcsvc, and related headers will only be built and installed when glibc is configured with --enable-obsolete-rpc. This allows alternative RPC implementations, like TIRPC, to be used by default. Applications needing features missing from TIRPC should consider the rpcsvc-proto project developed by Thorsten Kukuk (SUSE).

GDB

GDB 7.12.1 has been released. This is a point release over 7.12 and so it only contains bug fixes rather than new features, but if you have been using 7.12 then it is worth upgrading to 7.12.1.

Version 5 of the DWARF debug standard has now been officially released. This has improvements in many areas, such as better data compression, separation of debugging data from executable files, improved the description of macros and source files, faster searching for symbols, improved debugging of optimized code, as well as numerous improvements in functionality and performance.

If you want to read the new standard it is here: http://dwarfstd.org/doc/DWARF5.pdf

Meanwhile in the development sources:

  • GDB can now access to the PKU register on x86_64 GNU/Linux. The register is added by the Memory Protection Keys for Userspace feature, which will be available in future Intel CPUs.
  • Python scripts can now start, stop and access a running btrace recording.
  • GDB now supports recording and replaying rdrand and rdseed Intel 64 instructions.

Newlib

Newlib is another GNU C library.  Unlike GLIBC however, newlib is intended mainly to be run on top of either bare-metal or small-OS machines.  I.E. it is not expecting a Linux environment.

Newlib 2.5.0 has been released. The main change in this release is that:

  • The ctype and string functions are now locale aware and will behave correctly according to the current locale.

In addition, the current development sources have another new feature:

  • The locking routines can be retargeted at link time, allowing applications the ability to override the lock functions.

GCC

GCC version 6.3 has been released. This is a bug fix release and does not contain any new features.

GCC 7.0 is still undergoing regression fixing and is tentatively scheduled for an April release.

Meanwhile, in the development sources, a new feature has been added:

  • It is now possible to add the column number into source locations in DWARF debug information, alongside the regular file name and line numbers. This feature has to be explicitly enabled however by using the new command line option: -gcolumn-info.

Binutils

Binutils 2.28 has now been released. Most of the new features in this version have already been reported, but there is one significant addition:

  • This version of binutils fixes a problem with PowerPC VLE 16A and 16D relocations, which were functionally swapped, for example, R_PPC_VLE_HA16A performed like R_PPC_VLE_HA16D while R_PPC_VLE_HA16D performed like R_PPC_VLE_HA16A. This could have been fixed by renumbering relocations, which would keep object files created by an older version of gas compatible with a newer ld. However, that would require an ABI update, affecting other assemblers and linkers that create and process the relocations correctly. It is recommended that all VLE object files be recompiled, but ld can modify the relocations if --vle-reloc-fixup is passed to ld. If the new ld command line option is not used, ld will ld warn on finding relocations inconsistent with the instructions being relocated.

Plus in the development sources we have:

  • Add --merge-notes options to objcopy to reduce the size of notes in a binary file by merging and deleting redundant notes.
  • PowerPC gas now checks that the correct register class is used in instructions. For instance, "addi %f4, %cr3, %r31" warns three times that the registers are invalid.

That is it for now.

Due to various work constraints, I am going to have to acknowledge that I can no longer produce this blog as a monthly update, so I am switching to a quarterly schedule instead. This will mean fewer, but
longer blogs, but hopefully it will still be interesting reading.


Build your first app with native GCC on RHEL 6 or 7.

Last updated: February 11, 2024