public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PR81878]: fix --disable-bootstrap --enable-languages=ada,         and cross-back gnattools build
@ 2018-11-12 12:00 Alexandre Oliva
  2018-11-12 12:04 ` Arnaud Charlet
  2018-11-13  8:17 ` Richard Biener
  0 siblings, 2 replies; 8+ messages in thread
From: Alexandre Oliva @ 2018-11-12 12:00 UTC (permalink / raw)
  To: gcc-patches; +Cc: Arnaud Charlet, Eric Botcazou, Pierre-Marie de Rodat

gnattools build machinery uses just-build xgcc and xg++ as $(CC) and
$(CXX) in native builds.  However, if C and C++ languages are not
enabled, it won't find them.  So, enable C and C++ if Ada is enabled.
Most of the time, this is probably no big deal: C is always enabled
anyway, and C++ is already enabled for bootstraps.

We need not enable those for cross builds, however.  At first I just
took the logic from gnattools/configure, but found it to be lacking:
it would use the just-built tools even in cross-back settings, whose
tools just built for the host would not run on the build machine.  So
I've narrowed down the test to rely on autoconf-detected cross-ness
(build->host only), but also to ensure that host matches build, and
that target matches host.

I've considered sourcing ada/config-lang.in from within
gnattools/configure, and testing lang_requires as set by it, so as to
avoid a duplication of tests that ought to remain in sync, but decided
it would be too fragile, as ada/config-lang.in does not expect srcdir
to refer to gnattools.


Please let me know if there are objections to this change in the next
few days, e.g., if enabling C and C++ for an Ada-only build is too
onerous.  It is certainly possible to rework gnattools build machinery
so that it uses CC and CXX as detected by the top-level configure if we
can't find xgcc and xg++ in ../gcc.  At least in cross builds, we
already require build-time Ada tools to have the same version as that
we're cross-building, so we might as well use preexisting gcc and g++
under the same requirements.


for  gcc/ada/gcc-interface/ChangeLog

	PR ada/81878
	* config-lang.in (lang_requires): Set to "c c++" when
	gnattools wants it.

for  gnattools/ChangeLog

	PR ada/81878
	* configure.ac (default_gnattools_target): Do not mistake
	just-built host tools as native in cross-back toolchains.
	* configure: Rebuilt.
---
 gcc/ada/gcc-interface/config-lang.in |    9 +++++++++
 gnattools/configure                  |   32 ++++++++++++++++++++++----------
 gnattools/configure.ac               |   30 +++++++++++++++++++++---------
 3 files changed, 52 insertions(+), 19 deletions(-)

diff --git a/gcc/ada/gcc-interface/config-lang.in b/gcc/ada/gcc-interface/config-lang.in
index 5dc77df282ce..8eacf7bb870e 100644
--- a/gcc/ada/gcc-interface/config-lang.in
+++ b/gcc/ada/gcc-interface/config-lang.in
@@ -34,6 +34,15 @@ gtfiles="\$(srcdir)/ada/gcc-interface/ada-tree.h \$(srcdir)/ada/gcc-interface/gi
 
 outputs="ada/gcc-interface/Makefile ada/Makefile"
 
+# gnattools native builds use both $(CC) and $(CXX), see PR81878.
+# This is not too onerous: C is always enabled anyway, and C++ is
+# always enabled for bootstrapping.  Use here the same logic used in
+# gnattools/configure to decide whether to use -native or -cross tools
+# for the build.
+if test "x$cross_compiling/$build/$host" = "xno/$host/$target" ; then
+  lang_requires="c c++"
+fi
+
 target_libs="target-libada"
 lang_dirs="gnattools"
 
diff --git a/gnattools/configure b/gnattools/configure
index ccb512e39b6b..c2d755b723a9 100755
--- a/gnattools/configure
+++ b/gnattools/configure
@@ -584,6 +584,7 @@ PACKAGE_URL=
 ac_unique_file="Makefile.in"
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+default_gnattools_target
 warn_cflags
 OBJEXT
 EXEEXT
