Commit 718a32c6 authored by Giulio Benetti's avatar Giulio Benetti

Bug 1608151 - Introduce NSS_DISABLE_ALTIVEC and disable_altivec r=jcj

At the moment NSS assumes that every PowerPC64 architecture supports
Altivec but it's not true and this leads to build failure. So add
NSS_DISABLE_ALTIVEC environment variable(and disable_altivec for
gyp) to disable Altivec extension on PowerPC build that don't support
Altivec.

--HG--
extra : amend_source : 2624c36199d90433e32e5fb8ddf002cd65be4f6e
parent 6388a118
......@@ -102,6 +102,7 @@
'disable_dbm%': 1,
'disable_libpkix%': 1,
'disable_werror%': 0,
'disable_altivec%': 0,
'mozilla_client%': 0,
'comm_client%': 0,
'moz_fold_libs%': 0,
......
......@@ -196,6 +196,11 @@ DEFINES += -DPKIX_OBJECT_LEAK_TEST
endif
endif
# Avoid building with PowerPC's Altivec acceleration
ifdef NSS_DISABLE_ALTIVEC
DEFINES += -DNSS_DISABLE_ALTIVEC
endif
# This allows all library and tools code to use the util function
# implementations directly from libnssutil3, rather than the wrappers
# in libnss3 which are present for binary compatibility only
......
......@@ -778,10 +778,12 @@ $(OBJDIR)/$(PROG_PREFIX)gcm-aarch64$(OBJ_SUFFIX): CFLAGS += -march=armv8-a+crypt
endif
ifeq ($(CPU_ARCH),ppc)
ifndef NSS_DISABLE_ALTIVEC
$(OBJDIR)/$(PROG_PREFIX)gcm-ppc$(OBJ_SUFFIX): CFLAGS += -mcrypto -maltivec -mvsx
$(OBJDIR)/$(PROG_PREFIX)gcm$(OBJ_SUFFIX): CFLAGS += -mcrypto -maltivec -mvsx
$(OBJDIR)/$(PROG_PREFIX)rijndael$(OBJ_SUFFIX): CFLAGS += -mcrypto -maltivec -mvsx
endif
endif
$(OBJDIR)/$(PROG_PREFIX)Hacl_Chacha20_Vec128$(OBJ_SUFFIX): CFLAGS += -mssse3 -msse4 -mavx -maes
$(OBJDIR)/$(PROG_PREFIX)Hacl_Chacha20Poly1305_128$(OBJ_SUFFIX): CFLAGS += -mssse3 -msse4 -mavx -maes
......
......@@ -274,11 +274,16 @@
'gcm-aes-aarch64_c_lib',
],
}],
[ 'target_arch=="ppc64le"', {
[ 'disable_altivec==0 and (target_arch=="ppc64" or target_arch=="ppc64le")', {
'dependencies': [
'gcm-aes-ppc_c_lib',
],
}],
[ 'disable_altivec==1 and (target_arch=="ppc64" or target_arch=="ppc64le")', {
'defines!': [
'NSS_DISABLE_ALTIVEC',
],
}],
[ 'OS=="linux"', {
'defines!': [
'FREEBL_NO_DEPEND',
......@@ -330,11 +335,16 @@
'gcm-aes-aarch64_c_lib',
],
}],
[ 'target_arch=="ppc64" or target_arch=="ppc64le"', {
[ 'disable_altivec==0 and (target_arch=="ppc64" or target_arch=="ppc64le")', {
'dependencies': [
'gcm-aes-ppc_c_lib',
],
}],
[ 'disable_altivec==1 and (target_arch=="ppc64" or target_arch=="ppc64le")', {
'defines!': [
'NSS_DISABLE_ALTIVEC',
],
}],
[ 'OS!="linux"', {
'conditions': [
[ 'moz_fold_libs==0', {
......
......@@ -30,7 +30,7 @@
#include <arm_neon.h>
#endif
#ifdef __powerpc64__
#if defined(__powerpc64__) && !defined(NSS_DISABLE_ALTIVEC)
#include "altivec-types.h"
/* The ghash freebl test tries to use this in C++, and gcc defines conflict. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment