diff -Naur old/external/nss/0001-nspr_e2k.patch new/external/nss/0001-nspr_e2k.patch --- old/external/nss/0001-nspr_e2k.patch 1970-01-01 03:00:00.000000000 +0300 +++ new/external/nss/0001-nspr_e2k.patch 2020-09-09 15:39:17.165373137 +0300 @@ -0,0 +1,96 @@ +diff -Naur a/a/nspr/pr/include/md/_linux.cfg b/b/nspr/pr/include/md/_linux.cfg +--- a/a/nspr/pr/include/md/_linux.cfg 2019-12-12 16:30:01.770331155 +0300 ++++ b/b/nspr/pr/include/md/_linux.cfg 2019-12-13 14:14:20.102737752 +0300 +@@ -1112,6 +1112,52 @@ + #define PR_BYTES_PER_WORD_LOG2 3 + #define PR_BYTES_PER_DWORD_LOG2 3 + ++#elif defined(__e2k__) ++ ++#define IS_LITTLE_ENDIAN 1 ++#undef IS_BIG_ENDIAN ++#define IS_64 ++ ++#define PR_BYTES_PER_BYTE 1 ++#define PR_BYTES_PER_SHORT 2 ++#define PR_BYTES_PER_INT 4 ++#define PR_BYTES_PER_INT64 8 ++#define PR_BYTES_PER_LONG 8 ++#define PR_BYTES_PER_FLOAT 4 ++#define PR_BYTES_PER_DOUBLE 8 ++#define PR_BYTES_PER_WORD 8 ++#define PR_BYTES_PER_DWORD 8 ++ ++#define PR_BITS_PER_BYTE 8 ++#define PR_BITS_PER_SHORT 16 ++#define PR_BITS_PER_INT 32 ++#define PR_BITS_PER_INT64 64 ++#define PR_BITS_PER_LONG 64 ++#define PR_BITS_PER_FLOAT 32 ++#define PR_BITS_PER_DOUBLE 64 ++#define PR_BITS_PER_WORD 64 ++ ++#define PR_BITS_PER_BYTE_LOG2 3 ++#define PR_BITS_PER_SHORT_LOG2 4 ++#define PR_BITS_PER_INT_LOG2 5 ++#define PR_BITS_PER_INT64_LOG2 6 ++#define PR_BITS_PER_LONG_LOG2 6 ++#define PR_BITS_PER_FLOAT_LOG2 5 ++#define PR_BITS_PER_DOUBLE_LOG2 6 ++#define PR_BITS_PER_WORD_LOG2 6 ++ ++#define PR_ALIGN_OF_SHORT 2 ++#define PR_ALIGN_OF_INT 4 ++#define PR_ALIGN_OF_LONG 8 ++#define PR_ALIGN_OF_INT64 8 ++#define PR_ALIGN_OF_FLOAT 4 ++#define PR_ALIGN_OF_DOUBLE 8 ++#define PR_ALIGN_OF_POINTER 8 ++#define PR_ALIGN_OF_WORD 8 ++ ++#define PR_BYTES_PER_WORD_LOG2 3 ++#define PR_BYTES_PER_DWORD_LOG2 3 ++ + #else + + #error "Unknown CPU architecture" +diff -Naur a/a/nspr/pr/include/md/_linux.h b/b/nspr/pr/include/md/_linux.h +--- a/a/nspr/pr/include/md/_linux.h 2019-12-12 16:30:01.770331155 +0300 ++++ b/b/nspr/pr/include/md/_linux.h 2019-12-13 14:29:17.939758374 +0300 +@@ -61,6 +61,8 @@ + #define _PR_SI_ARCHITECTURE "riscv32" + #elif defined(__riscv) && (__riscv_xlen == 64) + #define _PR_SI_ARCHITECTURE "riscv64" ++#elif defined(__e2k__) ++#define _PR_SI_ARCHITECTURE "e2k" + #else + #error "Unknown CPU architecture" + #endif +@@ -90,6 +92,15 @@ + #define _PR_HAVE_SOCKADDR_LEN + #endif + ++#if defined(__e2k__) ++#define _PR_HAVE_ATOMIC_OPS ++#define _MD_INIT_ATOMIC() ++#define _MD_ATOMIC_INCREMENT(ptr) __sync_add_and_fetch(ptr, 1) ++#define _MD_ATOMIC_DECREMENT(ptr) __sync_sub_and_fetch(ptr, 1) ++#define _MD_ATOMIC_ADD(ptr, i) __sync_add_and_fetch(ptr, i) ++#define _MD_ATOMIC_SET(ptr, nv) __sync_lock_test_and_set(ptr, nv) ++#endif ++ + #if defined(__i386__) + #define _PR_HAVE_ATOMIC_OPS + #define _MD_INIT_ATOMIC() +diff -Naur a/a/nspr/pr/include/pratom.h b/b/nspr/pr/include/pratom.h +--- a/a/nspr/pr/include/pratom.h 2019-12-12 16:30:01.774331251 +0300 ++++ b/b/nspr/pr/include/pratom.h 2019-12-13 14:34:28.179054128 +0300 +@@ -104,7 +104,7 @@ + ((defined(__i386__) && \ + defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)) || \ + defined(__ia64__) || defined(__x86_64__) || \ +- defined(__powerpc__) || \ ++ defined(__powerpc__) || defined(__e2k__) || \ + (defined(__arm__) && \ + defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)) || \ + defined(__aarch64__) || defined(__alpha) || \ diff -Naur old/external/nss/0002-nss_e2k.patch new/external/nss/0002-nss_e2k.patch --- old/external/nss/0002-nss_e2k.patch 1970-01-01 03:00:00.000000000 +0300 +++ new/external/nss/0002-nss_e2k.patch 2020-09-09 21:37:56.260073118 +0300 @@ -0,0 +1,33 @@ +diff -Naur a/a/nss/coreconf/config.gypi b/b/nss/coreconf/config.gypi +--- a/a/nss/coreconf/config.gypi 2019-12-12 16:30:01.778331346 +0300 ++++ b/b/nss/coreconf/config.gypi 2019-12-13 15:35:33.794558585 +0300 +@@ -100,7 +100,7 @@ + 'disable_chachapoly%': 0, + 'disable_dbm%': 0, + 'disable_libpkix%': 1, +- 'disable_werror%': 0, ++ 'disable_werror%': 1, + 'mozilla_client%': 0, + 'comm_client%': 0, + 'moz_fold_libs%': 0, +@@ -204,7 +204,7 @@ + }, + }, + }], +- [ 'target_arch=="arm64" or target_arch=="aarch64" or target_arch=="sparc64" or target_arch=="ppc64" or target_arch=="ppc64le" or target_arch=="s390x" or target_arch=="mips64"', { ++ [ 'target_arch=="arm64" or target_arch=="aarch64" or target_arch=="sparc64" or target_arch=="ppc64" or target_arch=="ppc64le" or target_arch=="s390x" or target_arch=="mips64" or target_arch=="e2k"', { + 'defines': [ + 'NSS_USE_64', + ], +diff -Naur a/a/nss/coreconf/arch.mk b/b/nss/coreconf/arch.mk +--- a/a/nss/coreconf/arch.mk 2019-07-05 19:02:31.000000000 +0300 ++++ b/b/nss/coreconf/arch.mk 2020-09-09 21:33:58.974784195 +0300 +@@ -26,7 +26,7 @@ + # Attempt to differentiate between sparc and x86 Solaris + # + +-OS_TEST := $(shell uname -m) ++OS_TEST ?= $(shell uname -m) + ifeq ($(OS_TEST),i86pc) + OS_RELEASE := $(shell uname -r)_$(OS_TEST) + else diff -Naur old/external/nss/UnpackedTarball_nss.mk new/external/nss/UnpackedTarball_nss.mk --- old/external/nss/UnpackedTarball_nss.mk 2020-09-01 17:49:46.004120041 +0300 +++ new/external/nss/UnpackedTarball_nss.mk 2020-09-09 18:54:05.355265696 +0300 @@ -34,6 +34,9 @@ $(if $(filter ANDROID,$(OS)), \ external/nss/nss-android.patch.1) \ external/nss/nss.bzmozilla1238154.patch \ + external/nss/0001-nspr_e2k.patch \ + external/nss/0002-nss_e2k.patch \ + external/nss/0003-subguess_e2k.patch \ )) ifeq ($(COM_IS_CLANG),TRUE) diff -Naur old/external/nss/0003-subguess_e2k.patch new/external/nss/0003-subguess_e2k.patch --- old/external/nss/0003-subguess_e2k.patch 1970-01-01 03:00:00.000000000 +0300 +++ new/external/nss/0003-subguess_e2k.patch 2020-09-09 18:52:59.173775080 +0300 @@ -0,0 +1,54 @@ +diff -Naur a/a/nspr/build/autoconf/config.guess b/b/nspr/build/autoconf/config.guess +--- a/a/nspr/build/autoconf/config.guess 2020-09-09 15:36:09.155007156 +0000 ++++ b/b/nspr/build/autoconf/config.guess 2020-09-09 15:45:36.907811590 +0000 +@@ -215,6 +215,18 @@ + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; ++ e2k:Linux:*|elbrus:Linux:*) ++ echo e2k-mcst-linux-gnu ++ exit ;; ++ e2k:QNX:*) ++ echo e2k-mcst-qnx ++ exit ;; ++ sparc:Linux:*elbrus*:*) ++ echo sparc-mcst-linux-gnu ++ exit ;; ++ sparc64:Linux:*elbrus*:*) ++ echo sparc-mcst-linux-gnu ++ exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} +diff -Naur a/a/nspr/build/autoconf/config.sub b/b/nspr/build/autoconf/config.sub +--- a/a/nspr/build/autoconf/config.sub 2020-09-09 15:36:09.155007156 +0000 ++++ b/b/nspr/build/autoconf/config.sub 2020-09-09 15:40:31.508929025 +0000 +@@ -628,6 +628,18 @@ + basic_machine=a29k-amd + os=-ebmon + ;; ++ e2k|elbrus) ++ basic_machine=e2k-mcst ++ ;; ++ e2k-mcst|elbrus-mcst) ++ basic_machine=e2k-mcst ++ ;; ++ sparc-mcst) ++ basic_machine=sparc-mcst ++ ;; ++ sparc64-mcst) ++ basic_machine=sparc64-mcst ++ ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd +@@ -1529,6 +1541,9 @@ + # system, and we'll never get to this point. + + case $basic_machine in ++ e2k-*|elbrus-*) ++ os=-linux-gnu ++ ;; + score-*) + os=-elf + ;; --- old/external/nss/ExternalProject_nss.mk 2020-09-01 17:49:46.004120041 +0300 +++ new/external/nss/ExternalProject_nss.mk 2020-09-09 21:08:17.732239496 +0300 @@ -44,6 +44,7 @@ $(if $(CROSS_COMPILING),\ $(if $(filter MACOSXPOWERPC,$(OS)$(CPUNAME)),CPU_ARCH=ppc) \ $(if $(filter iOS-ARM,$(OS)-$(CPUNAME)),CPU_ARCH=arm) \ + $(if $(filter E2K,$(CPUNAME)),OS_TEST=e2k USE_64=1 CROSS_COMPILE=1) \ NSPR_CONFIGURE_OPTS="--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)") \ NSDISTMODE=copy \ $(MAKE) -j1 AR="$(AR)" \