GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
ada

Ada: Fix build of GNAT tools with coverage enabled

Fixes the build of GNAT tools when code coverage is enabled.

This commit fixes a build issue in the Ada compiler (GNAT) when code coverage instrumentation is enabled. It introduces a COVERAGE_FLAGS variable and ensures that these flags are properly passed during the linking and compilation stages of GNAT tools. This resolves issue ada/110336, making it possible to build GNAT tools with code coverage enabled.

In Details

This commit addresses a build failure in the GNAT tools when coverage instrumentation is enabled. The COVERAGE_FLAGS variable was missing in gcc/ada/gcc-interface/Makefile.in, causing the linker to fail when building the tools. The patch introduces this variable and adds it to GCC_LINK_FLAGS and ALL_CFLAGS, ensuring that the necessary flags are passed to the linker and compiler. The enable_host_pie macro is also folded into a single use. The fix directly impacts the build process of GNAT tools and doesn't have direct implications for other subsystems.

For Context

When developing software, code coverage analysis helps ensure that tests exercise all parts of the codebase. This requires special compiler flags to instrument the code during compilation and linking. This commit fixes an issue in the Ada compiler (GNAT) build system where these flags were not correctly applied when building the GNAT tools themselves (e.g., the debugger or other utilities). By ensuring the correct flags are used, developers can now build GNAT tools with code coverage enabled, allowing them to improve the quality and reliability of their Ada development environment.

Filed Under: adagnatbuildcode coverage