[Mesa-dev] Fix __atomic* builtins detection for Clang
Jan Beich
jbeich at FreeBSD.org
Sat May 13 00:22:30 UTC 2017
"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.
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
More information about the mesa-dev
mailing list