Bug 30740 - [m68k] undefined reference to `_wordcopy_fwd_dest_aligned'
Summary: [m68k] undefined reference to `_wordcopy_fwd_dest_aligned'
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: build (show other bugs)
Version: 2.38
: P2 normal
Target Milestone: 2.39
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-10 04:59 UTC by wbx
Modified: 2023-08-25 14:45 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description wbx 2023-08-10 04:59:37 UTC
Hi,

I am trying to create a cross-compile toolchain targeting qemu-system-m68k with emulates a q800 machine with a m68040 cpu. The build of glibc fails with:

/home/wbx/openadk/toolchain_qemu-m68k-q800_glibc_68040/usr/bin/m68k-openadk-linux-gnu-gcc   -nostdlib -nostartfiles -r -o /home/wbx/openadk/toolchain_build_qemu-m68k-q800_glibc_68040/w-glibc-2.38-1/glibc-2.38-final/elf/librtld.os '-Wl,-(' /home/wbx/openadk/toolchain_build_qemu-m68k-q800_glibc_68040/w-glibc-2.38-1/glibc-2.38-final/elf/dl-allobjs.os /home/wbx/openadk/toolchain_build_qemu-m68k-q800_glibc_68040/w-glibc-2.38-1/glibc-2.38-final/elf/rtld-libc.a -lgcc '-Wl,-)' \
          -Wl,-Map,/home/wbx/openadk/toolchain_build_qemu-m68k-q800_glibc_68040/w-glibc-2.38-1/glibc-2.38-final/elf/librtld.os.map
/home/wbx/openadk/toolchain_qemu-m68k-q800_glibc_68040/usr/bin/m68k-openadk-linux-gnu-gcc   -nostdlib -nostartfiles -shared -o /home/wbx/openadk/toolchain_build_qemu-m68k-q800_glibc_68040/w-glibc-2.38-1/glibc-2.38-final/elf/ld.so.new           \
          -Wl,-z,relro -Wl,-z,defs      \
           \
          /home/wbx/openadk/toolchain_build_qemu-m68k-q800_glibc_68040/w-glibc-2.38-1/glibc-2.38-final/elf/librtld.os -Wl,--version-script=/home/wbx/openadk/toolchain_build_qemu-m68k-q800_glibc_68040/w-glibc-2.38-1/glibc-2.38-final/ld.map              \
          -Wl,-soname=ld.so.1