@@ -595,7 +596,6 @@ CC
 ADA_CFLAGS
 EXTRA_GNATTOOLS
 TOOLS_TARGET_PAIRS
-default_gnattools_target
 LN_S
 target_noncanonical
 host_noncanonical
@@ -2050,15 +2050,6 @@ $as_echo "no, using $LN_S" >&6; }
 fi
 
 
-# Determine what to build for 'gnattools'
-if test $build = $target ; then
-  # Note that build=target is almost certainly the wrong test; FIXME
-  default_gnattools_target="gnattools-native"
-else
-  default_gnattools_target="gnattools-cross"
-fi
-
-
 # Target-specific stuff (defaults)
 TOOLS_TARGET_PAIRS=
 
@@ -2134,6 +2125,8 @@ esac
 # From user or toplevel makefile.
 
 
+# This is testing the CC passed from the toplevel Makefile, not the
+# one we will select below.
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -2929,6 +2922,25 @@ if test "x$GCC" = "xyes"; then
 fi
 
 
+# Determine what to build for 'gnattools'.  Test after the above,
+# because testing for CC sets the final value of cross_compiling, even
+# if we end up using a different CC.  We want to build
+# gnattools-native when: (a) this is a native build, i.e.,
+# cross_compiling=no, otherwise we know we cannot run binaries
+# produced by the toolchain used for the build, not even the binaries
+# created within ../gcc/; (b) build and host are the same, otherwise
+# this is to be regarded as a cross build environment even if it seems
+# that we can run host binaries; (c) host and target are the same,
+# otherwise the tools in ../gcc/ generate code for a different
+# platform.  If you change this test, be sure to adjust
+# ../gcc/ada/gcc-interface/config-lang.in as well.
+if test "x$cross_compiling/$build/$host" = "xno/$host/$target" ; then
+  default_gnattools_target="gnattools-native"
+else
+  default_gnattools_target="gnattools-cross"
+fi
+
+
 # Output: create a Makefile.
 ac_config_files="$ac_config_files Makefile"
 
diff --git a/gnattools/configure.ac b/gnattools/configure.ac
index 0a94224a5362..40d015ce8b0d 100644
--- a/gnattools/configure.ac
+++ b/gnattools/configure.ac
@@ -51,15 +51,6 @@ ACX_NONCANONICAL_TARGET
 # Need to pass this down for now :-P
 AC_PROG_LN_S
 
-# Determine what to build for 'gnattools'
-if test $build = $target ; then
-  # Note that build=target is almost certainly the wrong test; FIXME
-  default_gnattools_target="gnattools-native"
-else
-  default_gnattools_target="gnattools-cross"
-fi
-AC_SUBST([default_gnattools_target])
-
 # Target-specific stuff (defaults)
 TOOLS_TARGET_PAIRS=
 AC_SUBST(TOOLS_TARGET_PAIRS)
@@ -135,6 +126,8 @@ esac
 # From user or toplevel makefile.
 AC_SUBST(ADA_CFLAGS)
 
+# This is testing the CC passed from the toplevel Makefile, not the
+# one we will select below.
 AC_PROG_CC
 warn_cflags=
 if test "x$GCC" = "xyes"; then
@@ -142,6 +135,25 @@ if test "x$GCC" = "xyes"; then
 fi
 AC_SUBST(warn_cflags)
 
+# Determine what to build for 'gnattools'.  Test after the above,
+# because testing for CC sets the final value of cross_compiling, even
+# if we end up using a different CC.  We want to build
+# gnattools-native when: (a) this is a native build, i.e.,
+# cross_compiling=no, otherwise we know we cannot run binaries
+# produced by the toolchain used for the build, not even the binaries
+# created within ../gcc/; (b) build and host are the same, otherwise
+# this is to be regarded as a cross build environment even if it seems
+# that we can run host binaries; (c) host and target are the same,
+# otherwise the tools in ../gcc/ generate code for a different
+# platform.  If you change this test, be sure to adjust
+# ../gcc/ada/gcc-interface/config-lang.in as well.
+if test "x$cross_compiling/$build/$host" = "xno/$host/$target" ; then
+  default_gnattools_target="gnattools-native"
+else
+  default_gnattools_target="gnattools-cross"
+fi
+AC_SUBST([default_gnattools_target])
+
 # Output: create a Makefile.
 AC_CONFIG_FILES([Makefile])
 


-- 
Alexandre Oliva, freedom fighter   https://FSFLA.org/blogs/lxo
Be the change, be Free!         FSF Latin America board member
GNU Toolchain Engineer                Free Software Evangelist
Hay que enGNUrecerse, pero sin perder la terGNUra jamás-GNUChe

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PR81878]: fix --disable-bootstrap --enable-languages=ada, and cross-back gnattools build
  2018-11-12 12:00 [PR81878]: fix --disable-bootstrap --enable-languages=ada, and cross-back gnattools build Alexandre Oliva
@ 2018-11-12 12:04 ` Arnaud Charlet
  2018-11-13  8:17 ` Richard Biener
  1 sibling, 0 replies; 8+ messages in thread
From: Arnaud Charlet @ 2018-11-12 12:04 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: gcc-patches, Eric Botcazou, Pierre-Marie de Rodat

> I've considered sourcing ada/config-lang.in from within
> gnattools/configure, and testing lang_requires as set by it, so as to
> avoid a duplication of tests that ought to remain in sync, but decided
> it would be too fragile, as ada/config-lang.in does not expect srcdir
> to refer to gnattools.
> 
> Please let me know if there are objections to this change in the next
> few days, e.g., if enabling C and C++ for an Ada-only build is too
> onerous.  It is certainly possible to rework gnattools build machinery
> so that it uses CC and CXX as detected by the top-level configure if we
> can't find xgcc and xg++ in ../gcc.  At least in cross builds, we
> already require build-time Ada tools to have the same version as that
> we're cross-building, so we might as well use preexisting gcc and g++
> under the same requirements.

No objection from me assuming it doesn't again break some builds in subtle
ways :-) (In which case we'll have to revert again).

Arno

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PR81878]: fix --disable-bootstrap --enable-languages=ada, and cross-back gnattools build
  2018-11-12 12:00 [PR81878]: fix --disable-bootstrap --enable-languages=ada, and cross-back gnattools build Alexandre Oliva
  2018-11-12 12:04 ` Arnaud Charlet
@ 2018-11-13  8:17 ` Richard Biener
  2018-11-13 13:10   ` Alexandre Oliva
  1 sibling, 1 reply; 8+ messages in thread
From: Richard Biener @ 2018-11-13  8:17 UTC (permalink / raw)
  To: oliva; +Cc: GCC Patches, Arnaud Charlet, Eric Botcazou, Pierre-Marie de Rodat

On Mon, Nov 12, 2018 at 1:00 PM Alexandre Oliva <oliva@adacore.com> wrote:
>
> gnattools build machinery uses just-build xgcc and xg++ as $(CC) and
> $(CXX) in native builds.  However, if C and C++ languages are not
> enabled, it won't find them.  So, enable C and C++ if Ada is enabled.
> Most of the time, this is probably no big deal: C is always enabled
> anyway, and C++ is already enabled for bootstraps.
>
> We need not enable those for cross builds, however.  At first I just
> took the logic from gnattools/configure, but found it to be lacking:
> it would use the just-built tools even in cross-back settings, whose
> tools just built for the host would not run on the build machine.  So
> I've narrowed down the test to rely on autoconf-detected cross-ness
> (build->host only), but also to ensure that host matches build, and
> that target matches host.
>
> I've considered sourcing ada/config-lang.in from within
> gnattools/configure, and testing lang_requires as set by it, so as to
> avoid a duplication of tests that ought to remain in sync, but decided
> it would be too fragile, as ada/config-lang.in does not expect srcdir
> to refer to gnattools.
>
>
> Please let me know if there are objections to this change in the next
> few days, e.g., if enabling C and C++ for an Ada-only build is too
> onerous.  It is certainly possible to rework gnattools build machinery
> so that it uses CC and CXX as detected by the top-level configure if we
> can't find xgcc and xg++ in ../gcc.

I really wonder why we not _always_ do this for consistency given we
already require a host Ada compiler.  It really makes things more messy
than required...

>  At least in cross builds, we
> already require build-time Ada tools to have the same version as that
> we're cross-building, so we might as well use preexisting gcc and g++
> under the same requirements.
>
>
> for  gcc/ada/gcc-interface/ChangeLog
>
>         PR ada/81878
>         * config-lang.in (lang_requires): Set to "c c++" when
>         gnattools wants it.
>
> for  gnattools/ChangeLog
>
>         PR ada/81878
>         * configure.ac (default_gnattools_target): Do not mistake
>         just-built host tools as native in cross-back toolchains.
>         * configure: Rebuilt.
> ---
>  gcc/ada/gcc-interface/config-lang.in |    9 +++++++++
>  gnattools/configure                  |   32 ++++++++++++++++++++++----------
>  gnattools/configure.ac               |   30 +++++++++++++++++++++---------
>  3 files changed, 52 insertions(+), 19 deletions(-)
>
> diff --git a/gcc/ada/gcc-interface/config-lang.in b/gcc/ada/gcc-interface/config-lang.in
> index 5dc77df282ce..8eacf7bb870e 100644
> --- a/gcc/ada/gcc-interface/config-lang.in
> +++ b/gcc/ada/gcc-interface/config-lang.in
> @@ -34,6 +34,15 @@ gtfiles="\$(srcdir)/ada/gcc-interface/ada-tree.h \$(srcdir)/ada/gcc-interface/gi
>
>  outputs="ada/gcc-interface/Makefile ada/Makefile"
>
> +# gnattools native builds use both $(CC) and $(CXX), see PR81878.
> +# This is not too onerous: C is always enabled anyway, and C++ is
> +# always enabled for bootstrapping.  Use here the same logic used in
> +# gnattools/configure to decide whether to use -native or -cross tools
> +# for the build.
> +if test "x$cross_compiling/$build/$host" = "xno/$host/$target" ; then
> +  lang_requires="c c++"
> +fi
> +
>  target_libs="target-libada"
>  lang_dirs="gnattools"
>
> diff --git a/gnattools/configure b/gnattools/configure
> index ccb512e39b6b..c2d755b723a9 100755
> --- a/gnattools/configure
> +++ b/gnattools/configure
> @@ -584,6 +584,7 @@ PACKAGE_URL=
>  ac_unique_file="Makefile.in"
>  ac_subst_vars='LTLIBOBJS
>  LIBOBJS
> +default_gnattools_target
>  warn_cflags
>  OBJEXT
>  EXEEXT
> @@ -595,7 +596,6 @@ CC
>  ADA_CFLAGS
>  EXTRA_GNATTOOLS
>  TOOLS_TARGET_PAIRS
> -default_gnattools_target
>  LN_S
>  target_noncanonical
>  host_noncanonical
> @@ -2050,15 +2050,6 @@ $as_echo "no, using $LN_S" >&6; }
>  fi
>
>
> -# Determine what to build for 'gnattools'
> -if test $build = $target ; then
> -  # Note that build=target is almost certainly the wrong test; FIXME
> -  default_gnattools_target="gnattools-native"
> -else
> -  default_gnattools_target="gnattools-cross"
> -fi
> -
> -
>  # Target-specific stuff (defaults)
>  TOOLS_TARGET_PAIRS=
>
> @@ -2134,6 +2125,8 @@ esac
>  # From user or toplevel makefile.
>
>
> +# This is testing the CC passed from the toplevel Makefile, not the
> +# one we will select below.
>  ac_ext=c
>  ac_cpp='$CPP $CPPFLAGS'
>  ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
> @@ -2929,6 +2922,25 @@ if test "x$GCC" = "xyes"; then
>  fi
>
>
> +# Determine what to build for 'gnattools'.  Test after the above,
> +# because testing for CC sets the final value of cross_compiling, even
> +# if we end up using a different CC.  We want to build
> +# gnattools-native when: (a) this is a native build, i.e.,
> +# cross_compiling=no, otherwise we know we cannot run binaries
> +# produced by the toolchain used for the build, not even the binaries
> +# created within ../gcc/; (b) build and host are the same, otherwise
> +# this is to be regarded as a cross build environment even if it seems
> +# that we can run host binaries; (c) host and target are the same,
> +# otherwise the tools in ../gcc/ generate code for a different
> +# platform.  If you change this test, be sure to adjust
> +# ../gcc/ada/gcc-interface/config-lang.in as well.
> +if test "x$cross_compiling/$build/$host" = "xno/$host/$target" ; then
> +  default_gnattools_target="gnattools-native"
> +else
> +  default_gnattools_target="gnattools-cross"
> +fi
> +
> +
>  # Output: create a Makefile.
>  ac_config_files="$ac_config_files Makefile"
>
> diff --git a/gnattools/configure.ac b/gnattools/configure.ac
> index 0a94224a5362..40d015ce8b0d 100644
> --- a/gnattools/configure.ac
> +++ b/gnattools/configure.ac
> @@ -51,15 +51,6 @@ ACX_NONCANONICAL_TARGET
>  # Need to pass this down for now :-P
>  AC_PROG_LN_S
>
> -# Determine what to build for 'gnattools'
> -if test $build = $target ; then
> -  # Note that build=target is almost certainly the wrong test; FIXME
> -  default_gnattools_target="gnattools-native"
> -else
> -  default_gnattools_target="gnattools-cross"
> -fi
> -AC_SUBST([default_gnattools_target])
> -
>  # Target-specific stuff (defaults)
>  TOOLS_TARGET_PAIRS=
>  AC_SUBST(TOOLS_TARGET_PAIRS)
> @@ -135,6 +126,8 @@ esac
>  # From user or toplevel makefile.
>  AC_SUBST(ADA_CFLAGS)
>
> +# This is testing the CC passed from the toplevel Makefile, not the
> +# one we will select below.
>  AC_PROG_CC
>  warn_cflags=
>  if test "x$GCC" = "xyes"; then
> @@ -142,6 +135,25 @@ if test "x$GCC" = "xyes"; then
>  fi
>  AC_SUBST(warn_cflags)
>
> +# Determine what to build for 'gnattools'.  Test after the above,
> +# because testing for CC sets the final value of cross_compiling, even
> +# if we end up using a different CC.  We want to build
> +# gnattools-native when: (a) this is a native build, i.e.,
> +# cross_compiling=no, otherwise we know we cannot run binaries
> +# produced by the toolchain used for the build, not even the binaries
> +# created within ../gcc/; (b) build and host are the same, otherwise
> +# this is to be regarded as a cross build environment even if it seems
> +# that we can run host binaries; (c) host and target are the same,
> +# otherwise the tools in ../gcc/ generate code for a different
> +# platform.  If you change this test, be sure to adjust
> +# ../gcc/ada/gcc-interface/config-lang.in as well.
> +if test "x$cross_compiling/$build/$host" = "xno/$host/$target" ; then
> +  default_gnattools_target="gnattools-native"
> +else
> +  default_gnattools_target="gnattools-cross"
> +fi
> +AC_SUBST([default_gnattools_target])
> +
>  # Output: create a Makefile.
>  AC_CONFIG_FILES([Makefile])
>
>
>
> --
> Alexandre Oliva, freedom fighter   https://FSFLA.org/blogs/lxo
> Be the change, be Free!         FSF Latin America board member
> GNU Toolchain Engineer                Free Software Evangelist
> Hay que enGNUrecerse, pero sin perder la terGNUra jamás-GNUChe

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PR81878]: fix --disable-bootstrap --enable-languages=ada, and cross-back gnattools build
  2018-11-13  8:17 ` Richard Biener
