On-going portability issue with 9.9p2

Dennis Clarke dclarke at blastwave.org
Sat Mar 1 14:20:26 AEDT 2025


So, I applied the patch from :

 
https://lists.mindrot.org/pipermail/openssh-unix-dev/2025-February/041816.html

Then did the usual autoreconf dance and then configure fails :

sparc64$
sparc64$ pwd
/opt/bw/build/openssh-9.9p2_SunOS_5.10_SPARC64.003
sparc64$ date -u
Sat Mar  1 03:07:19 GMT 2025
sparc64$ ../openssh-9.9p2/configure --prefix=/opt/bw --disable-strip \
 > --with-zlib=/opt/bw --with-ssl-dir=/opt/bw \
 > --with-xauth=/usr/openwin/bin/xauth \
 > --with-ipaddr-display 2>&1 | tee `pwd`.config.log
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... no
checking whether /opt/developerstudio12.6/bin/cc accepts -g... yes
checking for /opt/developerstudio12.6/bin/cc option to enable C11 
features... none needed
checking if /opt/developerstudio12.6/bin/cc supports C99-style variadic 
macros... yes
configure: error: cannot run /opt/bw/bin/bash ../openssh-9.9p2/config.sub
sparc64$

sparc64$
sparc64$ /opt/bw/bin/bash --version
GNU bash, version 5.2.32(2)-release (sparc-sun-solaris2.10)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
sparc64$

Not sure what the problem is this time.

However I can add that popc is an opcode for all reasonably modern SPARC
hardware in the last fifteen to twenty years. We really do not need the
GCC intrinsic/builtin to get a popcount. A trivial opcode gets the job
done :

sparc64$
sparc64$ /usr/local/gcc8/bin/gcc --version
gcc (genunix Fri May 11 08:23:40 GMT 2018) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

sparc64$
sparc64$ cat bob.c

/* someone suggested we look at whatever the compiler
  * knows about this thing */

int answer(unsigned int x) {
     return __builtin_popcount(x);
}


sparc64$
sparc64$ /usr/local/gcc8/bin/gcc -std=iso9899:1999 -m64 -O0 \
 > -mno-app-regs -mcpu=v9 -mtune=v9 -mno-vis -fno-builtin -mpopc \
 > -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE=600 -S -o bob_sparc64.s bob.c
sparc64$
sparc64$ cat bob_sparc64.s
         .file   "bob.c"
         .section        ".text"
         .align 4
         .global answer
         .type   answer, #function
         .proc   04
answer:
         save    %sp, -176, %sp
         mov     %i0, %g1
         st      %g1, [%fp+2175]
         ld      [%fp+2175], %g1
         srl     %g1, 0, %g1
         popc    %g1, %g1
         sra     %g1, 0, %g1
         mov     %g1, %i0
         return  %i7+8
          nop
         .size   answer, .-answer
         .ident  "GCC: (genunix Fri May 11 08:23:40 GMT 2018) 8.1.0"
sparc64$
sparc64$ /usr/local/gcc8/bin/gcc -std=iso9899:1999 -m64 -O2 \
 > -mno-app-regs -mcpu=v9 -mtune=v9 -mno-vis -fno-builtin -mpopc \
 > -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE=600 -S -o bob_sparc64.s bob.c
sparc64$
sparc64$ cat bob_sparc64.s
         .file   "bob.c"
         .section        ".text"
         .align 4
         .global answer
         .type   answer, #function
         .proc   04
answer:
         jmp     %o7+8
          popc   %o0, %o0
         .size   answer, .-answer
         .ident  "GCC: (genunix Fri May 11 08:23:40 GMT 2018) 8.1.0"
sparc64$

Really some inline ASM would get this done.

I am looking into that.



-- 
--
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken


More information about the openssh-unix-dev mailing list