Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
  • Loading branch information
giuliobenetti committed Jan 27, 2020
1 parent 6388a11 commit 718a32c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions coreconf/config.gypi
Expand Up @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions coreconf/config.mk
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions lib/freebl/Makefile
Expand Up @@ -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
Expand Down
14 changes: 12 additions & 2 deletions lib/freebl/freebl.gyp
Expand Up @@ -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',
Expand Down Expand Up @@ -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', {
Expand Down
2 changes: 1 addition & 1 deletion lib/freebl/gcm.h
Expand Up @@ -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. */
Expand Down

0 comments on commit 718a32c

Please sign in to comment.