[lttng-dev] [liburcu PATCH 3/3] Add configure check for GCC atomic builtins
Mathieu Desnoyers
compudj at krystal.dyndns.org
Fri Jan 6 10:38:31 EST 2012
* Alexandre Montplaisir (alexandre.montplaisir at gmail.com) wrote:
> I tested it on x86_64, this should be tested on other arches before
> merging, namely to make sure it catches GCC version below 4.4 on ARM.
We don't use these builtins on x86, we use our own implementation
instead. This check does not take into account that some gcc versions
support the builtin, and compile something out of it, but the semantic
of the barrier is wrong, which will lead to runtime races. This check
would be acceptable if:
1) it would only apply to architectures actually using the builtins.
2) it would additionally have gcc version checks for those which had a
broken implementation in the first gcc versions.
Thanks,
Mathieu
>
> Signed-off-by: Alexandre Montplaisir <alexandre.montplaisir at gmail.com>
> ---
> configure.ac | 16 ++++++++++++++++
> 1 files changed, 16 insertions(+), 0 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 0311246..d49666d 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -75,6 +75,22 @@ AS_IF([test "$host_cpu" = "armv7l"],[
> CFLAGS="$CFLAGS -mcpu=cortex-a9 -mtune=cortex-a9 -O1"
> ])
>
> +# Check for GCC's __sync_* atomic operations.
> +# Those are only available with GCC 4.1+ on most architectures but
> +# require GCC 4.4+ on ARM.
> +AC_MSG_CHECKING([for GCC atomic builtins])
> +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[
> + int i, x = 0;
> + i = __sync_add_and_fetch(&x, 1);
> + ]])
> +],[
> + AC_MSG_RESULT([yes])
> +],[
> + AC_MSG_RESULT([no])
> + AC_MSG_ERROR([cannot find the __sync_* atomic functions.
> +Please upgrade your version of GCC. GCC 4.4 or above is required on ARM.])
> +])
> +
> # ARM-specific checks
> AS_IF([test "x$ARCHTYPE" = "xarm"],[
> AC_MSG_CHECKING([for dmb instruction])
> --
> 1.7.7.3
>
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
More information about the lttng-dev
mailing list