File: legacy_built-in_sync_functions.patch

package info (click to toggle)
android-platform-external-libunwind 10.0.0%2Br36-4.1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 4,280 kB
  • sloc: ansic: 34,173; sh: 6,931; asm: 1,913; makefile: 842; cpp: 137
file content (25 lines) | stat: -rw-r--r-- 1,093 bytes parent folder | download | duplicates (4)
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
Description: Replace the legacy __sync built-in functions with __atomic ones
 libunwind uses the built-in __sync_* functions which are deprecated by GCC and
 should be replaced by __atomic_* ones. See the official manuals [1].
 .
 The legacy __sync functions do not require to specify the memory order but
 __atomic ones do, so we choose the strongest one: __ATOMIC_SEQ_CST.
 .
 We do this because __sync_fetch_and_add() is not supported on armel.
 .
 [1]: https://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html
Author: Kai-Chung Yan ()
Last-Update: 2016-10-04
--- a/include/libunwind_i.h
+++ b/include/libunwind_i.h
@@ -155,8 +155,8 @@
   u.vp = addr;
   return __sync_bool_compare_and_swap(u.vlp, (long) old, (long) new);
 }
-# define fetch_and_add1(_ptr)		__sync_fetch_and_add(_ptr, 1)
-# define fetch_and_add(_ptr, value)	__sync_fetch_and_add(_ptr, value)
+# define fetch_and_add1(_ptr) __atomic_fetch_add(_ptr, 1, __ATOMIC_SEQ_CST)
+# define fetch_and_add(_ptr, value) __atomic_fetch_add(_ptr, value, __ATOMIC_SEQ_CST)
 # define HAVE_CMPXCHG
 # define HAVE_FETCH_AND_ADD
 #endif