Re: [PATCH v2] Get rid of `with_multisrctop`, and `MULTISRCTOP`

"John Ericson" <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
Hi, ping on this. Is it all good? I would appreciate being able to land these changes if possible.

Per the original, I *was* able to test it after all.

John

On Fri, Aug 22, 2025, at 10:01 PM, John Ericson wrote:
> Thanks, both of you, for taking a look
> 
> On 2025-08-21 14:26, Jeff Johnston wrote:
>> According to your comment below, you don't have it working for multilib newlib. 
> 
> Just to be clear, I couldn't before get a --with-multilib build going with or without my patch. So I didn't know whether it worked, *not* knew that I had broken something.
> 
>> Regarding a test - you can try and build aarch64-none-elf.  That will build a 
>> default newlib and one in an ilp32 multilib directory.
> 
> OK so short story, thanks, that worked! The patch is working
> 
> The full story is my distro (Nixpkgs) 's aarch64-none-elf GCC was built with `--disable-multilib`, so I faked it a bit with more or less:
> 
> diff --git a/config-ml.in b/config-ml.in
> index 56b6abae2..578377785 100644
> --- a/config-ml.in
> +++ b/config-ml.in
> @@ -103,6 +103,8 @@
>  # Note that `host' in this case is GCC's `target'.  Target libraries are
>  # configured for a particular host.
> 
> +print_multilib=`printf '.;\nfoo;@mabi=ilp32'`
> +
>  Makefile=${ac_file-Makefile}
>  ml_config_shell=${CONFIG_SHELL-/bin/sh}
> 
> @@ -203,7 +205,7 @@ fi
>  if [ "${ml_toplevel_p}" = yes ]; then
> 
>  multidirs=
> -for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do
> +for i in $print_multilib; do
>    dir=`echo $i | sed -e 's/;.*$//'`
>    if [ "${dir}" = "." ]; then
>      true
> @@ -484,7 +486,7 @@ multi-do:
>           srcrootpre=`cd $(srcdir); ${PWD_COMMAND}`/; export srcrootpre; \
>           lib=`echo "$${rootpre}" | sed -e 's,^.*/\([^/][^/]*\)/$$,\1,'`; \
>           compiler="$(CC)"; \
> -         for i in `$${compiler} --print-multi-lib 2>/dev/null`; do \
> +         for i in `printf '.;\nfoo;@mabi=ilp32'`; do \
>             dir=`echo $$i | sed -e 's/;.*$$//'`; \
>             if [ "$${dir}" = "." ]; then \
>               true; \
> @@ -693,7 +695,7 @@ if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then
>      fi
> 
>      # find compiler flag corresponding to ${ml_dir}
> -    for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do
> +    for i in $print_multilib; do
>        dir=`echo $i | sed -e 's/;.*$//'`
>        if [ "${dir}" = "${ml_dir}" ]; then
>          flags=`echo $i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`
> 
> and it worked!
> 
> $ make
> [...]
> Making all in .
> make[8]: Entering directory '/home/jcericson/src/gnu/newlib-cygwin/build/aarch64-none-elf/foo/libgloss'
> true  DO=all multi-do # make
> make[8]: Leaving directory '/home/jcericson/src/gnu/newlib-cygwin/build/aarch64-none-elf/foo/libgloss'
> make[7]: Leaving directory '/home/jcericson/src/gnu/newlib-cygwin/build/aarch64-none-elf/foo/libgloss'
> make[6]: Leaving directory '/home/jcericson/src/gnu/newlib-cygwin/build/aarch64-none-elf/foo/libgloss'
> + true
> make[5]: Leaving directory '/home/jcericson/src/gnu/newlib-cygwin/build/aarch64-none-elf/libgloss'
> make[4]: Leaving directory '/home/jcericson/src/gnu/newlib-cygwin/build/aarch64-none-elf/libgloss'
> make[3]: Leaving directory '/home/jcericson/src/gnu/newlib-cygwin/build/aarch64-none-elf/libgloss'
> make[2]: Leaving directory '/home/jcericson/src/gnu/newlib-cygwin/build/aarch64-none-elf/libgloss'
> make[1]: Leaving directory '/home/jcericson/src/gnu/newlib-cygwin/build
> 
> $ echo $?
> 0
> 
> And grepping confirms the right things happened:
> 
> $ grep -irl ilp32 aarch64-none-elf | head
> aarch64-none-elf/newlib/Makefile
> aarch64-none-elf/newlib/config.log
> aarch64-none-elf/newlib/targ-include/machine/_fpmath.h
> aarch64-none-elf/newlib/config.status
> aarch64-none-elf/foo/newlib/libc.a
> aarch64-none-elf/foo/newlib/config.status
> aarch64-none-elf/foo/newlib/config.cache
> aarch64-none-elf/foo/newlib/config.log
> aarch64-none-elf/foo/newlib/foo/libm.a
> aarch64-none-elf/foo/newlib/foo/libc.a
> 
> $ grep -irl lp64 aarch64-none-elf | head
> aarch64-none-elf/newlib/libc/libm_a-sf_isinf.o
> aarch64-none-elf/newlib/libc/libm_a-s_isnand.o
> aarch64-none-elf/newlib/libc/libm_a-s_isinfd.o
> aarch64-none-elf/newlib/libc/locale/libc_a-nl_langinfo.o
> aarch64-none-elf/newlib/libc/locale/libc_a-duplocale.o
> aarch64-none-elf/newlib/libc/locale/libc_a-locale.o
> aarch64-none-elf/newlib/libc/locale/libc_a-lmonetary.o
> aarch64-none-elf/newlib/libc/locale/libc_a-timelocal.o
> aarch64-none-elf/newlib/libc/locale/libc_a-freelocale.o
> aarch64-none-elf/newlib/libc/locale/libc_a-localeconv.o
> 
> So I think we can now consider the patch tested! To the extent this is artificial, with me possibly missing the proper libgcc etc. from my --disable-multilib GCC, I don't think that matters with the patch I did.
> 
> On Fri, Aug 22, 2025, at 5:44 AM, Brian Inglis wrote:
>> Check that nothing breaks Mike Frysinger's flattened make structure?
> 
> I wasn't sure what you mean by this?
> 
> $ git log --author 'Mike Frysinger' --grep=akefile
> 
> indicates it might be his making libgloss use Automake and less recursive make? I didn't find any special options to test, but I did build both libgloss and newlib
> 
> $ find aarch64-none-elf/ -maxdepth 2| grep libgloss | head -n2
> aarch64-none-elf/foo/libgloss
> aarch64-none-elf/libgloss
> 
> so I didn't break libgloss either.
> 
> Let me know if this is amount of testing good, or if there is any more information you need.
> 
> Thanks,
> 
> John
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.