Get rid of `with_multisrctop`

Message ID 20250808230913.2774401-1-git@JohnEricson.me
State New
Headers
Series Get rid of `with_multisrctop` |

Commit Message

John Ericson Aug. 8, 2025, 11:09 p.m. UTC
  See the new comment in `config-ml.in`, and the email chain starting with
[1].

The short story is that I am trying to do a bunch of build system
improvements to GCC to make it easier to build GCC's runtime libraries
separately (see [1] for why). As part of this, I started looking at the
current multilib implementation, with a hunch that things could be
simpler, and with those simplifications, we could refine the idiomatic
division of labor between the outer and inner build systems in a way
that I think would be just better, and also would make the separate or
"per component" builds I want to do more maintainable.

In that linked thread I found variable/mechanism that looked unused, and
after some back and forth with Joseph Myers, we came to an agreement
that since GNU Make was mandatory now, and thus VPATH support was
assumed, there was no need to do these convoluted symlink tree things to
unnaturally allow multilib to get away with `srcdir = objdir` building.
(When indeed, `srcdir != objdir_for_machine1 != objdir_for_machine2` is
multilib in a nutshell.)

The last (as of this patch) email in the chain is Joseph writing:

> I think it's reasonable to eliminate such a workaround, but I don't know
> how the newlib community feels, should they wish to update the shared
> toplevel build infrastructure with changes from GCC.

This email is thus me submitting the same change (well, actually a
slightly improved one -- the `config-ml.in` comment is new, reflecting
what went on in the email thread) to ask you all that question.

If our reasoning looks correct, and you see no reason to support these
no-VPATH workarounds either, then we have our concensus! I think we can
land this change in both repos (GCC, newlib-cygwin), in either order (no
repo need wait on the other repo).

[1]: https://sourceware.org/pipermail/gcc-patches/2025-August/691963.html
[2]: https://blog.obsidian.systems/compiler-bootstrapping-in-nixpkgs/
[3]: https://sourceware.org/pipermail/gcc-patches/2025-August/692233.html

Signed-off-by: John Ericson <git@JohnEricson.me>
---
 config-ml.in        | 25 +++++++++++++------------
 config/multi.m4     |  7 +++----
 libgloss/configure  |  7 +++----
 newlib/acinclude.m4 |  6 +++---
 newlib/configure    | 11 +++++------
 5 files changed, 27 insertions(+), 29 deletions(-)
  

Comments

Joseph Myers Aug. 11, 2025, 8:09 p.m. UTC | #1
On Fri, 8 Aug 2025, John Ericson wrote:

> +# (Now though, GNU Make is required, and GNU Make always supports VPATH.
> +# We can therefore drop support for these symlink trees. And
> +# accordingly, we can know that ${srcdir}/.. always does what we expect
> +# in all supported configurations, and use that to further simplify this
> +# multilib infrastructure. These simplifications are not yet
> +# implemented.)

Removing multisrctop support without also removing the symlink tree code 
at the same time looks like it would cause a regression.
  

Patch

diff --git a/config-ml.in b/config-ml.in
index 5e519942b..6507e2a4f 100644
--- a/config-ml.in
+++ b/config-ml.in
@@ -35,9 +35,9 @@ 
 #
 # if [ "${srcdir}" = "." ] ; then
 #   if [ "${with_target_subdir}" != "." ] ; then
-#     . ${with_multisrctop}../../config-ml.in
+#     . ${srcdir}/../../config-ml.in
 #   else
-#     . ${with_multisrctop}../config-ml.in
+#     . ${srcdir}/../config-ml.in
 #   fi
 # else
 #   . ${srcdir}/../config-ml.in
@@ -47,9 +47,9 @@ 
 # Things are complicated because 6 separate cases must be handled:
 # 2 (native, cross) x 3 (absolute-path, relative-not-dot, dot) = 6.
 #
-# srcdir=. is special.  It must handle make programs that don't handle VPATH.
-# To implement this, a symlink tree is built for each library and for each
-# multilib subdir.
+# srcdir=. is special.  We used to want to handle make programs that
+# don't handle VPATH.  To implement this, a symlink tree is built for
+# each library and for each multilib subdir.
 #
 # The build tree is layed out as
 #
@@ -60,6 +60,13 @@ 
 #          m68881/
 #                 newlib
 #
+# (Now though, GNU Make is required, and GNU Make always supports VPATH.
+# We can therefore drop support for these symlink trees. And
+# accordingly, we can know that ${srcdir}/.. always does what we expect
+# in all supported configurations, and use that to further simplify this
+# multilib infrastructure. These simplifications are not yet
+# implemented.)
+#
 # The nice feature about this arrangement is that inter-library references
 # in the build tree work without having to care where you are.  Note that
 # inter-library references also work in the source tree because symlink trees
@@ -72,14 +79,10 @@ 
 # Configure variables:
 # ${with_target_subdir} = "." for native, or ${target_alias} for cross.
 # Set by top level Makefile.
-# ${with_multisrctop} = how many levels of multilibs there are in the source
-# tree.  It exists to handle the case of configuring in the source tree:
-# ${srcdir} is not constant.
 # ${with_multisubdir} = name of multilib subdirectory (eg: m68020/m68881).
 #
 # Makefile variables:
 # MULTISRCTOP = number of multilib levels in source tree (+1 if cross)
-# (FIXME: note that this is different than ${with_multisrctop}.  Check out.).
 # MULTIBUILDTOP = number of multilib levels in build tree
 # MULTIDIRS = list of multilib subdirs (eg: m68000 m68020 ...)
 # (only defined in each library's main Makefile).
@@ -709,7 +712,6 @@  if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then
       fi
       ml_newsrcdir="."
       ml_srcdiroption=