@ 2018-11-13 13:10   ` Alexandre Oliva
  2018-11-13 14:38     ` Richard Biener
  0 siblings, 1 reply; 8+ messages in thread
From: Alexandre Oliva @ 2018-11-13 13:10 UTC (permalink / raw)
  To: Richard Biener
  Cc: GCC Patches, Arnaud Charlet, Eric Botcazou, Pierre-Marie de Rodat

On Nov 13, 2018, Richard Biener <richard.guenther@gmail.com> wrote:

>> Please let me know if there are objections to this change in the next
>> few days, e.g., if enabling C and C++ for an Ada-only build is too
>> onerous.  It is certainly possible to rework gnattools build machinery
>> so that it uses CC and CXX as detected by the top-level configure if we
>> can't find xgcc and xg++ in ../gcc.

> I really wonder why we not _always_ do this for consistency given we
> already require a host Ada compiler.

Sorry, I can't tell what the 'this' refers to.  Enabling C and C++ for
an Ada-only build?  Reworking gnattools build machinery to use top-level
CC and CXX?  Something else?

FWIW, I see the the point of using the just-built gcc/g++ if it's there
and usable: considering the checks for different versions of Ada
compilers, you really want to use the last stage of the bootstrap to
build tools linked with the runtime built with it.  It seems to me you'd
run into a catch-22 without that.

