On Tue, 17 Mar 2026 at 11:13, Jonathan Wakely <[email protected]> wrote:
>
> On Tue, 17 Mar 2026 at 10:13, Gerald Pfeifer <[email protected]> wrote:
> >
> > On Mon, 16 Mar 2026, Jonathan Wakely wrote:
> > > This ensures that the module init functions are present in libstdc++.so
> > > and libstdc++.a, so that users of the std and std.compat modules don't
> > > need to manually link to std.o and/or std.compat.o in addition to
> > > compiling the CMIs.
> > :
> > > libstdc++-v3/ChangeLog:
> > >
> > >       PR libstdc++/124268
> > >       * config/abi/pre/gnu.ver: Export symbols.
> > >       * src/Makefile.am: Add libmodulesconvenience.la to libstdc++
> > >       link.
> > >       * src/Makefile.in: Regenerate.
> > >       * src/c++23/Makefile.am: Create libmodulesconvenience.la
> > >       and populate it with std.o and std.compat.o interface units.
> > >       Add clean-local target.
> > >       * src/c++23/Makefile.in: Regenerate.
> >
> > It looks like this broke bootstrap on FreeBSD 13/amd64:
> >
> > libtool: link: ( cd ".libs" && rm -f "libc++23convenience.la" && ln -s 
> > "../libc++23convenience.la" "libc++23convenience.la" )
> > std.cc:3799:14: error: exporting 'int feclearexcept(int)' that does not 
> > have external linkage
> >  3799 |   using std::feclearexcept;
> >       |              ^~~~~~~~~~~~~
> > In file included from 
> > /scratch/tmp/gerald/OBJ-0317-0208/x86_64-unknown-freebsd13.5/libstdc++-v3/include/fenv.h:41,
> >                  from 
> > /scratch/tmp/gerald/OBJ-0317-0208/x86_64-unknown-freebsd13.5/libstdc++-v3/include/cfenv:43,
> >                  from 
> > /scratch/tmp/gerald/OBJ-0317-0208/x86_64-unknown-freebsd13.5/libstdc++-v3/include/x86_64-unknown-freebsd13.5/bits/stdc++.h:123,
> >                  from std.cc:26:
> > /usr/include/fenv.h:265:1: note: 'int feclearexcept(int)' declared here 
> > with internal linkage
> >   265 | feclearexcept(int __excepts)
> >       | ^~~~~~~~~~~~~
> > std.cc:3801:14: error: exporting 'int fegetexceptflag(fexcept_t*, int)' 
> > that does not have external linkage
> >  3801 |   using std::fegetexceptflag;
> >       |              ^~~~~~~~~~~~~~~
> > /usr/include/fenv.h:283:1: note: 'int fegetexceptflag(fexcept_t*, int)' 
> > declared here with internal linkage
> >   283 | fegetexceptflag(fexcept_t *__flagp, int __excepts)
> >       | ^~~~~~~~~~~~~~~
> >   :
> > gmake[2]: *** [Makefile:17779: all-stage1-target-libstdc++-v3] Error 2
> > gmake[2]: Leaving directory '/scratch/tmp/gerald/OBJ-0317-0208'
> > gmake[1]: *** [Makefile:26906: stage1-bubble] Error 2
> > gmake[1]: Leaving directory '/scratch/tmp/gerald/OBJ-0317-0208'
> > gmake: *** [Makefile:27243: bootstrap] Error 2
> >
> >
> > Looking at /usr/include/fenv.h I see
> >
> >   #ifndef __fenv_static
> >   #define __fenv_static   static
> >   #endif
> >
> >   :
> >
> >   __fenv_static inline int
> >   feclearexcept(int __excepts)
> >   {
> >   :
> >   }
> >
> > I also found the same on a FreeBSD 15 system, so it's not just that older
> > release which is going to be EOL in two months.
>
> I'm pretty sure this is not conforming to the C standard:
> https://cigix.me/c23#7.1.2.p8
>
> This is going to be a problem for anybody trying to use the 'std'
> module on FreeBSD, it seems like I'm just the first person to ever try
> it :-)
>
> We might need to use fixincludes here.

Actually we do install our own wrapper of fenv.h so we could just do:

--- a/libstdc++-v3/config/os/bsd/freebsd/os_defines.h
+++ b/libstdc++-v3/config/os/bsd/freebsd/os_defines.h
@@ -53,4 +53,8 @@
// read(2) can return EINVAL for n >= INT_MAX.
#define _GLIBCXX_MAX_READ_SIZE (__INT_MAX__ - 1)

+// Ensure that inline functions in <fenv.h> have external linkage.
+#undef __fenv_static
+#define __fenv_static
+
#endif

(either in os_defines.h or in fenv.h)

Reply via email to