summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ.C. Jones <jjones@mozilla.com>2020-05-22 22:34:20 +0000
committerJ.C. Jones <jjones@mozilla.com>2020-05-22 22:34:20 +0000
commitc26f535bcde56c89bfed53721fa7a50175b5de69 (patch)
tree213e2c1e9b6637513ddede6c472128987df64915
parentc5c9429b5745957fd77c53a10a79ba196465d94a (diff)
downloadnss-hg-c26f535bcde56c89bfed53721fa7a50175b5de69.tar.gz
Bug 1629414 - Guard USE_PPC_CRYPTO and VSX types with __VSX__ and __ALTIVEC__ r=kjacobsNSS_3_53_BETA1
This avoids build errors on non-VSX architectures even when not compiling the POWER accelerated code. Differential Revision: https://phabricator.services.mozilla.com/D72014
-rw-r--r--lib/freebl/altivec-types.h2
-rw-r--r--lib/freebl/ppc-crypto.h7
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/freebl/altivec-types.h b/lib/freebl/altivec-types.h
index 807a44db4..118a7e087 100644
--- a/lib/freebl/altivec-types.h
+++ b/lib/freebl/altivec-types.h
@@ -16,8 +16,10 @@ typedef __vector unsigned short vec_u16;
typedef __vector signed short vec_s16;
typedef __vector unsigned int vec_u32;
typedef __vector signed int vec_s32;
+#ifdef __VSX__
typedef __vector unsigned long long vec_u64;
typedef __vector signed long long vec_s64;
+#endif
typedef __vector float vec_f;
#endif
diff --git a/lib/freebl/ppc-crypto.h b/lib/freebl/ppc-crypto.h
index 518f8968d..4d283895f 100644
--- a/lib/freebl/ppc-crypto.h
+++ b/lib/freebl/ppc-crypto.h
@@ -5,7 +5,8 @@
#ifndef PPC_CRYPTO_H
#define PPC_CRYPTO_H 1
-#if defined(__powerpc64__) && !defined(NSS_DISABLE_ALTIVEC)
+#if defined(__powerpc64__) && defined(__ALTIVEC__) && \
+ !defined(NSS_DISABLE_ALTIVEC)
#include "altivec-types.h"
/* The ghash freebl test tries to use this in C++, and gcc defines conflict. */
@@ -21,10 +22,10 @@
* please send a patch.
*/
#if (defined(__clang__) || (defined(__GNUC__) && __GNUC__ >= 8)) && \
- defined(IS_LITTLE_ENDIAN)
+ defined(IS_LITTLE_ENDIAN) && defined(__VSX__)
#define USE_PPC_CRYPTO
#endif
-#endif /* defined(__powerpc64__) && !defined(NSS_DISABLE_ALTIVEC) */
+#endif /* defined(__powerpc64__) && !defined(NSS_DISABLE_ALTIVEC) && defined(__ALTIVEC__) */
#endif