On 16/07/2025 11:54, Alex Bennée wrote:
We didn't have any reliable way to build sparc test cases. I have
found someone who ships a compiler but the binaries still don't run
due to the need for CASA.
I'm posting mainly for those who actually care who might want to fix
up the remaining cases.
Alex.
Alex Bennée (6):
tests/tcg: special case sparc test cases
tests/tcg: special case sparc32plus test cases
configure: update sparc and sparc32plus target compiler detection
tests/docker: add sparc-leon-cross container image
configure: enable the container fallbacks for sparc/sparc32plus
docs/about: deprecate add sparc/sparc32plus-*-user
docs/about/deprecated.rst | 8 ++++
configure | 11 ++++-
.../dockerfiles/sparc-leon-cross.docker | 40 +++++++++++++++++
tests/tcg/Makefile.target | 9 ++--
tests/tcg/sparc/Makefile.target | 45 +++++++++++++++++++
tests/tcg/sparc32plus | 1 +
6 files changed, 108 insertions(+), 6 deletions(-)
create mode 100644 tests/docker/dockerfiles/sparc-leon-cross.docker
create mode 100644 tests/tcg/sparc/Makefile.target
create mode 120000 tests/tcg/sparc32plus
For reference: I did some experiments here to find out what was happening, and the
problem is that glibc dropped support for sparcv8 some time ago. This leaves the
SPARC 32-bit default implementation being that for the LEON cpu which *does* include
the cas instruction and therefore it can appear in the output binary.
As an experiment I set up a new repository at
https://github.com/mcayland/sparc-linux-cross/ containing a Dockerfile that can build
a suitable toolchain using an older glibc, along with the final container at
ghcr.io/mcayland/sparc-linux-cross. Using this I can get much further with the tcg tests:
make -C tests/tcg/sparc-linux-user SPEED=quick run
make[2]: Entering directory
'/home/mca/src/upstream/qemu/build/tests/tcg/sparc-linux-user'
timeout -s KILL --foreground 120 env
QEMU=/home/mca/src/upstream/qemu/build/qemu-sparc
/home/mca/src/upstream/qemu/build/qemu-sparc catch-syscalls > catch-syscalls.out
timeout -s KILL --foreground 120 env
QEMU=/home/mca/src/upstream/qemu/build/qemu-sparc
/home/mca/src/upstream/qemu/build/qemu-sparc float_convd > float_convd.out
timeout -s KILL --foreground 120 env
QEMU=/home/mca/src/upstream/qemu/build/qemu-sparc
/home/mca/src/upstream/qemu/build/qemu-sparc float_convs > float_convs.out
timeout -s KILL --foreground 120 env
QEMU=/home/mca/src/upstream/qemu/build/qemu-sparc
/home/mca/src/upstream/qemu/build/qemu-sparc float_madds > float_madds.out
timeout -s KILL --foreground 120 env
QEMU=/home/mca/src/upstream/qemu/build/qemu-sparc
/home/mca/src/upstream/qemu/build/qemu-sparc fnmsub > fnmsub.out
timeout -s KILL --foreground 120 env
QEMU=/home/mca/src/upstream/qemu/build/qemu-sparc
/home/mca/src/upstream/qemu/build/qemu-sparc follow-fork-mode > follow-fork-mode.out
timeout -s KILL --foreground 120 env
QEMU=/home/mca/src/upstream/qemu/build/qemu-sparc
/home/mca/src/upstream/qemu/build/qemu-sparc late-attach > late-attach.out
timeout -s KILL --foreground 120 env
QEMU=/home/mca/src/upstream/qemu/build/qemu-sparc
/home/mca/src/upstream/qemu/build/qemu-sparc munmap-pthread > munmap-pthread.out
timeout -s KILL --foreground 120 env
QEMU=/home/mca/src/upstream/qemu/build/qemu-sparc
/home/mca/src/upstream/qemu/build/qemu-sparc overflow > overflow.out
timeout -s KILL --foreground 120 env
QEMU=/home/mca/src/upstream/qemu/build/qemu-sparc
/home/mca/src/upstream/qemu/build/qemu-sparc prot-none > prot-none.out
timeout -s KILL --foreground 120 env
QEMU=/home/mca/src/upstream/qemu/build/qemu-sparc
/home/mca/src/upstream/qemu/build/qemu-sparc segfault > segfault.out
timeout -s KILL --foreground 120 env
QEMU=/home/mca/src/upstream/qemu/build/qemu-sparc
/home/mca/src/upstream/qemu/build/qemu-sparc sha1 > sha1.out
timeout -s KILL --foreground 120 env
QEMU=/home/mca/src/upstream/qemu/build/qemu-sparc
/home/mca/src/upstream/qemu/build/qemu-sparc sha512 > sha512.out
timeout -s KILL --foreground 120 env
QEMU=/home/mca/src/upstream/qemu/build/qemu-sparc
/home/mca/src/upstream/qemu/build/qemu-sparc sigbus > sigbus.out
SKIPPED signals is broken on sparc because
timeout -s KILL --foreground 120 env
QEMU=/home/mca/src/upstream/qemu/build/qemu-sparc
/home/mca/src/upstream/qemu/build/qemu-sparc sigreturn-sigmask > sigreturn-sigmask.out
timeout -s KILL --foreground 120 env
QEMU=/home/mca/src/upstream/qemu/build/qemu-sparc
/home/mca/src/upstream/qemu/build/qemu-sparc test-mmap > test-mmap.out
timeout -s KILL --foreground 120 env
QEMU=/home/mca/src/upstream/qemu/build/qemu-sparc
/home/mca/src/upstream/qemu/build/qemu-sparc test-plugin-mem-access >
test-plugin-mem-access.out
timeout -s KILL --foreground 120 env
QEMU=/home/mca/src/upstream/qemu/build/qemu-sparc
/home/mca/src/upstream/qemu/build/qemu-sparc testthread > testthread.out
timeout -s KILL --foreground 120 env
QEMU=/home/mca/src/upstream/qemu/build/qemu-sparc
/home/mca/src/upstream/qemu/build/qemu-sparc threadcount > threadcount.out
SKIPPED vma-pthread is broken on sparc because
timeout -s KILL --foreground 120 env
QEMU=/home/mca/src/upstream/qemu/build/qemu-sparc
/home/mca/src/upstream/qemu/build/qemu-sparc linux-madvise > linux-madvise.out
timeout -s KILL --foreground 120 env
QEMU=/home/mca/src/upstream/qemu/build/qemu-sparc
/home/mca/src/upstream/qemu/build/qemu-sparc linux-shmat-maps > linux-shmat-maps.out
timeout -s KILL --foreground 120 env
QEMU=/home/mca/src/upstream/qemu/build/qemu-sparc
/home/mca/src/upstream/qemu/build/qemu-sparc linux-shmat-null > linux-shmat-null.out
timeout -s KILL --foreground 120 env
QEMU=/home/mca/src/upstream/qemu/build/qemu-sparc
/home/mca/src/upstream/qemu/build/qemu-sparc linux-sigrtminmax > linux-sigrtminmax.out
SKIPPED linux-test is broken on sparc because
timeout -s KILL --foreground 120 env
QEMU=/home/mca/src/upstream/qemu/build/qemu-sparc
/home/mca/src/upstream/qemu/build/qemu-sparc test-vma > test-vma.out
make[2]: Leaving directory
'/home/mca/src/upstream/qemu/build/tests/tcg/sparc-linux-user'
make[1]: Leaving directory '/home/mca/src/upstream/qemu/build'
Using this there are 3 tests that are broken. The signals and vma-pthread tests are
caused by the use of -latomic during linking, and closer examination shows that
despite using sparcv8, libatomic is still being built as sparcv8plus in the container:
root@46da5c5071f0:/opt/local/sparc-linux-gnu/lib# file libatomic.so.1.2.0
libatomic.so.1.2.0: ELF 32-bit MSB shared object, SPARC32PLUS, V8+ Required, total
store ordering, version 1 (SYSV), dynamically linked, with debug_info, not stripped
This could also be due to the use of atomic instructions only available on some more
modern CPUs.
In summary it seems that things aren't completely broken, but certainly there is some
concern that sparcv8 support does not appear to be being actively tested within the
current toolchain, and could possibly disappear at some point as it already has done
with glibc.
ATB,
Mark.