aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs-78/0009-riscv-Disable-atomic-operations.patch
blob: ba50e10c6ee035e90d9e7559b13f9e8654ca03a3 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From 64ad80e6d95871f17be4cd01da15581f41ac0b2b Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 27 May 2019 21:10:34 -0700
Subject: [PATCH] riscv: Disable atomic operations

This was ported from what was used with mozjs-60 which was
Signed-off-by: Khem Raj <raj.khem@gmail.com>

Upstream-Status: Inappropriate[old-version]

Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
---
 js/src/jit/AtomicOperations.h                          | 3 ++-
 js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h | 8 ++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/js/src/jit/AtomicOperations.h b/js/src/jit/AtomicOperations.h
index 0486cba..cf6b91c 100644
--- a/js/src/jit/AtomicOperations.h
+++ b/js/src/jit/AtomicOperations.h
@@ -391,7 +391,8 @@ inline bool AtomicOperations::isLockfreeJS(int32_t size) {
 #elif defined(__ppc__) || defined(__PPC__) || defined(__sparc__) ||     \
     defined(__ppc64__) || defined(__PPC64__) || defined(__ppc64le__) || \
     defined(__PPC64LE__) || defined(__alpha__) || defined(__hppa__) ||  \
-    defined(__sh__) || defined(__s390__) || defined(__s390x__)
+    defined(__sh__) || defined(__s390__) || defined(__s390x__) || \
+    defined(__riscv)
 #  include "jit/shared/AtomicOperations-feeling-lucky.h"
 #else
 #  error "No AtomicOperations support provided for this platform"
diff --git a/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h b/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h
index f002cd4..14bb5f9 100644
--- a/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h
+++ b/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h
@@ -77,6 +77,14 @@
 #  endif
 #endif
 
+#ifdef __riscv
+#  ifdef __riscv_xlen == 64
+#    define HAS_64BIT_ATOMICS
+#    define HAS_64BIT_LOCKFREE
+#  endif
+#endif
+
+
 // The default implementation tactic for gcc/clang is to use the newer __atomic
 // intrinsics added for use in C++11 <atomic>.  Where that isn't available, we
 // use GCC's older __sync functions instead.
-- 
2.31.1