diff options
author | Nicolas Boichat <[email protected]> | 2018-04-05 09:33:09 +0800 |
---|---|---|
committer | Matt Turner <[email protected]> | 2018-05-07 10:14:53 -0700 |
commit | 54ba73ef102f7b9085922686bb31719539e0dc3c (patch) | |
tree | 51044bfaf20d574880c3ff833f9c89dc8f3aa7d9 /meson.build | |
parent | 8b519075eac86a4b2187020f1f54c5e5b979b40d (diff) |
configure.ac/meson.build: Fix -latomic test
When compiling with LLVM 6.0 on x86 (32-bit) for Android, the test
fails to detect that -latomic is actually required, as the atomic
call is inlined.
In the code itself (src/util/disk_cache.c), we see this pattern:
p_atomic_add(cache->size, - (uint64_t)size);
where cache->size is an uint64_t *, and results in the following
link time error without -latomic:
src/util/disk_cache.c:628: error: undefined reference to '__atomic_fetch_add_8'
Fix the configure/meson test to replicate this pattern, which then
correctly realizes the need for -latomic.
Reviewed-by: Matt Turner <[email protected]>
Signed-off-by: Nicolas Boichat <[email protected]>
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/meson.build b/meson.build index 6e617668096..e52b4a51093 100644 --- a/meson.build +++ b/meson.build @@ -849,8 +849,10 @@ if cc.compiles('int main() { int n; return __atomic_load_n(&n, __ATOMIC_ACQUIRE) # as ARM. if not cc.links('''#include <stdint.h> int main() { - uint64_t n; - return (int)__atomic_load_n(&n, __ATOMIC_ACQUIRE); + struct { + uint64_t *v; + } x; + return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE); }''', name : 'GCC atomic builtins required -latomic') dep_atomic = cc.find_library('atomic') |