GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gcc

testsuite, c++, Darwin: Add crt to LTO link line for darwin9

Ensures Darwin LTO test cases correctly link by including necessary crt components.

The C++ LTO (Link-Time Optimization) test cases for Darwin 8 and 9 in GCC’s testsuite have been updated. These tests manually craft link lines, and on these older Darwin versions, a specific crt (C runtime) component is required to correctly build shared libraries. This change adds the necessary -dylib0.o flag to the link line for these tests.

In Details

For the LTO test cases in g++.dg/lto/ targeting Darwin8/9, this commit modifies the hand-crafted link lines. To successfully build a shared library on these specific Darwin versions, the C runtime startup object (crt) containing necessary header information must be explicitly provided. The change adds the -dylib0.o argument to the linker command, ensuring these LTO tests function correctly on the targeted older Darwin platforms.

For Context
LTO
Link-Time Optimization. An optimization technique where the compiler performs optimizations across different source files during the linking stage, rather than just within individual compilation units. This allows for more aggressive whole-program optimization.
Darwin
The name of Apple's Unix-like operating system, which forms the basis for macOS, iOS, and other Apple platforms. GCC supports various Darwin versions and architectures.
crt
C Runtime. Refers to the startup code that is linked into every C (and often C++ or other language) program. It initializes the runtime environment before the main function is called and performs cleanup afterward.
Shared library
A library that can be loaded and linked by multiple programs at runtime. This promotes code reuse and reduces the memory footprint of applications.
Filed Under: gcctestsuitec++ltodarwin