author | glaubitz <glaubitz@physik.fu-berlin.de> |
Tue, 06 Apr 2021 11:10:07 +0000 (2021-04-06) | |
changeset 15888 | a66c71152314e591106680e6de618c3c8d044373 |
parent 15887 | 03887cc555ef018c0a48f72de6ebe6a5b1f29700 |
child 15892 | 81628e9164ff78ce446fc03c849580384bef37fe |
push id | 3938 |
push user | bbeurdouche@mozilla.com |
push date | Tue, 06 Apr 2021 11:12:17 +0000 (2021-04-06) |
reviewers | bbeurdouche |
bugs | 1687164 |
coreconf/Linux.mk | file | annotate | diff | comparison | revisions | |
coreconf/config.gypi | file | annotate | diff | comparison | revisions | |
coreconf/config.mk | file | annotate | diff | comparison | revisions | |
lib/freebl/Makefile | file | annotate | diff | comparison | revisions | |
lib/freebl/freebl.gyp | file | annotate | diff | comparison | revisions |
--- a/coreconf/Linux.mk +++ b/coreconf/Linux.mk @@ -49,16 +49,21 @@ ifndef INTERNAL_TOOLS CROSS_COMPILE = 1 endif endif ifeq (,$(filter-out ppc64 ppc64le,$(OS_TEST))) CPU_ARCH = ppc ifeq ($(USE_64),1) ARCHFLAG = -m64 endif +ifeq (,$(filter-out ppc ppc64,$(OS_TEST))) +ifneq ($(NSS_DISABLE_CRYPTO_VSX),0) + NSS_DISABLE_CRYPTO_VSX=1 +endif +endif else ifeq ($(OS_TEST),alpha) OS_REL_CFLAGS = -D_ALPHA_ CPU_ARCH = alpha else ifeq ($(OS_TEST),x86_64) ifeq ($(USE_64),1) CPU_ARCH = x86_64
--- a/coreconf/config.gypi +++ b/coreconf/config.gypi @@ -102,16 +102,17 @@ 'disable_tests%': 0, 'disable_chachapoly%': 0, 'disable_deprecated_seed%': 0, 'disable_deprecated_rc2%': 0, 'disable_dbm%': 1, 'disable_libpkix%': 1, 'disable_werror%': 0, 'disable_altivec%': 0, + 'disable_crypto_vsx%': 0, 'disable_arm32_neon%': 0, 'mozilla_client%': 0, 'comm_client%': 0, 'moz_fold_libs%': 0, 'moz_folded_library_name%': '', 'sanitizer_flags%': 0, 'static_libs%': 0, 'no_zdefs%': 0,
--- a/coreconf/config.mk +++ b/coreconf/config.mk @@ -226,20 +226,25 @@ endif endif # Avoid building with Neon acceleration on Arm32 ifdef NSS_DISABLE_ARM32_NEON DEFINES += -DNSS_DISABLE_ARM32_NEON endif # Avoid building with PowerPC's Altivec acceleration -ifdef NSS_DISABLE_ALTIVEC +ifeq ($(NSS_DISABLE_ALTIVEC),1) DEFINES += -DNSS_DISABLE_ALTIVEC endif +# Avoid building with PowerPC's Crypto and VSX instructions +ifeq ($(NSS_DISABLE_CRYPTO_VSX),1) +DEFINES += -DNSS_DISABLE_CRYPTO_VSX +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 DEFINES += -DUSE_UTIL_DIRECTLY USE_UTIL_DIRECTLY = 1 # Build with NO_NSPR_10_SUPPORT to avoid using obsolete NSPR features DEFINES += -DNO_NSPR_10_SUPPORT
--- a/lib/freebl/Makefile +++ b/lib/freebl/Makefile @@ -755,25 +755,30 @@ endif ifeq ($(CPU_ARCH),aarch64) $(OBJDIR)/$(PROG_PREFIX)aes-armv8$(OBJ_SUFFIX): CFLAGS += -march=armv8-a+crypto $(OBJDIR)/$(PROG_PREFIX)gcm-aarch64$(OBJ_SUFFIX): CFLAGS += -march=armv8-a+crypto $(OBJDIR)/$(PROG_PREFIX)sha1-armv8$(OBJ_SUFFIX): CFLAGS += -march=armv8-a+crypto $(OBJDIR)/$(PROG_PREFIX)sha256-armv8$(OBJ_SUFFIX): CFLAGS += -march=armv8-a+crypto 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 -$(OBJDIR)/$(PROG_PREFIX)sha512$(OBJ_SUFFIX): CFLAGS += -mcrypto -maltivec -mvsx \ - -funroll-loops -fpeel-loops -ifeq ($(OS_TEST),ppc64le) -$(OBJDIR)/$(PROG_PREFIX)chacha20poly1305-ppc$(OBJ_SUFFIX): CFLAGS += -mcrypto -maltivec -mvsx -endif # ppc64le +$(OBJDIR)/$(PROG_PREFIX)sha512$(OBJ_SUFFIX): CFLAGS += -funroll-loops -fpeel-loops +ifneq ($(NSS_DISABLE_ALTIVEC),1) +$(OBJDIR)/$(PROG_PREFIX)gcm-ppc$(OBJ_SUFFIX): CFLAGS += -maltivec +$(OBJDIR)/$(PROG_PREFIX)gcm$(OBJ_SUFFIX): CFLAGS += -maltivec +$(OBJDIR)/$(PROG_PREFIX)rijndael$(OBJ_SUFFIX): CFLAGS += -maltivec +$(OBJDIR)/$(PROG_PREFIX)sha512$(OBJ_SUFFIX): CFLAGS += -maltivec +$(OBJDIR)/$(PROG_PREFIX)chacha20poly1305-ppc$(OBJ_SUFFIX): CFLAGS += -maltivec +endif +ifneq ($(NSS_DISABLE_CRYPTO_VSX),1) +$(OBJDIR)/$(PROG_PREFIX)gcm-ppc$(OBJ_SUFFIX): CFLAGS += -mcrypto -mvsx +$(OBJDIR)/$(PROG_PREFIX)gcm$(OBJ_SUFFIX): CFLAGS += -mcrypto -mvsx +$(OBJDIR)/$(PROG_PREFIX)rijndael$(OBJ_SUFFIX): CFLAGS += -mcrypto -mvsx +$(OBJDIR)/$(PROG_PREFIX)sha512$(OBJ_SUFFIX): CFLAGS += -mcrypto -mvsx +$(OBJDIR)/$(PROG_PREFIX)chacha20poly1305-ppc$(OBJ_SUFFIX): CFLAGS += -mcrypto -mvsx endif endif $(OBJDIR)/$(PROG_PREFIX)Hacl_Chacha20_Vec128$(OBJ_SUFFIX): CFLAGS += -mssse3 -msse4.1 -msse4.2 -mavx -maes $(OBJDIR)/$(PROG_PREFIX)Hacl_Chacha20Poly1305_128$(OBJ_SUFFIX): CFLAGS += -mssse3 -msse4.1 -msse4.2 -mavx -maes $(OBJDIR)/$(PROG_PREFIX)Hacl_Poly1305_128$(OBJ_SUFFIX): CFLAGS += -mssse3 -msse4.1 -msse4.2 -mavx -maes -mpclmul ifndef NSS_DISABLE_AVX2
--- a/lib/freebl/freebl.gyp +++ b/lib/freebl/freebl.gyp @@ -259,71 +259,112 @@ 'type': 'static_library', 'sources': [ 'gcm-ppc.c', 'sha512-p8.s', ], 'dependencies': [ '<(DEPTH)/exports.gyp:nss_exports' ], - 'cflags': [ - '-mcrypto', - '-maltivec' - ], - 'cflags_mozilla': [ - '-mcrypto', - '-maltivec' - ], + 'conditions': [ + [ 'disable_crypto_vsx==0', { + 'cflags': [ + '-mcrypto', + '-maltivec' + ], + 'cflags_mozilla': [ + '-mcrypto', + '-maltivec' + ], + }, 'disable_crypto_vsx==1', { + 'cflags': [ + '-maltivec' + ], + 'cflags_mozilla': [ + '-maltivec' + ], + }] + ] }, { 'target_name': 'gcm-sha512-nodepend-ppc_c_lib', 'type': 'static_library', 'sources': [ 'sha512.c', ], 'dependencies': [ '<(DEPTH)/exports.gyp:nss_exports' ], - 'cflags': [ - '-mcrypto', - '-maltivec', - '-mvsx', - '-funroll-loops', - '-fpeel-loops', - ], - 'cflags_mozilla': [ - '-mcrypto', - '-maltivec', - '-mvsx', - '-funroll-loops', - '-fpeel-loops', - ], + 'conditions': [ + [ 'disable_crypto_vsx==0', { + 'cflags': [ + '-mcrypto', + '-maltivec', + '-mvsx', + '-funroll-loops', + '-fpeel-loops' + ], + 'cflags_mozilla': [ + '-mcrypto', + '-maltivec', + '-mvsx', + '-funroll-loops', + '-fpeel-loops' + ], + }, 'disable_crypto_vsx==1', { + 'cflags': [ + '-maltivec', + '-funroll-loops', + '-fpeel-loops' + ], + 'cflags_mozilla': [ + '-maltivec', + '-funroll-loops', + '-fpeel-loops' + ], + }] + ] }, { 'target_name': 'gcm-sha512-ppc_c_lib', 'type': 'static_library', 'sources': [ 'sha512.c', ], 'dependencies': [ '<(DEPTH)/exports.gyp:nss_exports' ], - 'cflags': [ - '-mcrypto', - '-maltivec', - '-mvsx', - '-funroll-loops', - '-fpeel-loops', - ], - 'cflags_mozilla': [ - '-mcrypto', - '-maltivec', - '-mvsx', - '-funroll-loops', - '-fpeel-loops', + 'conditions': [ + [ 'disable_crypto_vsx==0', { + 'cflags': [ + '-mcrypto', + '-maltivec', + '-mvsx', + '-funroll-loops', + '-fpeel-loops' + ], + 'cflags_mozilla': [ + '-mcrypto', + '-maltivec', + '-mvsx', + '-funroll-loops', + '-fpeel-loops' + ], + }, 'disable_crypto_vsx==1', { + 'cflags': [ + '-maltivec', + '-funroll-loops', + '-fpeel-loops' + ], + 'cflags_mozilla': [ + '-maltivec', + '-funroll-loops', + '-fpeel-loops' + ], + }] ], 'defines!': [ 'FREEBL_NO_DEPEND', ], }, { 'target_name': 'chacha20-ppc_lib', 'type': 'static_library', @@ -427,16 +468,21 @@ 'chacha20-ppc_lib', ], }], [ 'disable_altivec==1 and (target_arch=="ppc64" or target_arch=="ppc64le")', { 'defines!': [ 'NSS_DISABLE_ALTIVEC', ], }], + [ 'disable_crypto_vsx==1 and (target_arch=="ppc" or target_arch=="ppc64" or target_arch=="ppc64le")', { + 'defines!': [ + 'NSS_DISABLE_CRYPTO_VSX', + ], + }], [ 'OS=="linux"', { 'defines!': [ 'FREEBL_NO_DEPEND', 'FREEBL_LOWHASH', 'USE_HW_AES', 'INTEL_GCM', ], 'conditions': [ @@ -495,16 +541,21 @@ 'gcm-sha512-nodepend-ppc_c_lib', ], }], [ 'disable_altivec==1 and (target_arch=="ppc64" or target_arch=="ppc64le")', { 'defines!': [ 'NSS_DISABLE_ALTIVEC', ], }], + [ 'disable_crypto_vsx==1 and (target_arch=="ppc" or target_arch=="ppc64" or target_arch=="ppc64le")', { + 'defines!': [ + 'NSS_DISABLE_CRYPTO_VSX', + ], + }], [ 'OS!="linux"', { 'conditions': [ [ 'moz_fold_libs==0', { 'dependencies': [ '<(DEPTH)/lib/util/util.gyp:nssutil3', ], }, { 'libraries': [