Skip to contentSkip to conversation

meson: explain more verbosely why we forbid Clang on Windows

PATCH In review Daniel P. Berrangé 2 participants 2 messages Nov 5, 2024 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 meson: explain more verbosely why we forbid Clang on Windows

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.

---
 include/qemu/compiler.h |  7 +++++++
 meson.build             | 11 ++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)
include/qemu/compiler.h +7 -0
index c06954ccb4..38ed8997ca 100644
@@ -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
meson.build +10 -1
index 2c9086a3fe..37b7daa758 100644
@@ -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
 
Signature · 1 line
2.46.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Daniel P. Berrangé

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.

---
  include/qemu/compiler.h |  7 +++++++
  meson.build             | 11 ++++++++++-
  2 files changed, 17 insertions(+), 1 deletion(-)

r~