GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
modula2

modula2: New debug build rules for the m2 front end.

Modula-2 front end now supports debug builds using a whole-program compilation strategy.

This commit introduces new m2-debug and check-m2-debug rules to the Modula-2 build system. These rules enable building the Modula-2 front end (cc1gm2) using a whole-program compilation approach (-fm2-whole-program) with optimization disabled (-O0) and debugging symbols enabled (-g). This is intended to facilitate bug hunting and debugging during the early stages of issue triage.

In Details

New make rules m2-debug and check-m2-debug have been added to Make-lang.in. The m2-debug rule compiles cc1gm2 using gm2 with the flags -fm2-whole-program -O0 -g. This forces a single, complete compilation of the Modula-2 front end, which can be beneficial for debugging but is noted as a costly operation (20 minutes on a 3GHz machine). It also rebuilds several Modula-2 library object files and adds a dependency on ./., implying a local build environment.

For Context
Modula-2
A procedural programming language designed by Niklaus Wirth, emphasizing modularity and strong typing.
front end
The part of a compiler that analyzes the source code and converts it into an intermediate representation. For GCC, cc1 variants are typically front ends (e.g., cc1gm2 for Modula-2).
whole-program compilation
A compilation strategy where the entire program is compiled at once, enabling optimizations that depend on cross-file or cross-module analysis.
cc1gm2
The GCC compiler front end for the Modula-2 language.
Filed Under: modula2builddebugging