GCC Toolset 15
GCC Toolset 15 in Red Hat Enterprise Linux offers updated compilers and debuggers for C, C++, and Fortran. It enables building, testing, and optimizing applications with current features while maintaining system stability and support.
The GCC Toolset 15 tools and versions Copy linkLink copied!
The GCC Toolset 15 offers updated versions of development tools for building and debugging applications on RHEL.
- [list of tools]
|
Name |
Version |
Description |
|
GCC |
15.1.0 |
A portable compiler suite with support for C, C++, and Fortran. |
|
binutils |
2.44 |
A collection of binary tools and other utilities to inspect and manipulate object files and binaries. |
|
dwz |
0.16 |
A tool to optimize DWARF debugging information contained in ELF shared libraries and ELF executables for size. |
C++ compatibility in the GCC Toolset 15 Copy linkLink copied!
GCC Toolset 15 supports a range of C++ language standards. The default standard is C++17, but you can choose C++98, C++11, C++14, or experimental versions including C++20, C++23, and C++26. Select a different standard with the appropriate compiler flag when building your code.
This compatibility information applies only to GCC from the GCC Toolset 15.
The GCC compiler in the GCC Toolset 15 can use the following C++ standards:
- C++98
- This language standard is available in the GCC Toolset 15. Binaries, shared libraries, and objects built using this standard can be freely mixed regardless of being built with GCC from the GCC Toolset 15, Red Hat Developer Toolset, and RHEL 5, 6, 7, and 8.
- C++11
-
This language standard is available in the GCC Toolset 15.
Using the C++11 language version is supported when all C++ objects compiled with the corresponding flag have been built using GCC version 5 or later.
- C++14
-
This language standard is available in the GCC Toolset 15.
Using the C++14 language version is supported when all C++ objects compiled with the corresponding flag have been built using GCC version 6 or later.
- C++17
-
This language standard is available in the GCC Toolset 15.
This is the default language standard setting for the GCC Toolset 15, with GNU extensions, equivalent to explicitly using option
-std=gnu++17.Using the C++17 language version is supported when all C++ objects compiled with the corresponding flag have been built using GCC version 10 or later.
- C++20, C++23, and C++26
-
These language standards are available in the GCC Toolset 15 only as experimental, unstable, and unsupported capabilities. Additionally, the compatibility of objects, binary files, and libraries built using these standards cannot be guaranteed.
To enable the C++20 standard, add the command-line option
-std=c++20to yourg++command line.To enable the C++23 standard, add the command-line option
-std=c++23to yourg++command line.To enable the C++26 standard, add the command-line option
-std=c++26to yourg++command line.
All of the language standards are available in both the standard-compliant variant and with GNU extensions.
Use the GCC Toolset 15 for linking when you combine objects built with the GCC Toolset 15 and objects built with the system toolchain, particularly .o or .a files. This ensures any newer library features provided only by the GCC Toolset 15 are resolved at link time.
Specifics of GCC in the GCC Toolset 15 Copy linkLink copied!
Certain behaviors and requirements of binutils in the GCC Toolset 15 differ from the base Red Hat Enterprise Linux binutils. These include automatic static linking of certain library features and the requirement to specify libraries after object files during linking.
- Static linking of libraries
- Certain more recent library features are statically linked into applications built with the GCC Toolset 15 to support execution on multiple versions of Red Hat Enterprise Linux. This creates an additional minor security risk because standard Red Hat Enterprise Linux errata do not change this code. If the need arises for developers to rebuild their applications due to this risk, Red Hat will communicate this using a security erratum.
- Specify libraries after object files when linking
-
In the GCC Toolset 15, libraries are linked by using linker scripts, which might specify some symbols through static archives. This is required to ensure compatibility with multiple versions of Red Hat Enterprise Linux. However, the linker scripts use the names of the corresponding shared object files. As a consequence, the linker uses different symbol handling rules than expected, and does not recognize symbols required by object files when the option adding the library is specified before options specifying the object files:
$ gcc-toolset-15-env gcc -lsomelib objfile.oUsing a library from the GCC Toolset 15 in this manner results in the linker error message
undefined reference to symbol. To prevent this problem, follow the standard linking practice and specify the option by adding the library after the options specifying the object files:$ gcc-toolset-15-env gcc objfile.o -lsomelibNote that this recommendation also applies when using the base Red Hat Enterprise Linux version of GCC.
Specifics of binutils in the GCC Toolset 15 Copy linkLink copied!
Certain behaviors and requirements of binutils in the GCC Toolset 15 differ from the base Red Hat Enterprise Linux binutils. These include automatic static linking of certain library features and the requirement to specify libraries after object files during linking.
- Static linking of libraries
- GCC Toolset 15 statically links newer library features into applications to ensure compatibility across multiple Red Hat Enterprise Linux versions. Statically linked code can introduce minor security risks, because security updates require applications to be rebuilt. If a security vulnerability is discovered, Red Hat will notify developers to rebuild affected applications through a security advisory.
- Specify libraries after object files when linking
-
In the GCC Toolset 15, libraries are linked by using linker scripts which might specify some symbols through static archives. This is required to ensure compatibility with multiple versions of Red Hat Enterprise Linux. However, the linker scripts use the names of the corresponding shared object files. As a consequence, the linker uses different symbol handling rules than expected, and does not recognize symbols required by object files when the option adding the library is specified before options specifying the object files:
$ gcc-toolset-15-env gcc ld -lsomelib objfile.oUsing a library from the GCC Toolset 15 in this manner results in the linker error message
undefined reference to symbol. To prevent this problem, follow the standard linking practice, and specify the option adding the library after the options specifying the object files:$ gcc-toolset-15-env ld objfile.o -lsomelibNote that this recommendation also applies when using the base Red Hat Enterprise Linux version of binutils.