aboutsummaryrefslogtreecommitdiffstats
path: root/main/nss/fix-arm-neon.patch
blob: 291e0e21e51a4369ac8a32a9f2a057a5e93cde8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
diff --git a/nss/lib/freebl/Makefile b/nss/lib/freebl/Makefile
index 00518d7..114e5f0 100644
--- a/nss/lib/freebl/Makefile
+++ b/nss/lib/freebl/Makefile
@@ -123,7 +123,14 @@ ifeq ($(CPU_ARCH),aarch64)
     DEFINES += -DUSE_HW_AES
     EXTRA_SRCS += aes-armv8.c gcm-aarch64.c
 endif
+
+# only enable neon and aes on arm v7 and v8
 ifeq ($(CPU_ARCH),arm)
+    ifneq (,$(filter 7 8,$(shell $(CC) -dM -E - </dev/null | awk '$2 == "__ARM_ARCH" {print $3}')))
+        HAVE_ARM_NEON = 1
+    endif
+endif
+ifdef HAVE_ARM_NEON
     EXTRA_SRCS += gcm-arm32-neon.c
     ifdef CC_IS_CLANG
         DEFINES += -DUSE_HW_AES
@@ -780,9 +787,10 @@ ifdef INTEL_GCM_CLANG_CL
 $(OBJDIR)/$(PROG_PREFIX)intel-gcm-wrap$(OBJ_SUFFIX): CFLAGS += -mssse3
 endif
 
-ifeq ($(CPU_ARCH),arm)
+ifdef HAVE_ARM_NEON
 $(OBJDIR)/$(PROG_PREFIX)aes-armv8$(OBJ_SUFFIX): CFLAGS += -march=armv8-a -mfpu=crypto-neon-fp-armv8
 $(OBJDIR)/$(PROG_PREFIX)gcm-arm32-neon$(OBJ_SUFFIX): CFLAGS += -mfpu=neon
+$(OBJDIR)/$(PROG_PREFIX)gcm$(OBJ_SUFFIX): CFLAGS += -mfpu=neon
 endif
 ifeq ($(CPU_ARCH),aarch64)
 $(OBJDIR)/$(PROG_PREFIX)aes-armv8$(OBJ_SUFFIX): CFLAGS += -march=armv8-a+crypto