The purpose of this blog is to explain to system developers some of the new C++, C, Go or Rust features in Red Hat Enterprise Linux (RHEL) 9.
Updated System Toolchain
At the core of RHEL 9 is an updated system toolchain based on the GNU Toolchain with the following key updated components:
Each of these components will have new features available given the upstream version noted. If there is something special to call out for each component it will have a section below.
GCC - The GNU Compiler Collection
GCC includes compilers for various languages, including C, C++, and Fortran. RHEL 9 is planned to ship with GCC 11 (compared to the GCC 8 in RHEL 8). There are too many changes to list relative to previous versions, affecting the language front ends, the optimization passes, the code-generation back ends, and how debugging information is generated.
Some of the highlights are:
C++ compilation now defaults to -std=gnu++17
Experimental support for C++20 and some C++23 features
Numerous new compile-time warnings, including an experimental
-fanalyzer option that enables a CPU-intensive static analysis of C code
Red Hat developers are very active in the upstream GCC project, and much of this work was done by them (roughly 26% of all patches between GCC 8 and GCC 11). More details about GCC changes can be found in the upstream pages (for GCC 9, GCC 10, and GCC 11), along with notes on porting source code (again, for GCC 9, GCC 10, and GCC 11).
Binutils - GNU Binary Utilities
The binary utility package (binutils) contains various programs for creating and modifying executable files. Whilst mostly hidden from the developer via the use of tools like
gcc, they can be invoked directly as well. Of particular importance are the assembler (
gas) and linker (
ld) which are used to create executables and the disassembler (
objdump) and file viewer (
readelf) which expose the internals of compiled files.
The binary annotation package (
annobin) contains plugins for gcc and llvm which can be used to record details about how a program was built. The package also includes a security tester tool (
annocheck) which can use the information recorded by the plugins to produce a report on the safety of given executables
LIBSTDC++ - The GNU C++ Library
As with the compiler, the C++ standard library in GCC 11 has mature support for the majority of C++17 features, including <any>, <charconv>, <filesystem>, <optional>, <string_view>, and <variant>. The C++17 parallel algorithms library is implemented and usable, but not ABI-stable due to its current dependency on libtbb.
Much of the C++20 library is also implemented, but still considered experimental.
GLIBC - The GNU C Library
RHEL 9 is planned to ship with glibc 2.34 with many new features and changes over RHEL 8’s glibc 2.28.
The most important change in glibc 2.34 is that the POSIX Threads library (libpthread) has been merged entirely into the C library (libc) to provide a consistent and seamless experience for modern applications using threads. This merger allows seamless in-place upgrades and deeper integration of threaded functionality and optimizations.
In addition to libpthread being merged the NSS identity management service providers for
dns are built into libc. Applications may use NSS
dns directly after entering an entirely different mount namespace without concerns for compatibility since they are built into libc.
All malloc hooks have been removed from libc.so to help improve runtime security. Using LD_PRELOAD with libc_malloc_debug.so enables the hooks for debugging.
Thread and application stack sizes are now fully dynamic to support hardware advances and changing register files (see _DYNAMIC_STACK_SIZE_SOURCE).
Less frequently used character converters have been moved to the
glibc-gconv-extras package and these converters can be uninstalled to save space and harden production environments.
Unicode 13.0.0 is supported for character encoding, character type info, and transliteration tables.
An improved and minimal C.UTF-8 locale is provided for use in containers and deployments which need only UTF-8 support.
Rust Toolset has been kept updated in sync for supported versions of RHEL, so in that regard, there’s nothing new in RHEL 9 itself.
In 9.0-beta we’re shipping Rust 1.54, in tandem with RHEL 8.5.0 and DevTools 2021.4, and in 9.0.0 GA we’re planning to update to 1.58. RHEL 8 started with Rust 1.31, the first release of the 2018 edition, and for RHEL 9 we’ll have the 2021 edition of the language. In that span, Rust has added many features, including:
Futures: async functions and blocks, and the .await operator.
Expanded language support for constant expressions and functions.
Constant value parameters in generic functions and types.
Subslice pattern matching.
Function-like procedural macros.
Library additions like TryFrom/TryInto, Pin/Future, array iterators, etc.
A more refined feature resolver in Cargo.
2021-specific: disjoint capture in closures
LLVM Toolset in RHEL 9 contains a large collection of tools for C and C++ development including a C/C++ compiler (clang), a linker (lld), a source code linter tool (clang-tidy), source code formatter (clang-format), and a full suite of binary tools (llvm-objdump, llvm-dwarfdump, llvm-nm, llvm-ar, and more).
In addition to these tools, LLVM Toolset contains a code generator library that can be used as a backend for your own custom language.
LLVM Toolset can also help you secure your programs with numerous security features, including Control Flow Integrity, Stack Clash Protection, and SafeStack. Additionally, LLVM Toolset containers a number of sanitizer libraries that can catch common programming mistakes in your applications like AddressSanitizer for catching memory errors, UndefinedBehaviorSanitzer for detecting undefined behavior, and MemorySanitizer for finding uninitialized memory reads.
RHEL 9 is planned to include Go 1.17, which includes these notable features:
Slices can be converted to array pointers.
Support for //go:build lines.
Improvements to function call performance on amd64.
Function arguments are formatted more clearly in stack traces.
Functions containing closures can be inlined.
Reduced resource consumption in x509 certificate parsing.
The performance toolset in RHEL 9 is refreshed to the latest upstream versions:
systemtap 4.5, with recent support for floating-point arithmetic.
dyninst 11, with recent support for ARM64.
elfutils 0.186, with debuginfod client and server improvements.
valgrind 3.18, with faster debuginfo processing and newer ARM64 / PPC64/ S390 support.
An interesting systemwide addition is support for the debuginfod service. It allows the whole gamut of debugging-type tools, including all of the performance tools plus gdb, perf, and many others to automatically download debuginfo and source code on the fly for programs they are working with.
At the moment, there is no public RHEL debuginfod service on the Internet. However, organizations can operate their own service colocated with their Satellite servers, build servers, or even individual developer workstations.
Red Hat Enterprise Linux 9 ships with GDB 10.2, including a host of new features such as source code highlighting, multi-target support, new Python scripting features, and many user experience improvements (especially for C++ developers). See the upstream GDB News page for a complete list of changes since version 8.2.
As a result of aligning more tightly with GDB's upstream community, all Red Hat releases of GDB (starting with version 10.2) have deprecated a number of custom features:
-P command-line option has been removed. Use
-ex python exec(open(
GDB no longer supports specifying a core file with no command-line option (
gdb COREFILE). Use
-c option instead.
Our custom VLA support has been removed in favor of improving the upstream implementation.
If a Python frame filter throws an exception, GDB will abort the backtrace instead of catching the exception.
For more on RHEL 9 developments, stay tuned to the Red Hat Blog's RHEL channel. For developer info, be sure to check the Red Hat Developers site regularly!