/home/wbx/openadk/toolchain_qemu-m68k-q800_glibc_68040/usr/lib/gcc/m68k-openadk-linux-gnu/12.3.0/../../../../m68k-openadk-linux-gnu/bin/ld: /home/wbx/openadk/toolchain_build_qemu-m68k-q800_glibc_68040/w-glibc-2.38-1/glibc-2.38-final/elf/librtld.os: in function `memcpy':
(.text+0x17bb4): undefined reference to `_wordcopy_fwd_aligned'
/home/wbx/openadk/toolchain_qemu-m68k-q800_glibc_68040/usr/lib/gcc/m68k-openadk-linux-gnu/12.3.0/../../../../m68k-openadk-linux-gnu/bin/ld: (.text+0x17bf2): undefined reference to `_wordcopy_fwd_dest_aligned'
/home/wbx/openadk/toolchain_qemu-m68k-q800_glibc_68040/usr/lib/gcc/m68k-openadk-linux-gnu/12.3.0/../../../../m68k-openadk-linux-gnu/bin/ld: /home/wbx/openadk/toolchain_build_qemu-m68k-q800_glibc_68040/w-glibc-2.38-1/glibc-2.38-final/elf/librtld.os: in function `memmove':
(.text+0x17c68): undefined reference to `_wordcopy_fwd_aligned'
/home/wbx/openadk/toolchain_qemu-m68k-q800_glibc_68040/usr/lib/gcc/m68k-openadk-linux-gnu/12.3.0/../../../../m68k-openadk-linux-gnu/bin/ld: (.text+0x17cda): undefined reference to `_wordcopy_bwd_aligned'
/home/wbx/openadk/toolchain_qemu-m68k-q800_glibc_68040/usr/lib/gcc/m68k-openadk-linux-gnu/12.3.0/../../../../m68k-openadk-linux-gnu/bin/ld: (.text+0x17d24): undefined reference to `_wordcopy_bwd_dest_aligned'
/home/wbx/openadk/toolchain_qemu-m68k-q800_glibc_68040/usr/lib/gcc/m68k-openadk-linux-gnu/12.3.0/../../../../m68k-openadk-linux-gnu/bin/ld: (.text+0x17d44): undefined reference to `_wordcopy_fwd_dest_aligned'
/home/wbx/openadk/toolchain_qemu-m68k-q800_glibc_68040/usr/lib/gcc/m68k-openadk-linux-gnu/12.3.0/../../../../m68k-openadk-linux-gnu/bin/ld: /home/wbx/openadk/toolchain_build_qemu-m68k-q800_glibc_68040/w-glibc-2.38-1/glibc-2.38-final/elf/ld.so.new: hidden symbol `_wordcopy_fwd_aligned' isn't defined
/home/wbx/openadk/toolchain_qemu-m68k-q800_glibc_68040/usr/lib/gcc/m68k-openadk-linux-gnu/12.3.0/../../../../m68k-openadk-linux-gnu/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
gmake[8]: *** [Makefile:1328: /home/wbx/openadk/toolchain_build_qemu-m68k-q800_glibc_68040/w-glibc-2.38-1/glibc-2.38-final/elf/ld.so] Error 1
gmake[7]: *** [Makefile:484: elf/subdir_lib] Error 2
gmake[6]: *** [Makefile:9: all] Error 2
gmake[5]: *** [Makefile:70: /home/wbx/openadk/toolchain_build_qemu-m68k-q800_glibc_68040/w-glibc-2.38-1/glibc-2.38/.compiled] Error 2
gmake[4]: *** [Makefile:106: glibc-compile] Error 2
gmake[3]: *** [mk/build.mk:227: toolchain/final] Error 2
gmake[2]: *** [/home/wbx/openadk/mk/build.mk:176: world] Error 2

If it matters, I tried with -O2 and -Os, but same error occurs.

gcc -v:
./toolchain_qemu-m68k-q800_glibc_68040/usr/bin/m68k-openadk-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=./toolchain_qemu-m68k-q800_glibc_68040/usr/bin/m68k-openadk-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/home/wbx/openadk/toolchain_qemu-m68k-q800_glibc_68040/usr/libexec/gcc/m68k-openadk-linux-gnu/12.3.0/lto-wrapper
Target: m68k-openadk-linux-gnu
Configured with: /home/wbx/openadk/toolchain_build_qemu-m68k-q800_glibc_68040/w-gcc-12.3.0-1/gcc-12.3.0/configure --prefix=/home/wbx/openadk/toolchain_qemu-m68k-q800_glibc_68040/usr --with-bugurl=https://openadk.org --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=m68k-openadk-linux-gnu --with-gmp=/home/wbx/openadk/host_x86_64-linux-gnu/usr --with-mpfr=/home/wbx/openadk/host_x86_64-linux-gnu/usr --enable-__cxa_atexit --with-system-zlib --with-gnu-ld --with-gnu-as --disable-libsanitizer --disable-install-libiberty --disable-libitm --disable-libmudflap --disable-libgomp --disable-libcc1 --disable-libmpx --disable-libcilkrts --disable-libquadmath --disable-libquadmath-support --disable-decimal-float --disable-gcov --disable-libstdcxx-pch --disable-ppl-version-check --disable-cloog-version-check --without-ppl --without-cloog --without-isl --disable-werror --disable-nls --enable-obsolete --disable-lto --with-cpu=68040 --enable-tls --enable-languages=c --with-newlib --disable-shared --disable-threads --disable-multilib --without-headers
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 12.3.0 (GCC) 

./toolchain_qemu-m68k-q800_glibc_68040/usr/bin/m68k-openadk-linux-gnu-ld -v
GNU ld (GNU Binutils) 2.40

Linux 6.1.41 is used.

Anyone could help here?
 best regards
   Waldemar
Comment 1 Adhemerval Zanella 2023-08-10 13:23:50 UTC
The issue is that we only test for m68020, which should use the optimized macros from sysdeps/m68k/memcopy.h and not use the wordcopy.c routines. To fix it should be as simple as:

diff --git a/sysdeps/m68k/m680x0/m68020/wordcopy.S b/sysdeps/m68k/m680x0/m68020/wordcopy.S
deleted file mode 100644
index 4fb1a4518f..0000000000
--- a/sysdeps/m68k/m680x0/m68020/wordcopy.S
+++ /dev/null
@@ -1 +0,0 @@
-/* Empty, not needed.  */
diff --git a/sysdeps/m68k/wordcopy.c b/sysdeps/m68k/wordcopy.c
new file mode 100644
index 0000000000..e459e0e403
--- /dev/null
+++ b/sysdeps/m68k/wordcopy.c
@@ -0,0 +1,21 @@
+/* Definitions for memory copy functions.  Motorola 68020 version.
+   Copyright (C) 2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#if !defined(__mc68020__) && !defined(mc68020)
+#include <string/wordcopy.c>
+#endif

However, since we do not actually build everything for anything different than m68020; the math code assumes m68020 FLT_EVAL_METHOD (which is 2 since it uses the external 68881 math processor).  And this is not correct fro m68040 which now has a builtin FP processor and thus GCC uses a different  FLT_EVAL_METHOD (0).

The FP issues should be simple to fix by removing sysdeps/m68k/m680x0/bits/flt-eval-method.h and letting using the generic one, but I don't have a way to actually test it.
Comment 2 wbx 2023-08-10 16:11:50 UTC
Hi,

that worked fine for the toolchain creation and a simple bootup in Qemu works as well.
Thanks for the fast answer.

There is one minor issue, this oneliner does not work, I use it to show the ip address of the system:
ipaddr=$(ip addr show $(ip route show|awk '/default/ { print $5 }')|awk '/inet / { print $2 }'|tail -1)

With strace I get:
Fatal glibc error: printf_fp.c:501 (__printf_fp_buffer_1): assertion failed: cy == 1 || (p.frac[p.fracsize - 2] == 0 && p.frac[0] == 0)
Aborted

Does this have something todo with the FP implementation?

best regards
 Waldemar
Comment 3 Adhemerval Zanella 2023-08-10 16:28:43 UTC
(In reply to wbx from comment #2)
> Hi,
> 
> that worked fine for the toolchain creation and a simple bootup in Qemu
> works as well.
> Thanks for the fast answer.
> 
> There is one minor issue, this oneliner does not work, I use it to show the
> ip address of the system:
> ipaddr=$(ip addr show $(ip route show|awk '/default/ { print $5 }')|awk
> '/inet / { print $2 }'|tail -1)
> 
> With strace I get:
> Fatal glibc error: printf_fp.c:501 (__printf_fp_buffer_1): assertion failed:
> cy == 1 || (p.frac[p.fracsize - 2] == 0 && p.frac[0] == 0)
> Aborted
> 
> Does this have something todo with the FP implementation?
> 
> best regards
>  Waldemar

I am not sure, it indeed could be related since the assert being triggered is related to floating point printing. Do you know exactly what awk issues with printf?
Comment 4 Adhemerval Zanella 2023-08-10 16:30:16 UTC
Could you try to remove sysdeps/m68k/m680x0/lshift.S and see if program does not trigger the issue anymore?
Comment 5 wbx 2023-08-11 01:26:55 UTC
Hi,

wonderful, this fixed the awk issue for me.

Any chance to get these changes upstream for the next release?

best regards
 Waldemar
Comment 6 Adhemerval Zanella 2023-08-11 14:16:39 UTC
(In reply to wbx from comment #5)
> Hi,
> 
> wonderful, this fixed the awk issue for me.
> 
> Any chance to get these changes upstream for the next release?
> 
> best regards
>  Waldemar

Good to know and I hope to get this sort out. Do you have a easy way to bootstrap a m68k using qemu? I am trying to use debian, but it keep breaking which is really time consuming... I would like to check if both 68020 and 68040 works with these changes.
Comment 7 wbx 2023-08-11 14:27:16 UTC
If you like to cross-compile, you can use www.openadk.org, it supports 68020 and 68040
and both can be booted in Qemu. Buildroot works, too, but it only supports 68040, so you would need to hack 68020 toolchain support into it. And you would need this:
https://lists.buildroot.org/pipermail/buildroot/2023-August/672637.html

I don't know any recent native Linux distro, which can be used in Qemu M68k.

best regards
 Waldemar
Comment 8 wbx 2023-08-15 05:57:08 UTC
Hi,

You can download following two files:
https://debug.openadk.org/m68k/qemu-m68k.img
https://debug.openadk.org/m68k/qemu-m68k-virt-archive-kernel

It contains everything you need to compile glibc.
gcc 13.2.0, binutils 2.41, ...

And start Qemu like this:
qemu-system-m68k -nographic -M virt -m 512M -netdev user,id=eth0 -device virtio-net-device,netdev=eth0 -append "rootwait root=/dev/vda1 ro" -drive file=qemu-m68k.img,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -kernel qemu-m68k-virt-archive-kernel

User: root
Password: linux123

Under /opt is a build directory, which contains some precompiled code.

Unfortunately the native build fails with following error:
make[2]: Entering directory '/opt/glibc-2.38/malloc'
gcc   -shared -static-libgcc -Wl,-O1  -Wl,-z,defs -Wl,-dynamic-linker=/opt/lib/ld.so.1   -B/opt/build/csu/  -Wl,--version-script=/opt/build/libc_malloc_debug.map -Wl,-soname=libc_malloc_debug.so.0 -Wl,-z,relro   
-L/opt/build -L/opt/build/math -L/opt/build/elf -L/opt/build/dlfcn -L/opt/build/nss -L/opt/build/nis -L/opt/build/rt -L/opt/build/resolv -L/opt/build/mathvec -L/opt/build/support -L/opt/build/nptl -Wl,-rpath-link
=/opt/build:/opt/build/math:/opt/build/elf:/opt/build/dlfcn:/opt/build/nss:/opt/build/nis:/opt/build/rt:/opt/build/resolv:/opt/build/mathvec:/opt/build/support:/opt/build/nptl -o /opt/build/malloc/libc_malloc_deb
ug.so /opt/build/csu/abi-note.o -Wl,--whole-archive /opt/build/malloc/libc_malloc_debug_pic.a -Wl,--no-whole-archive   -Wl,--start-group /opt/build/libc.so /opt/build/libc_nonshared.a -Wl,--as-needed /opt/build/e
lf/ld.so -Wl,--no-as-needed -Wl,--end-group
/usr/bin/ld: /opt/build/malloc/libc_malloc_debug_pic.a(malloc-debug.os): in function `do_mtrace':
/opt/glibc-2.38/malloc/mtrace-impl.c:193:(.text+0x163c): undefined reference to `__dso_handle'
/usr/bin/ld: /opt/build/malloc/libc_malloc_debug.so: hidden symbol `__dso_handle' isn't defined
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[2]: *** [../Makerules:533: /opt/build/malloc/libc_malloc_debug.so] Error 1
make[2]: Leaving directory '/opt/glibc-2.38/malloc'
make[1]: *** [Makefile:484: malloc/others] Error 2
make[1]: Leaving directory '/opt/glibc-2.38'
make: *** [Makefile:9: all] Error 2

