qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH-for-10.2 0/2] tcg: Fix TCI build on macOS
@ 2025-12-02 18:46 Philippe Mathieu-Daudé
  2025-12-02 18:46 ` [PATCH-for-10.2? 1/2] tcg/tci: Disable -Wundef FFI_GO_CLOSURES warning Philippe Mathieu-Daudé
  2025-12-02 18:46 ` [PATCH-for-10.2 2/2] tcg/tci: Disable Int128 support Philippe Mathieu-Daudé
  0 siblings, 2 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-12-02 18:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: Daniel P. Berrangé, Paolo Bonzini, Stefan Weil,
	Marc-André Lureau, Richard Henderson,
	Philippe Mathieu-Daudé

We don't test TCG+TCI on macOS host and it is broken.
Luckyly the fix is easy.

Philippe Mathieu-Daudé (2):
  tcg/tci: Disable -Wundef FFI_GO_CLOSURES warning
  tcg/tci: Disable Int128 support

 meson.build               | 2 +-
 include/tcg/helper-info.h | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

-- 
2.51.0



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH-for-10.2? 1/2] tcg/tci: Disable -Wundef FFI_GO_CLOSURES warning
  2025-12-02 18:46 [PATCH-for-10.2 0/2] tcg: Fix TCI build on macOS Philippe Mathieu-Daudé
@ 2025-12-02 18:46 ` Philippe Mathieu-Daudé
  2025-12-03  0:34   ` Richard Henderson
  2025-12-02 18:46 ` [PATCH-for-10.2 2/2] tcg/tci: Disable Int128 support Philippe Mathieu-Daudé
  1 sibling, 1 reply; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-12-02 18:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: Daniel P. Berrangé, Paolo Bonzini, Stefan Weil,
	Marc-André Lureau, Richard Henderson,
	Philippe Mathieu-Daudé

Since we build TCI with FFI (commit 22f15579fa1 "tcg: Build ffi data
structures for helpers") we get on Darwin:

  In file included from ../../tcg/tci.c:22:
  In file included from include/tcg/helper-info.h:13:
  /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/ffi/ffi.h:483:5: warning: 'FFI_GO_CLOSURES' is not defined, evaluates to 0 [-Wundef]
    483 | #if FFI_GO_CLOSURES
        |     ^
  1 warning generated.

Since this libffi change was committed more than 10 years ago (see
https://github.com/libffi/libffi/commit/e951d64c0852), just define
the missing definition on QEMU to silence the warning.

Reported-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/tcg/helper-info.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/tcg/helper-info.h b/include/tcg/helper-info.h
index 909fe73afa3..36bb7f8187f 100644
--- a/include/tcg/helper-info.h
+++ b/include/tcg/helper-info.h
@@ -10,6 +10,9 @@
 #define TCG_HELPER_INFO_H
 
 #ifdef CONFIG_TCG_INTERPRETER
+#ifndef FFI_GO_CLOSURES
+#define FFI_GO_CLOSURES 0
+#endif
 #include <ffi.h>
 #endif
 #include "tcg-target-reg-bits.h"
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH-for-10.2 2/2] tcg/tci: Disable Int128 support
  2025-12-02 18:46 [PATCH-for-10.2 0/2] tcg: Fix TCI build on macOS Philippe Mathieu-Daudé
  2025-12-02 18:46 ` [PATCH-for-10.2? 1/2] tcg/tci: Disable -Wundef FFI_GO_CLOSURES warning Philippe Mathieu-Daudé
@ 2025-12-02 18:46 ` Philippe Mathieu-Daudé
  2025-12-02 22:30   ` Richard Henderson
  1 sibling, 1 reply; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-12-02 18:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: Daniel P. Berrangé, Paolo Bonzini, Stefan Weil,
	Marc-André Lureau, Richard Henderson,
	Philippe Mathieu-Daudé

