NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-sparc64/60518: sparc64 compat32 is not compatible enough



>Number:         60518
>Category:       port-sparc64
>Synopsis:       sparc64 compat32 is not compatible enough
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-sparc64-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 29 21:40:00 +0000 2026
>Originator:     Valery Ushakov
>Release:        NetBSD 11.99
>Organization:
>Environment:
NetBSD aurinko 11.99.7 NetBSD 11.99.7 (ULTRA1) #0: Thu Jul 23 00:59:41 MSK 2026  uwe@supi:/home/uwe/work/netbsd/cvs/src/sys/arch/sparc64/compile/ULTRA1 sparc64

>Description:
sparc64 ships compat32 libs, however the sparc64 32-bit libc has a
different set of sync/atomic functions compared to sparc 32-bit libc.
This makes it impossible to run some sparc binaries on sparc64 with
compat32 libs, notably sparc 32-bit gdb[*].

[*] port-sparc64/58976: sparc64 gdb cannot debug 32-bit binaries

>How-To-Repeat:
gdb32 copied over from the sparc build:

$ ldd ~/bin/gdb32
/home/uwe/bin/gdb32:
        -lexpat.2 => /usr/lib/sparc/libexpat.so.2
        -lgcc_s.1 => /usr/lib/sparc/libgcc_s.so.1
        -lc.12 => /usr/lib/sparc/libc.so.12
        -llzma.2 => /usr/lib/sparc/liblzma.so.2
        -lpthread.1 => /usr/lib/sparc/libpthread.so.1
        -lz.1 => /usr/lib/sparc/libz.so.1
        -lcurses.9 => /usr/lib/sparc/libcurses.so.9
        -lterminfo.2 => /usr/lib/sparc/libterminfo.so.2
        -lintl.1 => /usr/lib/sparc/libintl.so.1
        -lkvm.6 => /usr/lib/sparc/libkvm.so.6
        -lutil.7 => /usr/lib/sparc/libutil.so.7
        -lstdc++.9 => /usr/lib/sparc/libstdc++.so.9
        -lm.0 => /usr/lib/sparc/libm.so.0

Try to run it

$ cc -m32 -g hello.c
$ gdb32 -q a.out 
Reading symbols from a.out...
(gdb) /home/uwe/bin/gdb32: Undefined PLT symbol "__atomic_compare_exchange_1" (symnum = 325)
$ LD_BIND_NOW=1 gdb32 -q
/home/uwe/bin/gdb32: Undefined PLT symbol "__sync_bool_compare_and_swap_4" (symnum = 153)

>Fix:
Is it for natively compiled 32-bit code `cc -m32`?  Is it for running
sparc binaries?  Both?

I tried to look at the way compat32 libc compiles sync/atomic code,
but it's so meta, I've got lost, and I'm not even sure which set of
functions (all named alike but slightly differently) is expected to be
provided to begin with.  I'd argue that compat32 libc should be link
compatible with natively 32-bit libc from the sparc port.




Home | Main Index | Thread Index | Old Index