qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] meson: explain more verbosely why we forbid Clang on Windows
@ 2024-11-05 15:01 Daniel P. Berrangé
  2024-11-05 15:16 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel P. Berrangé @ 2024-11-05 15:01 UTC (permalink / raw)
  To: qemu-devel
  Cc: Daniel P. Berrangé, Marc-André Lureau,
	Philippe Mathieu-Daudé, Paolo Bonzini

Contributors are repeatedly sending patches to remove the blockage of
clang on Windows, ignoring that we need 'gcc_struct' support. Put some
more explicit comments in the code to discourage people from doing
this.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 include/qemu/compiler.h |  7 +++++++
 meson.build             | 11 ++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
index c06954ccb4..38ed8997ca 100644
--- a/include/qemu/compiler.h
+++ b/include/qemu/compiler.h
@@ -22,6 +22,13 @@
 #define QEMU_EXTERN_C extern
 #endif
 
+/*
+ * QEMU requires 'gcc_struct' on Windows for correct guest ABI.
+ * meson.build checks for 'gcc_struct' and blocks use of CLang
+ * on Windows, pending a fix for:
+ *
+ *   https://github.com/llvm/llvm-project/issues/24757
+ */
 #if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__))
 # define QEMU_PACKED __attribute__((gcc_struct, packed))
 #else
diff --git a/meson.build b/meson.build
index 2c9086a3fe..37b7daa758 100644
--- a/meson.build
+++ b/meson.build
@@ -330,9 +330,18 @@ elif host_os == 'sunos'
 elif host_os == 'haiku'
   qemu_common_flags += ['-DB_USE_POSITIVE_POSIX_ERRORS', '-D_BSD_SOURCE', '-fPIC']
 elif host_os == 'windows'
+    # Clang is blocked, pending impl of 'gcc_struct' support:
+    #
+    #  https://gitlab.com/qemu-project/qemu/-/issues/2476
+    #  https://github.com/llvm/llvm-project/issues/24757
+    #  https://github.com/llvm/llvm-project/pull/71148
+    #
+    # Once the above is available this check should "do the right thing".
+    # This check can then eventually be removed once the CLang minimum
+    # version checked 50 lines earlier guarantees support
   if not compiler.compiles('struct x { int y; } __attribute__((gcc_struct));',
                            args: '-Werror')
-    error('Your compiler does not support __attribute__((gcc_struct)) - please use GCC instead of Clang')
+    error('Your compiler does not support __attribute__((gcc_struct)) - please use GCC instead of Clang (https://github.com/llvm/llvm-project/issues/24757)')
   endif
 endif
 
-- 
2.46.0



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

* Re: [PATCH] meson: explain more verbosely why we forbid Clang on Windows
  2024-11-05 15:01 [PATCH] meson: explain more verbosely why we forbid Clang on Windows Daniel P. Berrangé
@ 2024-11-05 15:16 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2024-11-05 15:16 UTC (permalink / raw)
  To: Daniel P. Berrangé, qemu-devel
  Cc: Marc-André Lureau, Philippe Mathieu-Daudé,
	Paolo Bonzini

On 11/5/24 15:01, Daniel P. Berrangé wrote:
> Contributors are repeatedly sending patches to remove the blockage of
> clang on Windows, ignoring that we need 'gcc_struct' support. Put some
> more explicit comments in the code to discourage people from doing
> this.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>   include/qemu/compiler.h |  7 +++++++
>   meson.build             | 11 ++++++++++-
>   2 files changed, 17 insertions(+), 1 deletion(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

end of thread, other threads:[~2024-11-05 15:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-05 15:01 [PATCH] meson: explain more verbosely why we forbid Clang on Windows Daniel P. Berrangé
2024-11-05 15:16 ` 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).