boost: bump to version 1.63.0
[buildroot-gz.git] / package / erlang / 0002-erts-ethread-instruct-libatomic_ops-we-do-require-CA.patch
blob8e401430fe1e1c9f872dc84a256dbb4d2144afe3
1 From 439fa2eae78a8900bda120072335be19d626498c Mon Sep 17 00:00:00 2001
2 From: "Yann E. MORIN" <yann.morin.1998@free.fr>
3 Date: Sun, 28 Dec 2014 23:39:40 +0100
4 Subject: [PATCH] erts/ethread: instruct libatomic_ops we do require CAS
6 We do require compare-and-swap (CAS), so we must instruct libatomic_ops
7 to provide it, even if the architecture does not have instructions for
8 it.
10 For example, on ARM, LDREX is required for fast CAS. But LDREX is only
11 available on ARMv6, so by default libatomic_ops will not have CAS for
12 anything below, like ARMv5. But ARMv5 is always UP, so using an
13 emulated CAS (that is signal-asyn-safe) is still possible (albeit much
14 slower).
16 Tell libatomic_ops to provide CAS, even if the hardware is not capable
17 of it, by using emulated CAS, as per libatomic_ops dosc:
18 https://github.com/ivmai/libatomic_ops/blob/master/doc/README.txt#L28
20 If this is included after defining AO_REQUIRE_CAS, then the package
21 will make an attempt to emulate compare-and-swap in a way that (at
22 least on Linux) should still be async-signal-safe.
24 Thanks go to Thomas for all this insight! :-)
25 Thanks go to Frank for reporting the issue! :-)
27 Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
28 Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
29 Cc: Frank Hunleth <fhunleth@troodon-software.com>
30 ---
31 erts/include/internal/libatomic_ops/ethread.h | 1 +
32 1 file changed, 1 insertion(+)
34 diff --git a/erts/include/internal/libatomic_ops/ethread.h b/erts/include/internal/libatomic_ops/ethread.h
35 index d65ee19..71d3598 100644
36 --- a/erts/include/internal/libatomic_ops/ethread.h
37 +++ b/erts/include/internal/libatomic_ops/ethread.h
38 @@ -35,6 +35,7 @@
40 #define ETHR_NATIVE_IMPL__ "libatomic_ops"
42 +#define AO_REQUIRE_CAS
43 #include "atomic_ops.h"
44 #include "ethr_membar.h"
45 #include "ethr_atomic.h"
46 diff --git a/erts/aclocal.m4 b/erts/aclocal.m4
47 index d65ee19..71d3598 100644
48 --- a/erts/aclocal.m4
49 +++ b/erts/aclocal.m4
50 @@ -1414,7 +1414,8 @@
51 fi;;
52 esac
53 ethr_have_libatomic_ops=no
54 - AC_TRY_LINK([#include "atomic_ops.h"],
55 + AC_TRY_LINK([#define AO_REQUIRE_CAS
56 + #include "atomic_ops.h"],
58 volatile AO_t x;
59 AO_t y;
60 @@ -1455,6 +1455,7 @@
61 AC_CHECK_SIZEOF(AO_t, ,
63 #include <stdio.h>
64 + #define AO_REQUIRE_CAS
65 #include "atomic_ops.h"
67 AC_DEFINE_UNQUOTED(ETHR_SIZEOF_AO_T, $ac_cv_sizeof_AO_t, [Define to the size of AO_t if libatomic_ops is used])
68 --
69 1.9.1