Re: [PATCH v2] Get rid of `with_multisrctop`, and `MULTISRCTOP`
Jeff Johnston <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <CAOox84t7Jzzsja+fYzs1wD8mLfUzv+wTv+wLRQb7-+mqVAogXw@mail.gmail.com> |
According to your comment below, you don't have it working for multilib newlib. Regarding a test - you can try and build aarch64-none-elf. That will build a default newlib and one in an ilp32 multilib directory. -- Jeff J. On Thu, Aug 21, 2025 at 2:29 PM John Ericson <[email protected]> wrote: > Any further feedback on this? Should I just go ahead and remake the patch > to GCC likewise, too? > > John > > On Wed, Aug 13, 2025, at 4:07 PM, John Ericson wrote: > > 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 multilib version of this change > first, 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). > > N.B. I am not exactly sure how to test this. I have tested that it > doesn't break the a non-multilib build of newlib. But when I try to do a > multilib build in this repo with the toplevel makefile, it doesn't want > build anything. > > config/ChangeLog: > > * multi.m4: Simplify, no more srcdir = . special case needed. > > ChangeLog: > > * newlib/acinclude.m4: Simplify, no more srcdir = . special case needed. > * symlink-tree: Removed. It is no longer needed by anything. > * MAINTAINERS: Remove symlink-tree entry. > * etc/update-copyright.py: Remove symlink-tree entry. > * src-release: Remove symlink-tree entry. > * config-ml.in: Simplify a bunch, and reword docs to explain > status quo: It's simpler than past, but can't yet forget about past > until tech debt is gone. > * libgloss/configure: Regenerate. > * newlib/configure: Regenerate. > > [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 <[email protected]> > --- > MAINTAINERS | 4 -- > config-ml.in | 110 ++++++++++++---------------------------- > config/multi.m4 | 13 +---- > etc/update-copyright.py | 1 - > libgloss/Makefile.in | 1 - > libgloss/configure | 13 +---- > multilib.am | 1 - > newlib/Makefile.in | 1 - > newlib/acinclude.m4 | 12 +---- > newlib/configure | 23 ++------- > src-release | 2 +- > symlink-tree | 78 ---------------------------- > 12 files changed, 42 insertions(+), 217 deletions(-) > delete mode 100755 symlink-tree > > diff --git a/MAINTAINERS b/MAINTAINERS > index dd8601b4f..a479ea3d9 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -73,10 +73,6 @@ ltconfig; ltmain.sh; ltcf-*.sh > move-if-change > Send bug reports and patches to [email protected]. > > -symlink-tree > - gcc: http://gcc.gnu.org > - See libiberty. > - > newlib/; libgloss/ > http://sourceware.org/newlib/ > Patches to [email protected]. > diff --git a/config-ml.in b/config-ml.in > index 5e519942b..56b6abae2 100644 > --- a/config-ml.in > +++ b/config-ml.in > @@ -30,28 +30,19 @@ > # It is advisable to support a few --enable/--disable options to let the > # user select which libraries s/he really wants. > # > -# Subdirectories wishing to use multilib should put the following lines > +# Subdirectories wishing to use multilib should put the following line > # in the "post-target" section of configure.ac. > # > -# if [ "${srcdir}" = "." ] ; then > -# if [ "${with_target_subdir}" != "." ] ; then > -# . ${with_multisrctop}../../config-ml.in > -# else > -# . ${with_multisrctop}../config-ml.in > -# fi > -# else > -# . ${srcdir}/../config-ml.in > -# fi > -# > +# . ${srcdir}/../config-ml.in > # > # 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=. was formerly special. We used to want to handle make > +# programs that don't handle VPATH. To implement this, a symlink tree > +# was built for each library and for each multilib subdir. > # > -# The build tree is layed out as > +# The build tree was laid out as > # > # ./ > # newlib > @@ -60,6 +51,24 @@ > # m68881/ > # newlib > # > +# In such a symlink tree, the source code *files* of newlib were linked > +# into each location, but the "newlib" directories themselves were > +# actual separate directories, to hold different different build > +# artifacts in each case. Accordingly ${srcdir}/.. would not work as > +# intended, because instead of pointing to the top-level source > +# directory, it would point to one of the parent build directories (e.g. > +# "m68881" or "m68020") in the example above. > +# > +# Now, however, GNU Make is required, and GNU Make always supports > +# VPATH. We therefore dropped support for these symlink trees. And > +# accordingly, we can know that ${srcdir}/.. always does what we expect > +# in all supported configurations. > +# > +# This will open the door to many many further simplifications of the > +# multilib infrastructure. These simplifications are not yet > +# implemented, however. Until they are, and the dead code removed, this > +# historical information should stay in this file. > +# > # 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 +81,9 @@ > # 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). > @@ -101,7 +105,6 @@ > > Makefile=${ac_file-Makefile} > ml_config_shell=${CONFIG_SHELL-/bin/sh} > -ml_realsrcdir=${srcdir} > > # Scan all the arguments and set all the ones we need. > > @@ -188,23 +191,8 @@ if [ "${enable_multilib}" = yes ]; then > # into one file, but it does leave us with having to perform this test. > ml_toplevel_p=no > if [ -z "${with_multisubdir}" ]; then > - if [ "${srcdir}" = "." ]; then > - # Use ${ml_realsrcdir} instead of ${srcdir} here to account for > ${subdir}. > - # ${with_target_subdir} = "." for native, otherwise target alias. > - if [ "${with_target_subdir}" = "." ]; then > - if [ -f ${ml_realsrcdir}/../config-ml.in ]; then > - ml_toplevel_p=yes > - fi > - else > - if [ -f ${ml_realsrcdir}/../../config-ml.in ]; then > - ml_toplevel_p=yes > - fi > - fi > - else > - # Use ${ml_realsrcdir} instead of ${srcdir} here to account for > ${subdir}. > - if [ -f ${ml_realsrcdir}/../config-ml.in ]; then > - ml_toplevel_p=yes > - fi > + if [ -f ${srcdir}/../config-ml.in ]; then > + ml_toplevel_p=yes > fi > fi > > @@ -565,36 +553,20 @@ mv Makefile.tem ${Makefile} > fi # ${ml_toplevel_p} = yes > > if [ "${ml_verbose}" = --verbose ]; then > - echo "Adding multilib support to ${Makefile} in ${ml_realsrcdir}" > + echo "Adding multilib support to ${Makefile} in ${srcdir}" > if [ "${ml_toplevel_p}" = yes ]; then > echo "multidirs=${multidirs}" > fi > echo "with_multisubdir=${with_multisubdir}" > fi > > -if [ "${srcdir}" = "." ]; then > - if [ "${with_target_subdir}" != "." ]; then > - ml_srcdotdot="../" > - else > - ml_srcdotdot="" > - fi > -else > - ml_srcdotdot="" > -fi > - > if [ -z "${with_multisubdir}" ]; then > ml_subdir= > ml_builddotdot= > - : # ml_srcdotdot= # already set > else > ml_subdir="/${with_multisubdir}" > # The '[^/][^/]*' appears that way to work around a SunOS sed bug. > ml_builddotdot=`echo ${with_multisubdir} | sed -e 's:[^/][^/]*:..:g'`/ > - if [ "$srcdir" = "." ]; then > - ml_srcdotdot=${ml_srcdotdot}${ml_builddotdot} > - else > - : # ml_srcdotdot= # already set > - fi > fi > > if [ "${ml_toplevel_p}" = yes ]; then > @@ -606,8 +578,8 @@ else > fi > > # TOP is used by newlib and should not be used elsewhere for this purpose. > -# MULTI{SRC,BUILD}TOP are the proper ones to use. MULTISRCTOP is empty > -# when srcdir != builddir. MULTIBUILDTOP is always some number of ../'s. > +# MULTIBUILDTOP are the proper ones to use. > +# MULTIBUILDTOP is always some number of ../'s. > # FIXME: newlib needs to be updated to use MULTI{SRC,BUILD}TOP so we can > # delete TOP. Newlib may wish to continue to use TOP for its own purposes > # of course. > @@ -628,7 +600,6 @@ fi > # options). > > sed -e "s:^TOP[ ]*=[ ]*\([./]*\)[ ]*$:TOP = ${ml_builddotdot}\1:" \ > - -e "s:^MULTISRCTOP[ ]*=.*$:MULTISRCTOP = ${ml_srcdotdot}:" \ > -e "s:^MULTIBUILDTOP[ ]*=.*$:MULTIBUILDTOP = ${ml_builddotdot}:" \ > -e "s:^MULTIDIRS[ ]*=.*$:MULTIDIRS = ${multidirs}:" \ > -e "s:^MULTISUBDIR[ ]*=.*$:MULTISUBDIR = ${ml_subdir}:" \ > @@ -692,24 +663,8 @@ if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" > ]; then > > case ${srcdir} in > ".") > - echo "Building symlink tree in > `${PWDCMD-pwd}`/${ml_dir}/${ml_libdir}" > - if [ "${with_target_subdir}" != "." ]; then > - ml_unsubdir="../" > - else > - ml_unsubdir="" > - fi > - (cd ${ml_dir}/${ml_libdir}; > - ../${dotdot}${ml_unsubdir}symlink-tree > ../${dotdot}${ml_unsubdir}${ml_libdir} "") > - if [ -f ${ml_dir}/${ml_libdir}/${Makefile} ]; then > - if [ x"${MAKE}" = x ]; then > - (cd ${ml_dir}/${ml_libdir}; make distclean) > - else > - (cd ${ml_dir}/${ml_libdir}; ${MAKE} distclean) > - fi > - fi > - ml_newsrcdir="." > - ml_srcdiroption= > - multisrctop=${dotdot} > + echo "Multilib builds with srcdir = objdir are no longer supported. > Please use a separate objdir." > + exit 1 > ;; > *) > case "${srcdir}" in > @@ -721,7 +676,6 @@ if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" > ]; then > ;; > esac > ml_srcdiroption="-srcdir=${ml_newsrcdir}" > - multisrctop= > ;; > esac > > @@ -867,7 +821,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..5f033284f 100644 > --- a/config/multi.m4 > +++ b/config/multi.m4 > @@ -23,18 +23,10 @@ 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" > - else > - multi_basedir="$srcdir/$with_multisrctop$2" > - fi > -else > - multi_basedir="$srcdir/$2" > -fi > +multi_basedir="$srcdir/$2" > AC_SUBST(multi_basedir) > > # Even if the default multilib is not a cross compilation, > @@ -57,7 +49,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/etc/update-copyright.py b/etc/update-copyright.py > index 7f605d058..df7c83671 100755 > --- a/etc/update-copyright.py > +++ b/etc/update-copyright.py > @@ -96,7 +96,6 @@ class GenericFilter: > 'mkinstalldirs', > 'move-if-change', > 'shlibpath.m4', > - 'symlink-tree', > 'ylwrap', > > # Skip FSF mission statement, etc. > diff --git a/libgloss/Makefile.in b/libgloss/Makefile.in > index 5146a7880..212d74ed8 100644 > --- a/libgloss/Makefile.in > +++ b/libgloss/Makefile.in > @@ -2139,7 +2139,6 @@ FLAGS_TO_PASS = \ > "INSTALL_DATA=$(INSTALL_DATA)" \ > "DESTDIR=$(DESTDIR)" > > -MULTISRCTOP = > MULTIBUILDTOP = > MULTIDIRS = > MULTISUBDIR = > diff --git a/libgloss/configure b/libgloss/configure > index ba071824b..1c47f72ea 100755 > --- a/libgloss/configure > +++ b/libgloss/configure > @@ -5652,18 +5652,10 @@ 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../.." > - else > - multi_basedir="$srcdir/$with_multisrctop.." > - fi > -else > - multi_basedir="$srcdir/.." > -fi > +multi_basedir="$srcdir/.." > > > # Even if the default multilib is not a cross compilation, > @@ -6616,7 +6608,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/multilib.am b/multilib.am > index 5c98b69bd..0c4e3283e 100644 > --- a/multilib.am > +++ b/multilib.am > @@ -10,7 +10,6 @@ > ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > ## GNU General Public License for more details. > > -MULTISRCTOP = > MULTIBUILDTOP = > MULTIDIRS = > MULTISUBDIR = > diff --git a/newlib/Makefile.in b/newlib/Makefile.in > index c5492c6b6..c16ab2626 100644 > --- a/newlib/Makefile.in > +++ b/newlib/Makefile.in > @@ -4305,7 +4305,6 @@ TARG_INCLUDE_CP_DIR = \ > if (cd $$srcdir 2>/dev/null && [ "`echo *.h`" != "*.h" ]); then cp > $$srcdir/*.h $$dstdir/; fi > > CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host > -MULTISRCTOP = > MULTIBUILDTOP = > MULTIDIRS = > MULTISUBDIR = > diff --git a/newlib/acinclude.m4 b/newlib/acinclude.m4 > index 19301289f..3ba0fa01f 100644 > --- a/newlib/acinclude.m4 > +++ b/newlib/acinclude.m4 > @@ -94,19 +94,11 @@ 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" > - else > - newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}$1" > - fi > -else > - newlib_basedir="[$]{srcdir}/$1" > -fi > +newlib_basedir="[$]{srcdir}/$1" > AC_SUBST(newlib_basedir) > > abs_newlib_basedir=`cd "${newlib_basedir}" && pwd` > diff --git a/newlib/configure b/newlib/configure > index 33a2ed1c5..3219f0366 100755 > --- a/newlib/configure > +++ b/newlib/configure > @@ -2648,18 +2648,10 @@ 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../.." > - else > - multi_basedir="$srcdir/$with_multisrctop.." > - fi > -else > - multi_basedir="$srcdir/.." > -fi > +multi_basedir="$srcdir/.." > > > # Even if the default multilib is not a cross compilation, > @@ -4872,15 +4864,7 @@ fi > > test -z "${with_target_subdir}" && with_target_subdir=. > > -if test "${srcdir}" = "."; then > - if test "${with_target_subdir}" != "."; then > - newlib_basedir="${srcdir}/${with_multisrctop}../." > - else > - newlib_basedir="${srcdir}/${with_multisrctop}." > - fi > -else > - newlib_basedir="${srcdir}/." > -fi > +newlib_basedir="${srcdir}/." > > > abs_newlib_basedir=`cd "${newlib_basedir}" && pwd` > @@ -8732,7 +8716,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/src-release b/src-release > index b28597c09..878510b28 100644 > --- a/src-release > +++ b/src-release > @@ -46,7 +46,7 @@ PWD = $${PWDCMD-pwd} > # Files in devo used in any net release. > DEVO_SUPPORT= README Makefile.in configure configure.ac \ > config.guess config.sub config move-if-change \ > - COPYING COPYING.LIB install-sh config-ml.in symlink-tree \ > + COPYING COPYING.LIB install-sh config-ml.in \ > mkinstalldirs ltmain.sh missing ylwrap \ > libtool.m4 ltsugar.m4 ltversion.m4 ltoptions.m4 \ > Makefile.def Makefile.tpl src-release config.rpath \ > diff --git a/symlink-tree b/symlink-tree > deleted file mode 100755 > index a9d50831b..000000000 > --- a/symlink-tree > +++ /dev/null > @@ -1,78 +0,0 @@ > -#!/bin/sh > -# Create a symlink tree. > -# > -# Copyright (C) 1995, 2000, 2003 Free Software Foundation, Inc. > -# > -# This file is free software; you can redistribute it and/or modify > -# it under the terms of the GNU General Public License as published by > -# the Free Software Foundation; either version 2 of the License, or > -# (at your option) any later version. > -# > -# This program is distributed in the hope that it will be useful, > -# but WITHOUT ANY WARRANTY; without even the implied warranty of > -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > -# GNU General Public License for more details. > -# > -# You should have received a copy of the GNU General Public License > -# along with this program; if not, write to the Free Software > -# Foundation, Inc., 51 Franklin Street, Fifth Floor, > -# Boston, MA 02110-1301, USA. > -# > -# As a special exception to the GNU General Public License, if you > -# distribute this file as part of a program that contains a > -# configuration script generated by Autoconf, you may include it under > -# the same distribution terms that you use for the rest of that program. > -# > -# Please report bugs to <[email protected]> > -# and send patches to <[email protected]>. > - > -# Syntax: symlink-tree srcdir "ignore1 ignore2 ..." > -# > -# where srcdir is the directory to create a symlink tree to, > -# and "ignoreN" is a list of files/directories to ignore. > - > -prog=$0 > -srcdir=$1 > -ignore="$2" > - > -if test $# -lt 1; then > - echo "symlink-tree error: Usage: symlink-tree srcdir \"ignore1 ignore2 > ...\"" > - exit 1 > -fi > - > -ignore_additional=". .. CVS" > - > -# If we were invoked with a relative path name, adjust ${prog} to work > -# in subdirs. > -case ${prog} in > -/* | [A-Za-z]:[\\/]*) ;; > -*) prog=../${prog} ;; > -esac > - > -# Set newsrcdir to something subdirectories can use. > -case ${srcdir} in > -/* | [A-Za-z]:[\\/]*) newsrcdir=${srcdir} ;; > -*) newsrcdir=../${srcdir} ;; > -esac > - > -for f in `ls -a ${srcdir}`; do > - if [ -d ${srcdir}/$f ]; then > - found= > - for i in ${ignore} ${ignore_additional}; do > - if [ "$f" = "$i" ]; then > - found=yes > - fi > - done > - if [ -z "${found}" ]; then > - echo "$f ..working in" > - if [ -d $f ]; then true; else mkdir $f; fi > - (cd $f; ${prog} ${newsrcdir}/$f "${ignore}") > - fi > - else > - echo "$f ..linked" > - rm -f $f > - ln -s ${srcdir}/$f . > - fi > -done > - > -exit 0 > -- > 2.49.0 > > > >