-- 
Alexandre Oliva, freedom fighter   https://FSFLA.org/blogs/lxo
Be the change, be Free!         FSF Latin America board member
GNU Toolchain Engineer                Free Software Evangelist
Hay que enGNUrecerse, pero sin perder la terGNUra jamás-GNUChe

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PR81878]: fix --disable-bootstrap --enable-languages=ada, and cross-back gnattools build
  2018-11-13 13:10   ` Alexandre Oliva
@ 2018-11-13 14:38     ` Richard Biener
  2018-11-13 15:51       ` Alexandre Oliva
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Biener @ 2018-11-13 14:38 UTC (permalink / raw)
  To: oliva; +Cc: GCC Patches, Arnaud Charlet, Eric Botcazou, Pierre-Marie de Rodat

On Tue, Nov 13, 2018 at 2:10 PM Alexandre Oliva <oliva@adacore.com> wrote:
>
> On Nov 13, 2018, Richard Biener <richard.guenther@gmail.com> wrote:
>
> >> Please let me know if there are objections to this change in the next
> >> few days, e.g., if enabling C and C++ for an Ada-only build is too
> >> onerous.  It is certainly possible to rework gnattools build machinery
> >> so that it uses CC and CXX as detected by the top-level configure if we
> >> can't find xgcc and xg++ in ../gcc.
>
> > I really wonder why we not _always_ do this for consistency given we
> > already require a host Ada compiler.
>
> Sorry, I can't tell what the 'this' refers to.  Enabling C and C++ for
> an Ada-only build?  Reworking gnattools build machinery to use top-level
> CC and CXX?  Something else?

Reworking gnattools build to always use host CC/CXX in "stage1" (or for crosses)
rather than doing sth different.  That would also not require C++ to be enabled
for crosses.

> FWIW, I see the the point of using the just-built gcc/g++ if it's there
> and usable: considering the checks for different versions of Ada
> compilers, you really want to use the last stage of the bootstrap to
> build tools linked with the runtime built with it.  It seems to me you'd
> run into a catch-22 without that.

Yeah, but gnattools is bootstrapped, right?  For --disable-bootstrap
you get binaries built with the host compiler throughout and that's
good.  IIRC I originally stumbled across this with --disable-bootstrap.

Richard.

>
> --
> Alexandre Oliva, freedom fighter   https://FSFLA.org/blogs/lxo
> Be the change, be Free!         FSF Latin America board member
> GNU Toolchain Engineer                Free Software Evangelist
> Hay que enGNUrecerse, pero sin perder la terGNUra jamás-GNUChe

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PR81878]: fix --disable-bootstrap --enable-languages=ada, and cross-back gnattools build
  2018-11-13 14:38     ` Richard Biener
@ 2018-11-13 15:51       ` Alexandre Oliva
  2018-11-13 16:40         ` Richard Biener
  0 siblings, 1 reply; 8+ messages in thread
