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

"Taylor R Campbell via gnats" <[email protected]> Wed, 29 Jul 2026 23:30:03 +0000 (UTC)
Newsgroups gmane.os.netbsd.bugs
Message-ID <[email protected]>
The following reply was made to PR port-sparc64/60518; it has been noted by GNATS.

From: Taylor R Campbell <[email protected]>
To: Valery Ushakov <[email protected]>
Cc: [email protected], [email protected]
Subject: Re: port-sparc64/60518: sparc64 compat32 is not compatible enough
Date: Wed, 29 Jul 2026 23:29:53 +0000

 I bet this is the relevant part that's missing files needed for
 __atomic_compare_exchange_1, __sync_bool_compare_and_swap_4, and
 whatever else -- in addition to (or perhaps instead of) what the
 comment says, I think it is used when building compat32 libc.so on
 sparc64:
 
       5 # This is called with MACHINE=3Dsparc64 && MACHINE_ARCH=3Dsparc whe=
 n building
       6 # 32 bit kernels for ultrasparc hardware
       7 .if ${MACHINE} =3D=3D "sparc64" && \
       8 	(${HAVE_LLVM:Uno} =3D=3D "no" || (defined(LIB) && ${LIB} =3D=3D "k=
 ern"))
       9=20
      10 SPARC64DIR=3D	${.PARSEDIR}/../../sparc64/atomic
      11 .PATH.c: ${SPARC64DIR}
      12 .PATH.S: ${SPARC64DIR}
      13=20
      14 .include "${SPARC64DIR}/Makefile.inc"
      15=20
      16 .if defined(LIB) && (${LIB} =3D=3D "kern" || ${LIB} =3D=3D "c" || $=
 {LIB} =3D=3D "pthread" \
      17 	|| ${LIB} =3D=3D "rump")
      18 SRCS+=3D	atomic_nand_64_cas.c atomic_xor_64_cas.c atomic_sub_64_cas=
 .c \
      19 	atomic_cas_64_cas.c
      20 .endif
      21=20
      22 .else
 
 https://nxr.NetBSD.org/xref/src/common/lib/libc/arch/sparc/atomic/Makefile.=
 inc?r=3D1.24#5
 
 Try adding the following files to it (Makefile.inc rev. 1.18 from
 back in 2014):
 
 atomic_c11_compare_exchange_cas_32.c
 atomic_c11_compare_exchange_cas_16.c
 atomic_c11_compare_exchange_cas_8.c
 
 Also, try comparing the output of:
 
 sparc$ nm -gD --defined-only /usr/lib/libc.so
 sparc64$ nm -gD --defined-only /usr/lib/sparc/libc.so
 
 I bet there'll be other discrepancies too that have been overlooked
 over the years.