qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 2/2] meson: fix CONFIG_ATOMIC128 check


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 2/2] meson: fix CONFIG_ATOMIC128 check
Date: Mon, 28 Feb 2022 13:43:47 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.1

On 28/2/22 13:07, marcandre.lureau@redhat.com wrote:
From: Marc-André Lureau <marcandre.lureau@redhat.com>

testfile.c: In function 'main':
testfile.c:5:11: error: incorrect number of arguments to function 
'__atomic_load'
     5 |       y = __atomic_load(&x, 0);
       |           ^~~~~~~~~~~~~
testfile.c:6:7: error: argument 2 of '__atomic_store' must be a pointer type
     6 |       __atomic_store(&x, y, 0);
       |       ^~~~~~~~~~~~~~
testfile.c:7:7: error: argument 3 of '__atomic_compare_exchange' must be a 
pointer type
     7 |       __atomic_compare_exchange(&x, &y, x, 0, 0, 0);
       |       ^~~~~~~~~~~~~~~~~~~~~~~~~

And it must be linked with -latomic.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
  meson.build | 12 ++++++++----
  1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/meson.build b/meson.build
index a9ec3974bc67..a3d8af7a501b 100644
--- a/meson.build
+++ b/meson.build
@@ -1841,13 +1841,17 @@ if has_int128
      int main(void)
      {
        unsigned __int128 x = 0, y = 0;
-      y = __atomic_load(&x, 0);
-      __atomic_store(&x, y, 0);
-      __atomic_compare_exchange(&x, &y, x, 0, 0, 0);
+      __atomic_load(&x, &y, 0);
+      __atomic_store(&x, &y, 0);
+      __atomic_compare_exchange(&x, &y, &x, 0, 0, 0);
        return 0;
-    }''')
+    }''', args: ['-latomic'])
config_host_data.set('CONFIG_ATOMIC128', has_atomic128)
+  if has_atomic128
+    add_global_link_arguments('-latomic',
+                              native: false, language: ['c', 'cpp', 'objc'])
+  endif
if not has_atomic128
      has_cmpxchg128 = cc.links('''

Shouldn't this be 1/2 for bisectability?

Anyhow "We deliberately don't link against libatomic", see:
CAFEAcA8V-PAwbtPWghvyjgKtzi949F6g9TnBJpLsGGHt51J64w@mail.gmail.com/">https://lore.kernel.org/qemu-devel/CAFEAcA8V-PAwbtPWghvyjgKtzi949F6g9TnBJpLsGGHt51J64w@mail.gmail.com/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]