Hi, 

As seen in the current powerpc bulk, nss is broken because we don't
implement getauxval(3):

> blinit.c:360:22: error: sys/auxv.h: No such file or directory

It has already been reported upstream [1], but `__has_include()'
is a GCC>=5 feature [2], and i didn't feel like imposing the use of
ports-gcc to other archs, so i adapted it to keep it built with base-gcc.

It then builds fine on macppc [3].

As you can see in the below patch, it's powerpc only where it has never
been built yet, so i did not bump REVISION.

Comments/feedback are welcome,

Charlène.


[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1602743
[2] https://www.gnu.org/software/gcc/gcc-5/changes.html
[3] https://bin.charlenew.xyz/nss.log


Index: patches/patch-nss_lib_freebl_blinit_c
===================================================================
RCS file: patches/patch-nss_lib_freebl_blinit_c
diff -N patches/patch-nss_lib_freebl_blinit_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-nss_lib_freebl_blinit_c       25 Dec 2019 17:36:38 -0000
@@ -0,0 +1,32 @@
+$OpenBSD$
+
+PowerPC only fix. OpenBSD does not support getauxval(3), from:
+https://bugzilla.mozilla.org/show_bug.cgi?id=1602743 ,
+modified to build with base-gcc (__has_include() is gcc>=5).
+
+Index: nss/lib/freebl/blinit.c
+--- nss/lib/freebl/blinit.c.orig
++++ nss/lib/freebl/blinit.c
+@@ -357,7 +357,9 @@ ppc_crypto_support()
+ 
+ #if defined(__powerpc__)
+ 
++#if !defined(__OpenBSD__)
+ #include <sys/auxv.h>
++#endif
+ 
+ // Defines from cputable.h in Linux kernel - PPC, letting us build on older 
kernels
+ #ifndef PPC_FEATURE2_VEC_CRYPTO
+@@ -368,8 +370,11 @@ static void
+ CheckPPCSupport()
+ {
+     char *disable_hw_crypto = PR_GetEnvSecure("NSS_DISABLE_PPC_GHASH");
++    long hwcaps = 0;
+ 
+-    long hwcaps = getauxval(AT_HWCAP2);
++#if !defined(__OpenBSD__)
++    hwcaps = getauxval(AT_HWCAP2);
++#endif
+ 
+     ppc_crypto_support_ = hwcaps & PPC_FEATURE2_VEC_CRYPTO && 
disable_hw_crypto == NULL;
+ }

Reply via email to