[glib] build: Fix test for G_ATOMIC_LOCK_FREE in meson.build



commit 1a6fc60fe98c0652c10c4ddeac3e10619c67b862
Author: Philip Withnall <withnall endlessm com>
Date:   Wed May 16 12:16:17 2018 +0100

    build: Fix test for G_ATOMIC_LOCK_FREE in meson.build
    
    Commit 3e96523e6b did not entirely fix the test, as the compiled test
    code did not have a main() function, so failed to link with:
    
     /usr/lib/gcc/x86_64-redhat-linux/7/../../../../lib64/crt1.o: In function `_start':
    (.text+0x20): undefined reference to `main'
    collect2: error: ld returned 1 exit status
    
    This caused an invalid mixtures of builtin and non-builtin atomics/locks
    to be used, which caused deadlocks in a number of tests.
    
    Fix the atomic ops test in meson.build, and the unit tests all start
    working again.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=796164

 meson.build | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/meson.build b/meson.build
index 4ccb312cb..a08a3e1a5 100644
--- a/meson.build
+++ b/meson.build
@@ -1460,9 +1460,10 @@ glibconfig_conf.set('G_ATOMIC_OP_MEMORY_BARRIER_NEEDED', glib_memory_barrier_nee
 # to abort and advise the user to fix their CFLAGS.  It's better to do
 # that then to silently fall back on emulated atomic ops just because
 # the user had the wrong build environment.
-atomictest = '''void func() {
+atomictest = '''int main() {
   volatile int atomic = 2;
   __sync_bool_compare_and_swap (&atomic, 2, 3);
+  return 0;
 }
 '''
 if cc.links(atomictest, name : 'atomic ops')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]