https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124268
Bug ID: 124268
Summary: `import std` initializer symbol is not shipped in
`libstdc++`
Product: gcc
Version: 15.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: bugzilla.gcc at me dot benboeckel.net
Target Milestone: ---
On macOS (via Homebrew), `import std` in CMake fails to link because there is
no `_ZGIW3std` symbol (plus macOS' leading `_`) provided. I believe that this
should be part of the standard library containing the implementation so that
there's no ODR concern about umpteen projects each making the symbol and
stuffing it into their library directly.
See this CMake issue: https://gitlab.kitware.com/cmake/cmake/-/issues/27626
Now, on Linux, there seems to be no issue, but looking closer, there is no
*reference* to the symbol created. This seems…odd. If there's some magic where
the compiler knows it is not needed, there has been discussion in SG15 (no
paper) about an attribute to say "this module has no global initializer symbol
(and neither does anything I import) that must be called by importers". Then
the symbol can be elided and we're well on our way to "module interface-only
libraries".