summaryrefslogtreecommitdiff
path: root/coreconf
diff options
context:
space:
mode:
authorDanh <congdanhqx@gmail.com>2020-09-11 07:40:57 -0700
committerDanh <congdanhqx@gmail.com>2020-09-11 07:40:57 -0700
commit57492c44597f3b6df8ca8126383fe6361109bb74 (patch)
tree2170e0bce70e828dda45187b4bfb1ca758ddb97a /coreconf
parentac7687cb4d4321247ff9032d25df145581b5be06 (diff)
downloadnss-hg-57492c44597f3b6df8ca8126383fe6361109bb74.tar.gz
Bug 1659727 - Move makefile avx2 detection to config.mk. r=kjacobs
Summary: Current code base use CPU_ARCH to detect if avx2 is supported in arch.mk However, when arch.mk included, CPU_ARCH haven't been initialised, CPU_ARCH will be initialised by the OS specific code later on. Move the AVX2 detection to config.mk, after all other initialisation done. Reviewers: kjacobs Reviewed By: kjacobs Subscribers: kjacobs Bug #: 1659727 Differential Revision: https://phabricator.services.mozilla.com/D88517
Diffstat (limited to 'coreconf')
-rw-r--r--coreconf/arch.mk29
-rw-r--r--coreconf/config.mk29
2 files changed, 27 insertions, 31 deletions
diff --git a/coreconf/arch.mk b/coreconf/arch.mk
index cc13ced65..9f0cf4dc3 100644
--- a/coreconf/arch.mk
+++ b/coreconf/arch.mk
@@ -141,35 +141,6 @@ ifeq ($(OS_ARCH),OS_2)
endif
#######################################################################
-# Master "Core Components" macros for Hardware features #
-#######################################################################
-
-ifndef NSS_DISABLE_AVX2
- ifneq ($(CPU_ARCH),x86_64)
- # Disable AVX2 entirely on non-Intel platforms
- NSS_DISABLE_AVX2 = 1
- $(warning CPU_ARCH is not x86_64, disabling -mavx2)
- else
- ifdef CC_IS_CLANG
- # Clang reports its version as an older gcc, but it's OK
- NSS_DISABLE_AVX2 = 0
- else
- ifneq (,$(filter 4.8 4.9,$(word 1,$(GCC_VERSION)).$(word 2,$(GCC_VERSION))))
- NSS_DISABLE_AVX2 = 0
- endif
- ifeq (,$(filter 0 1 2 3 4,$(word 1,$(GCC_VERSION))))
- NSS_DISABLE_AVX2 = 0
- endif
- endif
- ifndef NSS_DISABLE_AVX2
- $(warning Unable to find gcc 4.8 or greater, disabling -Werror)
- NSS_DISABLE_AVX2 = 1
- endif
- endif
- export NSS_DISABLE_AVX2
-endif #ndef NSS_DISABLE_AVX2
-
-#######################################################################
# Master "Core Components" macros for getting the OS target #
#######################################################################
diff --git a/coreconf/config.mk b/coreconf/config.mk
index 5b8087f2e..6823099e7 100644
--- a/coreconf/config.mk
+++ b/coreconf/config.mk
@@ -129,6 +129,33 @@ include $(CORE_DEPTH)/coreconf/ruleset.mk
endif
#######################################################################
+# Master "Core Components" macros for Hardware features #
+#######################################################################
+ifndef NSS_DISABLE_AVX2
+ ifneq ($(CPU_ARCH),x86_64)
+ # Disable AVX2 entirely on non-Intel platforms
+ NSS_DISABLE_AVX2 = 1
+ $(warning CPU_ARCH is not x86_64, disabling -mavx2)
+ else
+ # Clang reports its version as an older gcc, but it's OK
+ ifndef CC_IS_CLANG
+ ifneq (,$(filter 0 1 2 3,$(word 1,$(GCC_VERSION))))
+ NSS_DISABLE_AVX2 = 1
+ endif
+ ifeq (4,$(word 1,$(GCC_VERSION)))
+ ifeq (,$(filter 8 9,$(word 2,$(GCC_VERSION))))
+ NSS_DISABLE_AVX2 = 1
+ endif
+ endif
+ endif
+ ifeq (1,$(NSS_DISABLE_AVX2))
+ $(warning Unable to find gcc 4.8 or greater, disabling avx2)
+ export NSS_DISABLE_AVX2
+ endif
+ endif
+endif #ndef NSS_DISABLE_AVX2
+
+#######################################################################
# [16.0] Global environ ment defines
#######################################################################
@@ -149,10 +176,8 @@ DEFINES += -DNSS_DISABLE_DBM
endif
ifdef NSS_DISABLE_AVX2
-ifneq ($(NSS_DISABLE_AVX2),0)
DEFINES += -DNSS_DISABLE_AVX2
endif
-endif
ifdef NSS_DISABLE_CHACHAPOLY
DEFINES += -DNSS_DISABLE_CHACHAPOLY