|
|
Message-ID: <20261103114446.GV3542221@port70.net>
Date: Tue, 3 Nov 2026 12:44:46 +0100
From: Szabolcs Nagy <nsz@...t70.net>
To: Imre Kaloz <kaloz@...nel.org>
Cc: musl@...ts.openwall.com
Subject: Re: [PATCH 00/10] add sparc64 port
* Imre Kaloz <kaloz@...nel.org> [2026-11-02 17:58:27 +0100]:
> This adds a sparc64 port.
>
> Patch 1 fixes pthread_sigmask, which assumed the SIG_* values are
> consecutive; it stands alone.
> Patches 2-8 add the arch hooks, and patch 9 is the port itself.
> Patch 10 documents it in INSTALL.
>
> On sparc64:
>
> - clone returns as fork does on sparc: %o1 is 1 in the child, and %o0
> holds a pid on both sides. glibc tests %o1 the same way.
> - rt_sigaction takes the restorer as its fourth argument, and there is
> no SA_RESTORER.
> - PLT entries are code, so the dynamic linker resolves a JMP_SLOT by
> writing and flushing instructions.
this was where the last porting effort got stuck.
designing an abi that does not write plt would be preferable.
> - Relocations against local symbols resolve to the load base, because
> the linker puts the full address in the addend.
> - The kernel's struct timeval is {long, int}. Patch 7 converts it for
> the syscalls and ioctls that pass one; SO_TIMESTAMP needs Linux 5.1
> or later, since recvmsg's conversion of the old timestamp assumes
> two longs.
> - The signal frame holds only the first 8 bytes of uc_sigmask, so
> handlers change it with sigaddset and sigdelset.
> - long double is IEEE quad, computed by software _Qp_* helpers in
> src/math/sparc64. Their u128 code is copied from sqrtl.c and could
> move to a shared header.
soft fp code already exists in libgcc (with different call abi)
so ideally that logic would be used instead of replicating and
maintaining it in musl. (or using 64bit long double)
it is a bit smaller than i expected, but still a lot to go through.
i don't think libc-test has good coverage of fp128
(and math code in general will not test some edge cases)
did you test the soft float code independently?
>
> Tested with libc-test, static and dynamic, on a Sun Ultra 45 and under
> qemu-sparc64. The failures that also occur on x86_64 are api/main,
> strptime, wordexp, math/powf, and the dlopen and TLS tests in a static
> build. In the static build on the Ultra 45 and in qemu system mode
> malloc-brk-fail fails too: its memory fill cannot exhaust the sparc64
> address space, so malloc still succeeds. Under qemu-user the robust and
> priority-inheritance mutex tests fail; they pass on the Ultra 45.
sounds good.
>
> Imre Kaloz (10):
> pthread_sigmask: validate how by value, not as a contiguous range
> allow archs to override fcntl lock and socket option numbers
> support archs whose clone indicates the child in a second return
> register
> add SYSCALL_RT_SIGACTION_RESTORER hook for sparc
> add MC_NPC hook for cancellation on delayed-branch archs
> add sparc ipc() hooks for semctl and msgrcv
> convert kernel timevals where suseconds_t is 32-bit
> add ARCH_PLT_WRITE hook for archs whose PLT entries hold code
> add sparc64 port
> document sparc64 support in INSTALL file
>
> INSTALL | 6 +
> arch/sparc64/atomic_arch.h | 35 ++
> arch/sparc64/bits/alltypes.h.in | 18 +
> arch/sparc64/bits/errno.h | 134 ++++++
> arch/sparc64/bits/fcntl.h | 39 ++
> arch/sparc64/bits/fenv.h | 17 +
> arch/sparc64/bits/float.h | 20 +
> arch/sparc64/bits/ioctl.h | 101 +++++
> arch/sparc64/bits/limits.h | 1 +
> arch/sparc64/bits/mman.h | 12 +
> arch/sparc64/bits/poll.h | 5 +
> arch/sparc64/bits/resource.h | 5 +
> arch/sparc64/bits/setjmp.h | 1 +
> arch/sparc64/bits/shm.h | 24 +
> arch/sparc64/bits/signal.h | 98 +++++
> arch/sparc64/bits/socket.h | 81 ++++
> arch/sparc64/bits/syscall.h.in | 395 +++++++++++++++++
> arch/sparc64/bits/termios.h | 151 +++++++
> arch/sparc64/bits/user.h | 25 ++
> arch/sparc64/crt_arch.h | 19 +
> arch/sparc64/ksigaction.h | 10 +
> arch/sparc64/kstat.h | 23 +
> arch/sparc64/pthread_arch.h | 10 +
> arch/sparc64/reloc.h | 69 +++
> arch/sparc64/syscall_arch.h | 134 ++++++
> configure | 5 +
> include/fcntl.h | 2 +
> include/sys/socket.h | 2 +
> ldso/dynlink.c | 11 +
> src/fenv/sparc64/fenv.c | 58 +++
> src/internal/syscall.h | 11 +
> src/ipc/msgrcv.c | 2 +
> src/ipc/semctl.c | 2 +
> src/ldso/sparc64/dlsym.s | 8 +
> src/linux/clock_adjtime.c | 18 +
> src/linux/wait4.c | 10 +
> src/math/sparc64/qp.c | 231 ++++++++++
> src/math/sparc64/quad.h | 580 +++++++++++++++++++++++++
> src/misc/getrusage.c | 10 +
> src/misc/ioctl.c | 12 +
> src/network/getsockopt.c | 13 +
> src/network/setsockopt.c | 6 +
> src/process/_Fork.c | 4 +-
> src/process/vfork.c | 4 +-
> src/select/select.c | 5 +
> src/setjmp/sparc64/longjmp.s | 18 +
> src/setjmp/sparc64/setjmp.s | 22 +
> src/signal/getitimer.c | 12 +
> src/signal/setitimer.c | 18 +
> src/signal/sigaction.c | 12 +
> src/signal/sparc64/restore.s | 15 +
> src/signal/sparc64/sigsetjmp.s | 25 ++
> src/thread/pthread_cancel.c | 3 +
> src/thread/pthread_sigmask.c | 3 +-
> src/thread/sparc64/__set_thread_area.s | 8 +
> src/thread/sparc64/__unmapself.c | 28 ++
> src/thread/sparc64/clone.S | 51 +++
> src/thread/sparc64/syscall_cp.s | 38 ++
> src/unistd/sparc64/pipe.s | 18 +
> 59 files changed, 2695 insertions(+), 3 deletions(-)
> create mode 100644 arch/sparc64/atomic_arch.h
> create mode 100644 arch/sparc64/bits/alltypes.h.in
> create mode 100644 arch/sparc64/bits/errno.h
> create mode 100644 arch/sparc64/bits/fcntl.h
> create mode 100644 arch/sparc64/bits/fenv.h
> create mode 100644 arch/sparc64/bits/float.h
> create mode 100644 arch/sparc64/bits/ioctl.h
> create mode 100644 arch/sparc64/bits/limits.h
> create mode 100644 arch/sparc64/bits/mman.h
> create mode 100644 arch/sparc64/bits/poll.h
> create mode 100644 arch/sparc64/bits/resource.h
> create mode 100644 arch/sparc64/bits/setjmp.h
> create mode 100644 arch/sparc64/bits/shm.h
> create mode 100644 arch/sparc64/bits/signal.h
> create mode 100644 arch/sparc64/bits/socket.h
> create mode 100644 arch/sparc64/bits/syscall.h.in
> create mode 100644 arch/sparc64/bits/termios.h
> create mode 100644 arch/sparc64/bits/user.h
> create mode 100644 arch/sparc64/crt_arch.h
> create mode 100644 arch/sparc64/ksigaction.h
> create mode 100644 arch/sparc64/kstat.h
> create mode 100644 arch/sparc64/pthread_arch.h
> create mode 100644 arch/sparc64/reloc.h
> create mode 100644 arch/sparc64/syscall_arch.h
> create mode 100644 src/fenv/sparc64/fenv.c
> create mode 100644 src/ldso/sparc64/dlsym.s
> create mode 100644 src/math/sparc64/qp.c
> create mode 100644 src/math/sparc64/quad.h
> create mode 100644 src/setjmp/sparc64/longjmp.s
> create mode 100644 src/setjmp/sparc64/setjmp.s
> create mode 100644 src/signal/sparc64/restore.s
> create mode 100644 src/signal/sparc64/sigsetjmp.s
> create mode 100644 src/thread/sparc64/__set_thread_area.s
> create mode 100644 src/thread/sparc64/__unmapself.c
> create mode 100644 src/thread/sparc64/clone.S
> create mode 100644 src/thread/sparc64/syscall_cp.s
> create mode 100644 src/unistd/sparc64/pipe.s
>
>
> base-commit: 7813e9119eb5fe681b6750b8a033a0490bca0941
> --
> 2.47.3
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.