On 2020/11/18 21:11, George Koehler wrote:
> On Wed, 18 Nov 2020 00:20:38 +0000
> Stuart Henderson <[email protected]> wrote:
>
> > I've updated it (and fixed up deps). I've run the test suite on aarch64,
> > amd64, i386 with no problems, it seems to have fairly good cross-arch
> > compatibility but wouldn't hurt to get reports from other archs if anyone
> > with those systems has time.
>
> cryptopp has wrong powerpc* simd code; "make test" crashed on macppc.
> "make build" failed on powerpc64.
>
> On macppc, "./cryptest.exe v" got "Illegal instruction (core dumped)"
> from a SIGILL in ppc_power7.cpp CPU_ProbePower7(). This file is built
> with -mcpu=power7 -maltivec and the code tries to handle SIGILL:
>
> bool CPU_ProbePower7()
> {
> ...
> volatile SigHandler oldHandler = signal(SIGILL, SigIllHandler);
> ...
> signal(SIGILL, oldHandler);
> return result;
> }
>
> It crashed because clang put an "isel" after the second signal call,
> and macppc hardware is older than power7.
>
> (gdb) disas
>
> Dump of assembler code for function _ZN8CryptoPP15CPU_ProbePower7Ev:
> ...
> 0x0cdcfd6c <+92>: bl 0xce929fc <00008000.got2.plt_pic32.signal>
> ...
> 0x0cdcfe38 <+296>: bl 0xce929fc <00008000.got2.plt_pic32.signal>
> ...
> => 0x0cdcfe50 <+320>: isel r3,r3,r29,20
> ...
>
> My powerpc64 has a POWER9, but "make build" failed, perhaps because
> of confusion between unsigned long and unsigned long long for a 64-bit
> integer. I copied the first error below. Later, if I find time, I
> might try to send bug report to upstream. --George
Thanks for testing. I wonder if the old version failed too, the port
isn't widely used in the tree and I could easily believe that nobody
used powerpc for "file sharing" or emulating 3DS or ran tests there
before. I've gone for the simple option for now,
.include <bsd.port.arch.mk>
-.if ${PROPERTIES:Mclang}
+.if ${MACHINE_ARCH:Mpowerpc*}
+# https://marc.info/?l=openbsd-ports&m=160575195204466&w=2
+CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
+.elif ${PROPERTIES:Mclang}
CXXFLAGS += -DCRYPTOPP_DISABLE_MIXED_ASM
.endif