On Mon, Oct 14, 2024 at 10:23:22AM -0400, David Malcolm wrote:
> On Mon, 2024-10-14 at 15:13 +0200, Jakub Jelinek wrote:
> > Hi!
> > 
> > My recent changes to genmatch apparently broke bootstrap on FreeBSD
> > and Darwin and perhaps others, and also broke $build != $host
> > builds including canadian cross.
> > 
> > The change was to link in libcommon.a into build/genmatch, so that
> > we can use pp_format_verbatim.  Unfortunately that has various
> > dependencies in libcommon.a, and more importantly, libcommon.a is
> > a host library, while build/genmatch carefully links with build/vec.o
> > etc., build version of libcpp.
> > So, in order to use pretty-print.o stuff, we'd need to build a build/
> > version of all those objects and worse ensure there is and we
> > properly
> > link build version of libintl and/or libiconv when needed (those 2
> > are
> > the reasons for FreeBSD/Darwin failures).
> 
> Possibly a silly idea, but rather than reimplementing pretty-print,
> could it be possible to provide a stub version of libintl etc at build
> time that doesn't do any internalization?

That was my first thought, but I'm afraid that is hard, because libintl
nor libiconv aren't included in gcc tree anymore, so one doesn't really
know what functions it needs to stub (whether gettext, ngettext, etc., or
libintl_gettext, libintl_ngettext, etc., or something else).
And more importantly, we'd need to build build/ versions of all of
libcommon.a as well (at least for the stage1 or cross compilers case).

> Would it be possible to use fmemopen or fopencookie on configurations
> that support those?

That would be possible, sure.  But I'm not really sure if the selftest
infrastructure is usable in the generator programs, we'd need a build/
version of selftest.o at least, and possibly any dependencies.

Though sure, I could just do the checks with gcc_unreachable ()
or something similar, just would need checks for fmemopen/fopencookie
in configure.  Though, that complicates stuff again, because I think
auto-host.h checks are for host, not build.
Maybe just hack it up under
#ifdef __GLIBC_PREREQ
#if __GLIBC_PREREQ (2, 30)
or whatever (likely fmemopen is much older).

        Jakub

Reply via email to