Any idea why it fails here?
best regards
 Waldemar
Comment 9 Adhemerval Zanella 2023-08-15 18:48:38 UTC
(In reply to wbx from comment #8)
> Hi,
> 
> You can download following two files:
> https://debug.openadk.org/m68k/qemu-m68k.img
> https://debug.openadk.org/m68k/qemu-m68k-virt-archive-kernel
> 
> It contains everything you need to compile glibc.
> gcc 13.2.0, binutils 2.41, ...
> 
> And start Qemu like this:
> qemu-system-m68k -nographic -M virt -m 512M -netdev user,id=eth0 -device
> virtio-net-device,netdev=eth0 -append "rootwait root=/dev/vda1 ro" -drive
> file=qemu-m68k.img,format=raw,id=hd0 -device virtio-blk-device,drive=hd0
> -kernel qemu-m68k-virt-archive-kernel
> 
> User: root
> Password: linux123
> 
> Under /opt is a build directory, which contains some precompiled code.
> 
> Unfortunately the native build fails with following error:
> make[2]: Entering directory '/opt/glibc-2.38/malloc'
> gcc   -shared -static-libgcc -Wl,-O1  -Wl,-z,defs
> -Wl,-dynamic-linker=/opt/lib/ld.so.1   -B/opt/build/csu/ 
> -Wl,--version-script=/opt/build/libc_malloc_debug.map
> -Wl,-soname=libc_malloc_debug.so.0 -Wl,-z,relro   
> -L/opt/build -L/opt/build/math -L/opt/build/elf -L/opt/build/dlfcn
> -L/opt/build/nss -L/opt/build/nis -L/opt/build/rt -L/opt/build/resolv
> -L/opt/build/mathvec -L/opt/build/support -L/opt/build/nptl -Wl,-rpath-link
> =/opt/build:/opt/build/math:/opt/build/elf:/opt/build/dlfcn:/opt/build/nss:/
> opt/build/nis:/opt/build/rt:/opt/build/resolv:/opt/build/mathvec:/opt/build/
> support:/opt/build/nptl -o /opt/build/malloc/libc_malloc_deb
> ug.so /opt/build/csu/abi-note.o -Wl,--whole-archive
> /opt/build/malloc/libc_malloc_debug_pic.a -Wl,--no-whole-archive  
> -Wl,--start-group /opt/build/libc.so /opt/build/libc_nonshared.a
> -Wl,--as-needed /opt/build/e
> lf/ld.so -Wl,--no-as-needed -Wl,--end-group
> /usr/bin/ld: /opt/build/malloc/libc_malloc_debug_pic.a(malloc-debug.os): in
> function `do_mtrace':
> /opt/glibc-2.38/malloc/mtrace-impl.c:193:(.text+0x163c): undefined reference
> to `__dso_handle'
> /usr/bin/ld: /opt/build/malloc/libc_malloc_debug.so: hidden symbol
> `__dso_handle' isn't defined
> /usr/bin/ld: final link failed: bad value
> collect2: error: ld returned 1 exit status
> make[2]: *** [../Makerules:533: /opt/build/malloc/libc_malloc_debug.so]
> Error 1
> make[2]: Leaving directory '/opt/glibc-2.38/malloc'
> make[1]: *** [Makefile:484: malloc/others] Error 2
> make[1]: Leaving directory '/opt/glibc-2.38'
> make: *** [Makefile:9: all] Error 2
> 
> Any idea why it fails here?
> best regards
>  Waldemar

It seems to be a misconfigured toolchain, where gcc crtbegin files do not contain the __dso_handle:

$ objdump -t /usr/lib/gcc/m68k-openadk-linux-gnu/13.2.0/crtbeginS.o
[...]
00000000         *UND*  00000000 _GLOBAL_OFFSET_TABLE_
00000000         *UND*  00000000 .hidden __TMC_END__
00000000  w      *UND*  00000000 _ITM_deregisterTMCloneTable
00000000  w      *UND*  00000000 _ITM_registerTMCloneTable
[...]

With a compiler built with build-many-glibcs.py:

$ objdump -t /home/azanella/toolchain/install/compilers/13/m68k-linux-gnu/bin/../lib/gcc/m68k-glibc-linux-gnu/13.1.1/crtbeginS.o
00000000         *UND*  00000000 _GLOBAL_OFFSET_TABLE_
00000000         *UND*  00000000 .hidden __TMC_END__
00000000  w      *UND*  00000000 _ITM_deregisterTMCloneTable
00000000  w      *UND*  00000000 _ITM_registerTMCloneTable
00000000 g     O .data.rel.local        00000000 .hidden __dso_handle
00000000  w      *UND*  00000000 __cxa_finalize

And checking the GCC configuration, it seems to be from '--disable-__cxa_atexit'. From gcc/config.in:

/* Define if you want to use __cxa_atexit, rather than atexit, to register C++
   destructors for local statics and global objects. This is essential for
   fully standards-compliant handling of destructors, but requires
   __cxa_atexit in libc. */
#ifndef USED_FOR_TARGET
#undef DEFAULT_USE_CXA_ATEXIT
#endif
Comment 10 wbx 2023-08-16 07:17:40 UTC
Hi,
You are right. I figured it out myself, too and rebuild the gcc in the meanwhile.
You find an updated image on the webserver. This time the build of glibc succeeded!

best regards
 Waldemar
Comment 11 Adhemerval Zanella 2023-08-16 12:18:40 UTC
Thanks for confirming it.  In any case, I will install the straightforward fix that breaks the m68k build.  Could you open another one for the lshift.S issue on 68040?
Comment 13 wbx 2023-08-17 06:26:48 UTC
Hi,
running make check fails with:

gcc -O   -D_GNU_SOURCE -DIS_IN_build -include /opt/build/config.h isomac.c -o /opt/build/stdlib/isomac
In file included from isomac.c:71:
/usr/include/stdlib.h:153:8: error: '_Float128' is not supported on this target
  153 | extern _Float128 strtof128 (const char *__restrict __nptr,
      |        ^~~~~~~~~
/usr/include/stdlib.h:165:8: error: '_Float64x' is not supported on this target
  165 | extern _Float64x strtof64x (const char *__restrict __nptr,
      |        ^~~~~~~~~
/usr/include/stdlib.h:311:25: error: '_Float128' is not supported on this target
  311 |                         _Float128 __f)
      |                         ^~~~~~~~~
/usr/include/stdlib.h:323:25: error: '_Float64x' is not supported on this target
  323 |                         _Float64x __f)
      |                         ^~~~~~~~~
/usr/include/stdlib.h:450:8: error: '_Float128' is not supported on this target
  450 | extern _Float128 strtof128_l (const char *__restrict __nptr,
      |        ^~~~~~~~~
/usr/include/stdlib.h:464:8: error: '_Float64x' is not supported on this target
  464 | extern _Float64x strtof64x_l (const char *__restrict __nptr,
      |        ^~~~~~~~~
make[2]: *** [Makefile:477: /opt/build/stdlib/isomac] Error 1
rm /opt/build/stdlib/test-as-const-ucontext_i.c
make[2]: Leaving directory '/opt/glibc-2.38/stdlib'
make[1]: *** [Makefile:484: stdlib/tests] Error 2
make[1]: Leaving directory '/opt/glibc-2.38'
make: *** [Makefile:9: check] Error 2
2|root@openadk:/opt/build #

What is wrong here?
Comment 14 Adhemerval Zanella 2023-08-18 14:30:52 UTC
(In reply to wbx from comment #13)
> Hi,
> running make check fails with:
> 
> gcc -O   -D_GNU_SOURCE -DIS_IN_build -include /opt/build/config.h isomac.c
> -o /opt/build/stdlib/isomac
> In file included from isomac.c:71:
> /usr/include/stdlib.h:153:8: error: '_Float128' is not supported on this
> target
>   153 | extern _Float128 strtof128 (const char *__restrict __nptr,
>       |        ^~~~~~~~~
> /usr/include/stdlib.h:165:8: error: '_Float64x' is not supported on this
> target
>   165 | extern _Float64x strtof64x (const char *__restrict __nptr,
>       |        ^~~~~~~~~
> /usr/include/stdlib.h:311:25: error: '_Float128' is not supported on this
> target
>   311 |                         _Float128 __f)
>       |                         ^~~~~~~~~
> /usr/include/stdlib.h:323:25: error: '_Float64x' is not supported on this
> target
>   323 |                         _Float64x __f)
>       |                         ^~~~~~~~~
> /usr/include/stdlib.h:450:8: error: '_Float128' is not supported on this
> target
>   450 | extern _Float128 strtof128_l (const char *__restrict __nptr,
>       |        ^~~~~~~~~
> /usr/include/stdlib.h:464:8: error: '_Float64x' is not supported on this
> target
>   464 | extern _Float64x strtof64x_l (const char *__restrict __nptr,
>       |        ^~~~~~~~~
> make[2]: *** [Makefile:477: /opt/build/stdlib/isomac] Error 1
> rm /opt/build/stdlib/test-as-const-ucontext_i.c
> make[2]: Leaving directory '/opt/glibc-2.38/stdlib'
> make[1]: *** [Makefile:484: stdlib/tests] Error 2
> make[1]: Leaving directory '/opt/glibc-2.38'
> make: *** [Makefile:9: check] Error 2
> 2|root@openadk:/opt/build #
> 
> What is wrong here?

This seems another toolchain misconfiguration, the VM /usr/include/bits/floatn.h seems to be the x86 one instead of the generic one which the expected one for m68k.
Comment 15 James Le Cuirot 2023-08-24 20:27:14 UTC
Thank you for looking into this, Adhemerval. Please could you confirm that you've considered the 68030 case. This does not have a built-in FPU, so I think it should be treated like the 68020? I'm no expert here though.
Comment 16 wbx 2023-08-25 01:30:13 UTC
Hi,
I fixed the misconfiguration and added the required bash, now make check completes
with following output:
Summary of test results:
    949 FAIL
   3344 PASS
     99 UNSUPPORTED
     16 XFAIL
      2 XPASS

A lot of math tests are failing, is it because of a missing ULPs file?
Comment 17 Adhemerval Zanella 2023-08-25 12:36:57 UTC
(In reply to James Le Cuirot from comment #15)
> Thank you for looking into this, Adhemerval. Please could you confirm that
> you've considered the 68030 case. This does not have a built-in FPU, so I
> think it should be treated like the 68020? I'm no expert here though.

glibc assumes the existence of FPU for m68k, and GCC defaults to 68881:

$ m68k-glibc-linux-gnu-gcc -mcpu=68030 -E -dD - < /dev/null  | grep 68881
#define __HAVE_68881__ 1

The math tests do all build because different than mc68020, GCC defines __DEC_EVAL_METHOD__ to 2 for mc68030.

The soft-float is only support for coldfire (__mcoldfire__) cpus.
Comment 18 Adhemerval Zanella 2023-08-25 12:45:16 UTC
(In reply to wbx from comment #16)
> Hi,
> I fixed the misconfiguration and added the required bash, now make check
> completes
> with following output:
> Summary of test results:
>     949 FAIL
>    3344 PASS
>      99 UNSUPPORTED
>      16 XFAIL
>       2 XPASS
> 
> A lot of math tests are failing, is it because of a missing ULPs file?

I am not sure, the last m68k testsuite report where from 2.26 release [1] running under ARAnyM.  A lot of tests have been added since then, so we will need to check each failure.

For ULPs update, you can try "make regen-ulps" to generate a diff file with newer UPs values (the regeneration ignores bogus ULPs values).  But I guess the math failures are from the extra rounding and exception testing, which requires a fully compliant IEEE 754 fp unit (which I guess m68k does not provide).

[1] https://sourceware.org/glibc/wiki/Release/2.26#M68K
Comment 19 Adhemerval Zanella 2023-08-25 12:48:46 UTC
(In reply to Adhemerval Zanella from comment #17)
> The math tests do all build because different than mc68020, GCC defines
> __DEC_EVAL_METHOD__ to 2 for mc68030.

*Some* math tests do *not* build ...
Comment 20 Adhemerval Zanella 2023-08-25 13:51:03 UTC
(In reply to Adhemerval Zanella from comment #19)
> (In reply to Adhemerval Zanella from comment #17)
> > The math tests do all build because different than mc68020, GCC defines
> > __DEC_EVAL_METHOD__ to 2 for mc68030.
> 
> *Some* math tests do *not* build ...

Another correction, the __DEC_EVAL_METHOD__ issues is for mc68040 in fact (not mc68030).
Comment 21 Adhemerval Zanella 2023-08-25 13:53:09 UTC
The build issues was fixed on 2.39 (b85880633f69b737050c22eede858f8c13bb2248).