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

Include stdc-predef.h in hosted mode for picolibc

Adds picolibc support to GCC, enabling necessary preprocessor definitions in hosted environments.

This commit introduces support for the picolibc C library within GCC, specifically for hosted environments. It mirrors the mechanism used by glibc by including stdc-predef.h, which provides essential preprocessor definitions required when no C library header has been directly included. This integration ensures that picolibc-configured builds have the correct predefined macros available.

In Details

This patch adds picolibc as a supported C library configuration within GCC. It introduces new configuration files (picolibc-c.cc, t-picolibc) and updates config.gcc to integrate picolibc's hosted mode support. This ensures that when GCC targets a system using picolibc, it correctly provides standard predefined macros via stdc-predef.h, similar to how it handles glibc, when no other C headers are explicitly included.

For Context
stdc-predef.h
A C header file that defines standard predefined macro constants, such as __STDC_VERSION__ and __OPENMP, which are useful for conditional compilation and compiler version detection.
Hosted mode
A C execution environment where the program has access to a host operating system's services, typically including standard libraries and I/O.
C library
A collection of essential functions and macros that provide standard services for C programs, such as input/output, string manipulation, and memory management.
picolibc
A small C library designed for embedded systems, often used in bare-metal or minimal environments.
Preprocessor definitions
Macros defined for the C preprocessor, which are substituted into the source code before compilation. Examples include __FILE__ and __LINE__.
Filed Under: picolibcc libraryhosted modeconfiguration