fix: properly detect 'cmpxchg' on x86-32
authorMichael Jeanson <mjeanson@efficios.com>
Tue, 7 Dec 2021 19:42:26 +0000 (14:42 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 9 Dec 2021 17:18:34 +0000 (12:18 -0500)
commit0a893ea0d5464a1c9e943a3d89d4dcbedc04c2ac
tree22854a48f3095c428b8aa7ee21c568b6c3743e29
parent7b02ec1d45744235d2b8b249e6d08f997fea09dd
fix: properly detect 'cmpxchg' on x86-32

We wrongly assumed that on x86-32 when '__i386__' is defined but none of
'__i486__', '__i586__' or '__i686__' that the target arch is a literal
i386 cpu without the cmpxchg instructions. However, when building with
'-march=core2' we get '__i386__' but none of the others even if the arch
is newer than an i686.

Change the compat code to use the '__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4'
builtin define to detect an x86-32 system without the cmpxchg
instructions.

Since this builtin define was introduced in GCC 4.3 and Clang 3.3,
building with older compilers on any x86-32 system will enable the
compat layer regardless of the availability of the instructions.

Change-Id: I8329431e55d778405b2ca7007d90c2c6e5cdd426
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/urcu/arch.h
include/urcu/uatomic/x86.h
src/compat_arch.c
This page took 0.027952 seconds and 4 git commands to generate.