mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-09 12:25:48 +01:00
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
This commit is contained in:
parent
d388a00028
commit
1a6fc60fe9
@ -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
|
# 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
|
# that then to silently fall back on emulated atomic ops just because
|
||||||
# the user had the wrong build environment.
|
# the user had the wrong build environment.
|
||||||
atomictest = '''void func() {
|
atomictest = '''int main() {
|
||||||
volatile int atomic = 2;
|
volatile int atomic = 2;
|
||||||
__sync_bool_compare_and_swap (&atomic, 2, 3);
|
__sync_bool_compare_and_swap (&atomic, 2, 3);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
if cc.links(atomictest, name : 'atomic ops')
|
if cc.links(atomictest, name : 'atomic ops')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user