Created attachment 209799 [details] patch https://bugzilla.mozilla.org/show_bug.cgi?id=1602386Upstream report: NSS 3.48 uses getauxinfo function on all ppc architectures unconditionally, which breaks compilation on systems other than Linux distributions.
Comment on attachment 209799 [details] patch After addressing upstream review comments can you put the patch into separate file e.g., files/patch-bug1602386. files/patch-lib_freebl_blinit.c will be removed once bug 240037 is fixed.
It's another, unrelated issue, but there's a problem with building on elfv1. Newer GCC is now necessary than base has, due to the usage of -mcrypto. However, GCC9 complains: certdb.c: In function 'CERT_UnlockCertRefCount': ../../../dist/public/nss/secport.h:127:24: error: implicit declaration of function 'PR_ASSERT_ARG'; did you mean 'PR_ASSERT'? [-Werror=implicit-function-declaration] 127 | #define PORT_AssertArg PR_ASSERT_ARG | ^~~~~~~~~~~~~ It seems to be in the code that was introduced recently in https://bugzilla.mozilla.org/show_bug.cgi?id=1589073. Strangely, clang on elfv2 can compile it. I tried to build with -Wno-error=implicit-function-declaration, but then there's an issue about PR_ASSERT_ARG being unfound symbol. Still investigating.
(In reply to Piotr Kubaj from comment #2) Nevermind, NSPR 4.23 was too old.
Created attachment 209861 [details] patch Is that ok? New compiler is needed due to usage of -mcrypto and -mvsx. -mcrypto is added in nss's code and -mvsx is added by me because nss won't build otherwise: altivec-types.h:19:1: error: use of 'long long' in AltiVec types is invalid without '-mvsx' I also removed i386 section since it has C++14 capable compiler on all versions already.
Comment on attachment 209861 [details] patch > altivec-types.h:19:1: error: use of 'long long' in AltiVec types is invalid without '-mvsx' Hmm, Clang 9.0.0 doesn't complain. Tested via -target powerpc64-unknown-freebsd13.0. Given > +.if ${ARCH} == powerpc64 > +CFLAGS+= -mvsx Adding -mvsx globally (for all files) would defeat runtime detection and make the binary package unusable without VSX support (assuming auto-vectorization). Can you try adding -mvsx after -maltivec? If it works submit the fix upstream. # To build via GYP use build.sh in root directory $ rg -- -maltivec lib/freebl/freebl.gyp 162: '-maltivec' 166: '-maltivec' lib/freebl/Makefile 793:$(OBJDIR)/$(PROG_PREFIX)gcm-ppc$(OBJ_SUFFIX): CFLAGS += -mcrypto -maltivec > + sysctlbyname("hw.cpu_features", &hwcaps, &len, NULL, 0); hw.cpu_features (unlike hw.cpu_features2) will never return PPC_FEATURE2_*. Also, won't build on FreeBSD 11 due to incorrect includes. See upstream review comment.
Created attachment 209871 [details] v3 Is it ok? Fixes things without adding -mvsx globally. You don't experience a problem with clang, because the problem is only with gcc.
(In reply to Piotr Kubaj from comment #6) Wait, blinit.c needs the fix from DR.
Created attachment 209872 [details] patch This should be ok, I guess. Builds on 12.1-RELEASE.
Comment on attachment 209872 [details] patch Good enough. CPU feature detection is OK. AltiVec usage may need more work but let's unblock build and see if anyone complains about runtime.
A commit references this bug: Author: pkubaj Date: Wed Dec 11 18:57:48 UTC 2019 New revision: 519827 URL: https://svnweb.freebsd.org/changeset/ports/519827 Log: security/nss: fix build on powerpc platforms NSS 3.48 broke powerpc by using getauxval, which FreeBSD doesn't have. GCC9 is also required because of usage of VSX, which needs to be manually added for some files. PR: 242521 Approved by: jbeich (maintainer) Changes: head/security/nss/Makefile head/security/nss/files/patch-bug1602386