summaryrefslogtreecommitdiffstats
path: root/dynamic-layers/selinux/android-tools/android-tools/libunwind-debian/legacy_built-in_sync_functions.patch
diff options
context:
space:
mode:
Diffstat (limited to 'dynamic-layers/selinux/android-tools/android-tools/libunwind-debian/legacy_built-in_sync_functions.patch')
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/libunwind-debian/legacy_built-in_sync_functions.patch25
1 files changed, 25 insertions, 0 deletions
diff --git a/dynamic-layers/selinux/android-tools/android-tools/libunwind-debian/legacy_built-in_sync_functions.patch b/dynamic-layers/selinux/android-tools/android-tools/libunwind-debian/legacy_built-in_sync_functions.patch
new file mode 100644
index 0000000..8d78faa
--- /dev/null
+++ b/dynamic-layers/selinux/android-tools/android-tools/libunwind-debian/legacy_built-in_sync_functions.patch
@@ -0,0 +1,25 @@
1Description: Replace the legacy __sync built-in functions with __atomic ones
2 libunwind uses the built-in __sync_* functions which are deprecated by GCC and
3 should be replaced by __atomic_* ones. See the official manuals [1].
4 .
5 The legacy __sync functions do not require to specify the memory order but
6 __atomic ones do, so we choose the strongest one: __ATOMIC_SEQ_CST.
7 .
8 We do this because __sync_fetch_and_add() is not supported on armel.
9 .
10 [1]: https://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html
11Author: Kai-Chung Yan ()
12Last-Update: 2016-10-04
13--- a/include/libunwind_i.h
14+++ b/include/libunwind_i.h
15@@ -155,8 +155,8 @@
16 u.vp = addr;
17 return __sync_bool_compare_and_swap(u.vlp, (long) old, (long) new);
18 }
19-# define fetch_and_add1(_ptr) __sync_fetch_and_add(_ptr, 1)
20-# define fetch_and_add(_ptr, value) __sync_fetch_and_add(_ptr, value)
21+# define fetch_and_add1(_ptr) __atomic_fetch_add(_ptr, 1, __ATOMIC_SEQ_CST)
22+# define fetch_and_add(_ptr, value) __atomic_fetch_add(_ptr, value, __ATOMIC_SEQ_CST)
23 # define HAVE_CMPXCHG
24 # define HAVE_FETCH_AND_ADD
25 #endif