[Mesa-dev] Fix __atomic* builtins detection for Clang
Jonathan Gray
jsg at jsg.id.au
Sat May 13 04:19:23 UTC 2017
On Sat, May 13, 2017 at 02:22:30AM +0200, Jan Beich wrote:
> "int" isn't large enough and lack of builtins only manifests at link time.
> This was breaking build on FreeBSD 11.0 i386 with Clang 3.8.0.
You should be building with -march=i586 on i386 for CX8.
The diff is wrong as it will break other architectures, ie powerpc.
commit a6a38a038bd62e6d9558905f00bef81b5e7e6fcc
Author: Grazvydas Ignotas <notasas at gmail.com>
Date: Fri Mar 31 01:26:25 2017 +0300
util/u_atomic: provide 64bit atomics where they're missing
attempts to handle powerpc like situations, though not sync
builtins being missing entirely.
>
> glsl/.libs/libstandalone.a(libmesautil_la-disk_cache.o): In function `disk_cache_remove':
> disk_cache.c:(.text+0x763): undefined reference to `__atomic_fetch_add_8'
> glsl/.libs/libstandalone.a(libmesautil_la-disk_cache.o): In function `cache_put':
> disk_cache.c:(.text+0xabc): undefined reference to `__atomic_fetch_add_8'
> disk_cache.c:(.text+0xec1): undefined reference to `__atomic_fetch_add_8'
> c++: error: linker command failed with exit code 1 (use -v to see invocation)
> ---
> configure.ac | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 957d15df8c..5b11941a0c 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -403,9 +403,10 @@ AM_CONDITIONAL([SSE41_SUPPORTED], [test x$SSE41_SUPPORTED = x1])
> AC_SUBST([SSE41_CFLAGS], $SSE41_CFLAGS)
>
> dnl Check for new-style atomic builtins
> -AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
> +AC_LINK_IFELSE([AC_LANG_SOURCE([[
> +#include <stdint.h>
> int main() {
> - int n;
> + uint64_t n;
> return __atomic_load_n(&n, __ATOMIC_ACQUIRE);
> }]])], GCC_ATOMIC_BUILTINS_SUPPORTED=1)
> if test "x$GCC_ATOMIC_BUILTINS_SUPPORTED" = x1; then
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list