-      multisrctop=${dotdot}
       ;;
     *)
       case "${srcdir}" in
@@ -721,7 +723,6 @@  if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then
         ;;
       esac
       ml_srcdiroption="-srcdir=${ml_newsrcdir}"
-      multisrctop=
       ;;
     esac
 
@@ -867,7 +868,7 @@  if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then
     fi
 
     if eval ${ml_config_env} ${ml_config_shell} ${ml_recprog} \
-	--with-multisubdir=${ml_dir} --with-multisrctop=${multisrctop} \
+	--with-multisubdir=${ml_dir} \
 	"${ac_configure_args}" ${ml_config_env} ${ml_srcdiroption} ; then
       true
     else
diff --git a/config/multi.m4 b/config/multi.m4
index 5b62ecc0a..c3dc60b46 100644
--- a/config/multi.m4
+++ b/config/multi.m4
@@ -23,14 +23,14 @@  AC_ARG_ENABLE(multilib,
 	      [multilib=yes])
 
 # We may get other options which we leave undocumented:
-# --with-target-subdir, --with-multisrctop, --with-multisubdir
+# --with-target-subdir, --with-multisubdir
 # See config-ml.in if you want the gory details.
 
 if test "$srcdir" = "."; then
   if test "$with_target_subdir" != "."; then
-    multi_basedir="$srcdir/$with_multisrctop../$2"
+    multi_basedir="$srcdir/../$2"
   else
-    multi_basedir="$srcdir/$with_multisrctop$2"
+    multi_basedir="$srcdir/$2"
   fi
 else
   multi_basedir="$srcdir/$2"
@@ -57,7 +57,6 @@  srcdir="$srcdir"
 host="$host"
 target="$target"
 with_multisubdir="$with_multisubdir"
-with_multisrctop="$with_multisrctop"
 with_target_subdir="$with_target_subdir"
 ac_configure_args="${multilib_arg} ${ac_configure_args}"
 multi_basedir="$multi_basedir"
diff --git a/libgloss/configure b/libgloss/configure
index ba071824b..ca12e9b84 100755
--- a/libgloss/configure
+++ b/libgloss/configure
@@ -5652,14 +5652,14 @@  fi
 
 
 # We may get other options which we leave undocumented:
-# --with-target-subdir, --with-multisrctop, --with-multisubdir
+# --with-target-subdir, --with-multisubdir
 # See config-ml.in if you want the gory details.
 
 if test "$srcdir" = "."; then
   if test "$with_target_subdir" != "."; then
-    multi_basedir="$srcdir/$with_multisrctop../.."
+    multi_basedir="$srcdir/../.."
   else
-    multi_basedir="$srcdir/$with_multisrctop.."
+    multi_basedir="$srcdir/.."
   fi
 else
   multi_basedir="$srcdir/.."
@@ -6616,7 +6616,6 @@  srcdir="$srcdir"
 host="$host"
 target="$target"
 with_multisubdir="$with_multisubdir"
-with_multisrctop="$with_multisrctop"
 with_target_subdir="$with_target_subdir"
 ac_configure_args="${multilib_arg} ${ac_configure_args}"
 multi_basedir="$multi_basedir"
diff --git a/newlib/acinclude.m4 b/newlib/acinclude.m4
index 19301289f..9bd32f147 100644
--- a/newlib/acinclude.m4
+++ b/newlib/acinclude.m4
@@ -94,15 +94,15 @@  AC_ARG_ENABLE(newlib-fno-builtin,
 
 
 dnl We may get other options which we don't document:
-dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
+dnl --with-target-subdir, --with-multisubdir
 
 test -z "[$]{with_target_subdir}" && with_target_subdir=.
 
 if test "[$]{srcdir}" = "."; then
   if test "[$]{with_target_subdir}" != "."; then
-    newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
+    newlib_basedir="[$]{srcdir}/../$1"
   else
-    newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
+    newlib_basedir="[$]{srcdir}/$1"
   fi
 else
   newlib_basedir="[$]{srcdir}/$1"
diff --git a/newlib/configure b/newlib/configure
index 33a2ed1c5..a76dc8322 100755
--- a/newlib/configure
+++ b/newlib/configure
@@ -2648,14 +2648,14 @@  fi
 
 
 # We may get other options which we leave undocumented:
-# --with-target-subdir, --with-multisrctop, --with-multisubdir
+# --with-target-subdir, --with-multisubdir
 # See config-ml.in if you want the gory details.
 
 if test "$srcdir" = "."; then
   if test "$with_target_subdir" != "."; then
-    multi_basedir="$srcdir/$with_multisrctop../.."
+    multi_basedir="$srcdir/../.."
   else
-    multi_basedir="$srcdir/$with_multisrctop.."
+    multi_basedir="$srcdir/.."
   fi
 else
   multi_basedir="$srcdir/.."
@@ -4874,9 +4874,9 @@  test -z "${with_target_subdir}" && with_target_subdir=.
 
 if test "${srcdir}" = "."; then
   if test "${with_target_subdir}" != "."; then
-    newlib_basedir="${srcdir}/${with_multisrctop}../."
+    newlib_basedir="${srcdir}/../."
   else
-    newlib_basedir="${srcdir}/${with_multisrctop}."
+    newlib_basedir="${srcdir}/."
   fi
 else
   newlib_basedir="${srcdir}/."
@@ -8732,7 +8732,6 @@  srcdir="$srcdir"
 host="$host"
 target="$target"
 with_multisubdir="$with_multisubdir"
-with_multisrctop="$with_multisrctop"
 with_target_subdir="$with_target_subdir"
 ac_configure_args="${multilib_arg} ${ac_configure_args}"
 multi_basedir="$multi_basedir"