https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81878
--- Comment #18 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> all-gnattools: configure-gnattools
> @: $(MAKE); $(unstage)
> @r=`${PWD_COMMAND}`; export r; \
> s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> $(HOST_EXPORTS) \
> (cd $(HOST_SUBDIR)/gnattools && \
> $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
> $(STAGE1_FLAGS_TO_PASS) \
> $(TARGET-gnattools))
>
> so it builds for the host. But when bootstrapping we want to build it
> similar to if it were a target library, that is, with the just built GCC.
Yes, that's what happens, i.e. the CXX passed to gnattools is CXX_FOR_TARGET.
> So,
>
> host_modules= { module= gnattools; };
>
> is technically not correct. Not sure how it works during bootstrap, I'd have
> expected that the host compiler is used as well (gnattools is not
> bootstrapped).
This would simply break, because the gnattools really need to be bootstrapped
as they generally cannot be built by the host compiler. Quite puzzling indeed.