summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/glibc/glibc/0002-Add-atomic-operations-required-by-the-new-condition-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/glibc/glibc/0002-Add-atomic-operations-required-by-the-new-condition-.patch')
-rw-r--r--meta/recipes-core/glibc/glibc/0002-Add-atomic-operations-required-by-the-new-condition-.patch124
1 files changed, 124 insertions, 0 deletions
diff --git a/meta/recipes-core/glibc/glibc/0002-Add-atomic-operations-required-by-the-new-condition-.patch b/meta/recipes-core/glibc/glibc/0002-Add-atomic-operations-required-by-the-new-condition-.patch
new file mode 100644
index 0000000000..c4747fa27a
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0002-Add-atomic-operations-required-by-the-new-condition-.patch
@@ -0,0 +1,124 @@
1From b85e30e655027132c4326d2fdde010c517165aaf Mon Sep 17 00:00:00 2001
2From: Catalin Enache <catalin.enache@windriver.com>
3Date: Fri, 30 Jun 2017 14:27:34 +0300
4Subject: [PATCH 2/6] Add atomic operations required by the new condition
5 variable.
6
7 * include/atomic.h (atomic_fetch_and_relaxed,
8 atomic_fetch_and_release, atomic_fetch_or_release,
9 atomic_fetch_xor_release): New.
10
11Upstream-Status: Backport
12
13Author: Torvald Riegel <triegel@redhat.com>
14Signed-off-by: Catalin Enache <catalin.enache@windriver.com>
15---
16 ChangeLog | 6 ++++++
17 include/atomic.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++
18 2 files changed, 53 insertions(+)
19
20diff --git a/ChangeLog b/ChangeLog
21index cb87279..96b6da2 100644
22--- a/ChangeLog
23+++ b/ChangeLog
24@@ -1,3 +1,9 @@
25+2016-08-09 Torvald Riegel <triegel@redhat.com>
26+
27+ * include/atomic.h (atomic_fetch_and_relaxed,
28+ atomic_fetch_and_release, atomic_fetch_or_release,
29+ atomic_fetch_xor_release): New.
30+
31 2016-08-05 Torvald Riegel <triegel@redhat.com>
32
33 * include/atomic.h (atomic_exchange_relaxed): New.
34diff --git a/include/atomic.h b/include/atomic.h
35index 129ee24..5a8e7e7 100644
36--- a/include/atomic.h
37+++ b/include/atomic.h
38@@ -611,9 +611,15 @@ void __atomic_link_error (void);
39 ({ __atomic_check_size((mem)); \
40 __atomic_fetch_add ((mem), (operand), __ATOMIC_ACQ_REL); })
41
42+# define atomic_fetch_and_relaxed(mem, operand) \
43+ ({ __atomic_check_size((mem)); \
44+ __atomic_fetch_and ((mem), (operand), __ATOMIC_RELAXED); })
45 # define atomic_fetch_and_acquire(mem, operand) \
46 ({ __atomic_check_size((mem)); \
47 __atomic_fetch_and ((mem), (operand), __ATOMIC_ACQUIRE); })
48+# define atomic_fetch_and_release(mem, operand) \
49+ ({ __atomic_check_size((mem)); \
50+ __atomic_fetch_and ((mem), (operand), __ATOMIC_RELEASE); })
51
52 # define atomic_fetch_or_relaxed(mem, operand) \
53 ({ __atomic_check_size((mem)); \
54@@ -621,6 +627,13 @@ void __atomic_link_error (void);
55 # define atomic_fetch_or_acquire(mem, operand) \
56 ({ __atomic_check_size((mem)); \
57 __atomic_fetch_or ((mem), (operand), __ATOMIC_ACQUIRE); })
58+# define atomic_fetch_or_release(mem, operand) \
59+ ({ __atomic_check_size((mem)); \
60+ __atomic_fetch_or ((mem), (operand), __ATOMIC_RELEASE); })
61+
62+# define atomic_fetch_xor_release(mem, operand) \
63+ ({ __atomic_check_size((mem)); \
64+ __atomic_fetch_xor ((mem), (operand), __ATOMIC_RELEASE); })
65
66 #else /* !USE_ATOMIC_COMPILER_BUILTINS */
67
68@@ -724,12 +737,24 @@ void __atomic_link_error (void);
69 atomic_exchange_and_add_acq ((mem), (operand)); })
70 # endif
71
72+/* XXX Fall back to acquire MO because archs do not define a weaker
73+ atomic_and_val. */
74+# ifndef atomic_fetch_and_relaxed
75+# define atomic_fetch_and_relaxed(mem, operand) \
76+ atomic_fetch_and_acquire ((mem), (operand))
77+# endif
78 /* XXX The default for atomic_and_val has acquire semantics, but this is not
79 documented. */
80 # ifndef atomic_fetch_and_acquire
81 # define atomic_fetch_and_acquire(mem, operand) \
82 atomic_and_val ((mem), (operand))
83 # endif
84+# ifndef atomic_fetch_and_release
85+/* XXX This unnecessarily has acquire MO. */
86+# define atomic_fetch_and_release(mem, operand) \
87+ ({ atomic_thread_fence_release (); \
88+ atomic_and_val ((mem), (operand)); })
89+# endif
90
91 /* XXX The default for atomic_or_val has acquire semantics, but this is not
92 documented. */
93@@ -743,6 +768,28 @@ void __atomic_link_error (void);
94 # define atomic_fetch_or_relaxed(mem, operand) \
95 atomic_fetch_or_acquire ((mem), (operand))
96 # endif
97+/* XXX Contains an unnecessary acquire MO because archs do not define a weaker
98+ atomic_or_val. */
99+# ifndef atomic_fetch_or_release
100+# define atomic_fetch_or_release(mem, operand) \
101+ ({ atomic_thread_fence_release (); \
102+ atomic_fetch_or_acquire ((mem), (operand)); })
103+# endif
104+
105+# ifndef atomic_fetch_xor_release
106+# define atomic_fetch_xor_release(mem, operand) \
107+ ({ __typeof (*(mem)) __atg104_old; \
108+ __typeof (mem) __atg104_memp = (mem); \
109+ __typeof (*(mem)) __atg104_op = (operand); \
110+ \
111+ do \
112+ __atg104_old = (*__atg104_memp); \
113+ while (__builtin_expect \
114+ (atomic_compare_and_exchange_bool_rel ( \
115+ __atg104_memp, __atg104_old ^ __atg104_op, __atg104_old), 0));\
116+ \
117+ __atg104_old; })
118+#endif
119
120 #endif /* !USE_ATOMIC_COMPILER_BUILTINS */
121
122--
1232.10.2
124