Disable Int128 on TCI, otherwise build fails:

  In file included from ../../tcg/optimize.c:29:
  In file included from include/tcg/tcg-op-common.h:12:
  In file included from include/exec/helper-proto-common.h:10:
  In file included from include/qemu/atomic128.h:62:
  In file included from host/include/aarch64/host/atomic128-cas.h.inc:16:
  host/include/generic/host/atomic128-cas.h.inc:37:12: error: initializing 'Int128' (aka 'struct Int128') with an expression of incompatible type '__int128_t' (aka '__int128')
     37 |     Int128 old = *ptr_align;
        |            ^     ~~~~~~~~~~
  host/include/generic/host/atomic128-cas.h.inc:39:52: warning: incompatible pointer types passing 'Int128 *' (aka 'struct Int128 *') to parameter of type '__int128_t *' (aka '__int128 *') [-Wincompatible-pointer-types]
     39 |     while (!__atomic_compare_exchange_n(ptr_align, &old, new, true,
        |                                                    ^~~~
  host/include/generic/host/atomic128-cas.h.inc:39:58: error: passing 'Int128' (aka 'struct Int128') to parameter of incompatible type '__int128_t' (aka '__int128')
     39 |     while (!__atomic_compare_exchange_n(ptr_align, &old, new, true,
        |                                                          ^~~
  host/include/generic/host/atomic128-cas.h.inc:50:12: error: initializing 'Int128' (aka 'struct Int128') with an expression of incompatible type '__int128_t' (aka '__int128')
     50 |     Int128 old = *ptr_align;
        |            ^     ~~~~~~~~~~
  host/include/generic/host/atomic128-cas.h.inc:52:62: error: invalid operands to binary expression ('Int128' (aka 'struct Int128') and 'Int128')
     52 |     while (!__atomic_compare_exchange_n(ptr_align, &old, old & val, true,
        |                                                          ~~~ ^ ~~~
  host/include/generic/host/atomic128-cas.h.inc:63:12: error: initializing 'Int128' (aka 'struct Int128') with an expression of incompatible type '__int128_t' (aka '__int128')
     63 |     Int128 old = *ptr_align;
        |            ^     ~~~~~~~~~~
  host/include/generic/host/atomic128-cas.h.inc:65:62: error: invalid operands to binary expression ('Int128' (aka 'struct Int128') and 'Int128')
     65 |     while (!__atomic_compare_exchange_n(ptr_align, &old, old | val, true,
        |                                                          ~~~ ^ ~~~
  1 warning and 6 errors generated.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index d9293294d8e..692a62e6c18 100644
--- a/meson.build
+++ b/meson.build
@@ -2996,7 +2996,7 @@ config_host_data.set('CONFIG_ATOMIC64', cc.links('''
 
 # has_int128_type is set to false on Emscripten to avoid errors by libffi
 # during runtime.
-has_int128_type = host_os != 'emscripten' and cc.compiles('''
+has_int128_type = host_os != 'emscripten' and tcg_arch != 'tci' and cc.compiles('''
   __int128_t a;
   __uint128_t b;
   int main(void) { b = a; }''')
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH-for-10.2 2/2] tcg/tci: Disable Int128 support
  2025-12-02 18:46 ` [PATCH-for-10.2 2/2] tcg/tci: Disable Int128 support Philippe Mathieu-Daudé
@ 2025-12-02 22:30   ` Richard Henderson
  2025-12-03 13:18     ` Richard Henderson
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Henderson @ 2025-12-02 22:30 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Daniel P. Berrangé, Paolo Bonzini, Stefan Weil,
	Marc-André Lureau

On 12/2/25 10:46, Philippe Mathieu-Daudé wrote:
> Disable Int128 on TCI, otherwise build fails:
> 
>    In file included from ../../tcg/optimize.c:29:
>    In file included from include/tcg/tcg-op-common.h:12:
>    In file included from include/exec/helper-proto-common.h:10:
>    In file included from include/qemu/atomic128.h:62:
>    In file included from host/include/aarch64/host/atomic128-cas.h.inc:16:
>    host/include/generic/host/atomic128-cas.h.inc:37:12: error: initializing 'Int128' (aka 'struct Int128') with an expression of incompatible type '__int128_t' (aka '__int128')
>       37 |     Int128 old = *ptr_align;
>          |            ^     ~~~~~~~~~~
>    host/include/generic/host/atomic128-cas.h.inc:39:52: warning: incompatible pointer types passing 'Int128 *' (aka 'struct Int128 *') to parameter of type '__int128_t *' (aka '__int128 *') [-Wincompatible-pointer-types]
>       39 |     while (!__atomic_compare_exchange_n(ptr_align, &old, new, true,
>          |                                                    ^~~~
>    host/include/generic/host/atomic128-cas.h.inc:39:58: error: passing 'Int128' (aka 'struct Int128') to parameter of incompatible type '__int128_t' (aka '__int128')
>       39 |     while (!__atomic_compare_exchange_n(ptr_align, &old, new, true,
>          |                                                          ^~~
>    host/include/generic/host/atomic128-cas.h.inc:50:12: error: initializing 'Int128' (aka 'struct Int128') with an expression of incompatible type '__int128_t' (aka '__int128')
>       50 |     Int128 old = *ptr_align;
>          |            ^     ~~~~~~~~~~
>    host/include/generic/host/atomic128-cas.h.inc:52:62: error: invalid operands to binary expression ('Int128' (aka 'struct Int128') and 'Int128')
>       52 |     while (!__atomic_compare_exchange_n(ptr_align, &old, old & val, true,
>          |                                                          ~~~ ^ ~~~
>    host/include/generic/host/atomic128-cas.h.inc:63:12: error: initializing 'Int128' (aka 'struct Int128') with an expression of incompatible type '__int128_t' (aka '__int128')
>       63 |     Int128 old = *ptr_align;
>          |            ^     ~~~~~~~~~~
>    host/include/generic/host/atomic128-cas.h.inc:65:62: error: invalid operands to binary expression ('Int128' (aka 'struct Int128') and 'Int128')
>       65 |     while (!__atomic_compare_exchange_n(ptr_align, &old, old | val, true,
>          |                                                          ~~~ ^ ~~~
>    1 warning and 6 errors generated.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

And what of the CONFIG_TCG_INTERPRETER test that already exists in int128.h?

There's got to be more to this than that.


r~

> ---
>   meson.build | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meson.build b/meson.build
> index d9293294d8e..692a62e6c18 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -2996,7 +2996,7 @@ config_host_data.set('CONFIG_ATOMIC64', cc.links('''
>   
>   # has_int128_type is set to false on Emscripten to avoid errors by libffi
>   # during runtime.
> -has_int128_type = host_os != 'emscripten' and cc.compiles('''
> +has_int128_type = host_os != 'emscripten' and tcg_arch != 'tci' and cc.compiles('''
>     __int128_t a;
>     __uint128_t b;
>     int main(void) { b = a; }''')



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH-for-10.2? 1/2] tcg/tci: Disable -Wundef FFI_GO_CLOSURES warning
  2025-12-02 18:46 ` [PATCH-for-10.2? 1/2] tcg/tci: Disable -Wundef FFI_GO_CLOSURES warning Philippe Mathieu-Daudé
@ 2025-12-03  0:34   ` Richard Henderson
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2025-12-03  0:34 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Daniel P. Berrangé, Paolo Bonzini, Stefan Weil,
	Marc-André Lureau

On 12/2/25 10:46, Philippe Mathieu-Daudé wrote:
> Since we build TCI with FFI (commit 22f15579fa1 "tcg: Build ffi data
> structures for helpers") we get on Darwin:
> 
>    In file included from ../../tcg/tci.c:22:
>    In file included from include/tcg/helper-info.h:13:
>    /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/ffi/ffi.h:483:5: warning: 'FFI_GO_CLOSURES' is not defined, evaluates to 0 [-Wundef]
>      483 | #if FFI_GO_CLOSURES
>          |     ^
>    1 warning generated.
> 
> Since this libffi change was committed more than 10 years ago (see
> https://github.com/libffi/libffi/commit/e951d64c0852), just define
> the missing definition on QEMU to silence the warning.

See also c23e9a1c from 2023, which fixed that to use an ifdef.

I suppose the inclusion or exclusion of the go interface is neither here nor there, so 
long as it compiles.

r~


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH-for-10.2 2/2] tcg/tci: Disable Int128 support
  2025-12-02 22:30   ` Richard Henderson
@ 2025-12-03 13:18     ` Richard Henderson
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2025-12-03 13:18 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Daniel P. Berrangé, Paolo Bonzini, Stefan Weil,
	Marc-André Lureau

On 12/2/25 14:30, Richard Henderson wrote:
> On 12/2/25 10:46, Philippe Mathieu-Daudé wrote:
>> Disable Int128 on TCI, otherwise build fails:
>>
>>    In file included from ../../tcg/optimize.c:29:
>>    In file included from include/tcg/tcg-op-common.h:12:
>>    In file included from include/exec/helper-proto-common.h:10:
>>    In file included from include/qemu/atomic128.h:62:
>>    In file included from host/include/aarch64/host/atomic128-cas.h.inc:16:
>>    host/include/generic/host/atomic128-cas.h.inc:37:12: error: initializing 
>> 'Int128' (aka 'struct Int128') with an expression of incompatible type '__int128_t' (aka 
>> '__int128')
>>       37 |     Int128 old = *ptr_align;
>>          |            ^     ~~~~~~~~~~
>>    host/include/generic/host/atomic128-cas.h.inc:39:52: warning: incompatible pointer 
>> types passing 'Int128 *' (aka 'struct Int128 *') to parameter of type '__int128_t 
>> *' (aka '__int128 *') [-Wincompatible-pointer-types]
>>       39 |     while (!__atomic_compare_exchange_n(ptr_align, &old, new, true,
>>          |                                                    ^~~~
>>    host/include/generic/host/atomic128-cas.h.inc:39:58: error: passing 'Int128' (aka 
>> 'struct Int128') to parameter of incompatible type '__int128_t' (aka '__int128')
>>       39 |     while (!__atomic_compare_exchange_n(ptr_align, &old, new, true,
>>          |                                                          ^~~
>>    host/include/generic/host/atomic128-cas.h.inc:50:12: error: initializing 
>> 'Int128' (aka 'struct Int128') with an expression of incompatible type '__int128_t' (aka 
>> '__int128')
>>       50 |     Int128 old = *ptr_align;
>>          |            ^     ~~~~~~~~~~
>>    host/include/generic/host/atomic128-cas.h.inc:52:62: error: invalid operands to 
>> binary expression ('Int128' (aka 'struct Int128') and 'Int128')
>>       52 |     while (!__atomic_compare_exchange_n(ptr_align, &old, old & val, true,
>>          |                                                          ~~~ ^ ~~~
>>    host/include/generic/host/atomic128-cas.h.inc:63:12: error: initializing 
>> 'Int128' (aka 'struct Int128') with an expression of incompatible type '__int128_t' (aka 
>> '__int128')
>>       63 |     Int128 old = *ptr_align;
>>          |            ^     ~~~~~~~~~~
>>    host/include/generic/host/atomic128-cas.h.inc:65:62: error: invalid operands to 
>> binary expression ('Int128' (aka 'struct Int128') and 'Int128')
>>       65 |     while (!__atomic_compare_exchange_n(ptr_align, &old, old | val, true,
>>          |                                                          ~~~ ^ ~~~
>>    1 warning and 6 errors generated.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> 
> And what of the CONFIG_TCG_INTERPRETER test that already exists in int128.h?
> 
> There's got to be more to this than that.

If you disable Int128 entirely, then we can't use 
host/include/generic/host/atomic128-cas.h.inc at all.  The bug is within that header, were 
we need to use Int128Alias more, as we already do for atomic16_cmpxchg.

I'll post a fix.


r~


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-12-03 13:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-02 18:46 [PATCH-for-10.2 0/2] tcg: Fix TCI build on macOS Philippe Mathieu-Daudé
2025-12-02 18:46 ` [PATCH-for-10.2? 1/2] tcg/tci: Disable -Wundef FFI_GO_CLOSURES warning Philippe Mathieu-Daudé
2025-12-03  0:34   ` Richard Henderson
2025-12-02 18:46 ` [PATCH-for-10.2 2/2] tcg/tci: Disable Int128 support Philippe Mathieu-Daudé
2025-12-02 22:30   ` Richard Henderson
2025-12-03 13:18     ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).