From: Alexandre Oliva @ 2018-11-13 15:51 UTC (permalink / raw)
  To: Richard Biener
  Cc: GCC Patches, Arnaud Charlet, Eric Botcazou, Pierre-Marie de Rodat

On Nov 13, 2018, Richard Biener <richard.guenther@gmail.com> wrote:

> Reworking gnattools build to always use host CC/CXX in "stage1" (or for crosses)
> rather than doing sth different.

> Yeah, but gnattools is bootstrapped, right?

No, it's not built in stage1, it's a post-bootstrap host subpackage.

> For --disable-bootstrap you get binaries built with the host compiler
> throughout and that's good.

I guess it *could* be built with the host compiler, and linked with that
runtime.  Then, in order to run it, you might still need the previous
gnat rts shared libs.  Just like for a non-bootstrapped compiler
front-end, yeah.

Whereas for a bootstrapped compiler, you'd want to use what, the stage2
compiler, that built other final host tools, to build gnattools as well?

All doable, but not without additional complexity.  I'm afraid I fail to
see the upside.

Unfortunately we don't have a lot of other post-bootstrap host tools
linked (on native builds) with target libraries to draw parallels.  I
guess we could reason about them as if they were part of the gcc/
subdir, and this would lead down the path you suggest.  I will then
point to the complications arising from using a just-built libstdc++ in
subsequent stages, and in later target builds in the same stage, and
conclude it's far from trivial, it's actually quite error-prone and
hardly glitch-free, and so it's not too hard to understand why gnat,
that had to take care of this before we even thought of bootstrapping
libstdc++, took a different path.

Anyway...  I won't take your suggestion as an objection to the proposed
patch, but I will say that I still have a lot to learn about the Ada
build machinery to be able to grasp the impact your suggestion might
have on existing uses, so, as much as I like uniformity and symmetry,
I'm not jumping right onto it ;-)

-- 
Alexandre Oliva, freedom fighter   https://FSFLA.org/blogs/lxo
Be the change, be Free!         FSF Latin America board member
GNU Toolchain Engineer                Free Software Evangelist
Hay que enGNUrecerse, pero sin perder la terGNUra jamás-GNUChe

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PR81878]: fix --disable-bootstrap --enable-languages=ada, and cross-back gnattools build
  2018-11-13 15:51       ` Alexandre Oliva
@ 2018-11-13 16:40         ` Richard Biener
  2018-11-14 13:20           ` Arnaud Charlet
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Biener @ 2018-11-13 16:40 UTC (permalink / raw)
  To: oliva; +Cc: GCC Patches, Arnaud Charlet, Eric Botcazou, Pierre-Marie de Rodat

On Tue, Nov 13, 2018 at 4:51 PM Alexandre Oliva <oliva@adacore.com> wrote:
>
> On Nov 13, 2018, Richard Biener <richard.guenther@gmail.com> wrote:
>
> > Reworking gnattools build to always use host CC/CXX in "stage1" (or for crosses)
> > rather than doing sth different.
>
> > Yeah, but gnattools is bootstrapped, right?
>
> No, it's not built in stage1, it's a post-bootstrap host subpackage.

Huh, indeed - it's a host_module without bootstrap ...  and libada is
a target_module not bootstrapped either.  So we're indeed in a curious
situation where we have a bootstrap of Ada requiring a host Ada but
nothing of Ada is actually bootstrapped ... ;)

> > For --disable-bootstrap you get binaries built with the host compiler
> > throughout and that's good.
>
> I guess it *could* be built with the host compiler, and linked with that
> runtime.  Then, in order to run it, you might still need the previous
> gnat rts shared libs.  Just like for a non-bootstrapped compiler
> front-end, yeah.

Yeah, I expected that for non-bootstrap.  And I somehow assumed it
was bootstrapped so I'd get gnattools and gnat1 not depending on the
host compiler libs.  I guess we're lucky for gnat1 because it's written
in C?

At least I now somewhat understand why we wind up with the
bootstrapped CC/CXX for the build of the stage3 host modules.

>
> Whereas for a bootstrapped compiler, you'd want to use what, the stage2
> compiler, that built other final host tools, to build gnattools as well?
>
> All doable, but not without additional complexity.  I'm afraid I fail to
> see the upside.
>
> Unfortunately we don't have a lot of other post-bootstrap host tools
> linked (on native builds) with target libraries to draw parallels.  I
> guess we could reason about them as if they were part of the gcc/
> subdir, and this would lead down the path you suggest.  I will then
> point to the complications arising from using a just-built libstdc++ in
> subsequent stages, and in later target builds in the same stage, and
> conclude it's far from trivial, it's actually quite error-prone and
> hardly glitch-free, and so it's not too hard to understand why gnat,
> that had to take care of this before we even thought of bootstrapping
> libstdc++, took a different path.
>
> Anyway...  I won't take your suggestion as an objection to the proposed
> patch, but I will say that I still have a lot to learn about the Ada
> build machinery to be able to grasp the impact your suggestion might
> have on existing uses, so, as much as I like uniformity and symmetry,
> I'm not jumping right onto it ;-)

;)

Richard.

>
> --
> Alexandre Oliva, freedom fighter   https://FSFLA.org/blogs/lxo
> Be the change, be Free!         FSF Latin America board member
> GNU Toolchain Engineer                Free Software Evangelist
> Hay que enGNUrecerse, pero sin perder la terGNUra jamás-GNUChe

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PR81878]: fix --disable-bootstrap --enable-languages=ada, and cross-back gnattools build
  2018-11-13 16:40         ` Richard Biener
@ 2018-11-14 13:20           ` Arnaud Charlet
  0 siblings, 0 replies; 8+ messages in thread
From: Arnaud Charlet @ 2018-11-14 13:20 UTC (permalink / raw)
  To: Richard Biener; +Cc: oliva, GCC Patches, Eric Botcazou, Pierre-Marie de Rodat

> Huh, indeed - it's a host_module without bootstrap ...  and libada is
> a target_module not bootstrapped either.  So we're indeed in a curious
> situation where we have a bootstrap of Ada requiring a host Ada but
> nothing of Ada is actually bootstrapped ... ;)

Not sure what you mean by that, all the files needed to compile gnat1 and
gnatbind (which includes most of the files under gcc/gcc/ada and all the files
under gcc/gcc/ada/gcc-interface) are boostrapped. What's not bootstrapped are
the Ada runtime (only a subset is as part of bootstrapping gnat1/gnatbind)
and Ada tools.

If we were starting from scratch, we would indeed likely have a different
and simpler bootstrap scheme where:

- we first build gnat1 only
- then we build the Ada runtime (libgnat/libgnarl)
- then we build Ada tools (gnatbind, gnatlink, gnatmake, etc...)

and then we iterate again for stage2 and stage3 on the above using the
previously built toolchain.

Doing the above at this stage and given the complexity of the GCC Makefiles
would require a lot of complex and error prone work, not sure it's worth the
trouble and it would likely take a lot of time and effort to get all the
combinations of possible builds (including all complex cases of
"standard" cross and canadian cross builds) working.

> Yeah, I expected that for non-bootstrap.  And I somehow assumed it
> was bootstrapped so I'd get gnattools and gnat1 not depending on the
> host compiler libs.  I guess we're lucky for gnat1 because it's written
> in C?

gnat1 is written mostly in Ada not in C (most of the Ada files under
gcc/gcc/ada are used for gnat1).

Arno

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-11-14 13:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-12 12:00 [PR81878]: fix --disable-bootstrap --enable-languages=ada, and cross-back gnattools build Alexandre Oliva
2018-11-12 12:04 ` Arnaud Charlet
2018-11-13  8:17 ` Richard Biener
2018-11-13 13:10   ` Alexandre Oliva
2018-11-13 14:38     ` Richard Biener
2018-11-13 15:51       ` Alexandre Oliva
2018-11-13 16:40         ` Richard Biener
2018-11-14 13:20           ` Arnaud Charlet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).