sysemu/os-win32.h: Windows clang-cl compiler fixes
PATCH 1/1 sysemu/os-win32.h: Windows clang-cl compiler fixes
This contains a series of small compiler fixes to enable the compilation of qemu using clang-cl.
It mainly involves adding some missing header files and updating #ifdefs to handle clang-cl specific things.
--- include/qemu/compiler.h | 3 ++- include/sysemu/dma.h | 2 ++ include/sysemu/os-win32.h | 2 +- migration/savevm.c | 2 ++ tests/qtest/libqtest.c | 2 +- 5 files changed, 8 insertions(+), 3 deletions(-)
include/qemu/compiler.h +2 -1
@@ -22,7 +22,8 @@#define QEMU_EXTERN_C extern#endif -#if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__)) +#if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__)) && \ + !defined(__clang__)# define QEMU_PACKED __attribute__((gcc_struct, packed))#else # define QEMU_PACKED __attribute__((packed))
include/sysemu/dma.h +2 -0
@@ -14,6 +14,8 @@#include "exec/address-spaces.h" #include "block/block.h" #include "block/accounting.h" +#include "block/aio.h" +#include "qemu/iov.h" typedef enum { DMA_DIRECTION_TO_DEVICE = 0,
include/sysemu/os-win32.h +1 -1
@@ -70,7 +70,7 @@ int __mingw_setjmp(jmp_buf);void __attribute__((noreturn))__mingw_longjmp (jmp_buf ,int );#define setjmp (env) __mingw_setjmp(env)#define longjmp (env, val) __mingw_longjmp(env, val) -#elif defined(_WIN64) +#elif defined(_WIN64) && !defined(__clang__)/* * On windows-x64, setjmp is implemented by _setjmp which needs a second parameter. * If this parameter is NULL, longjump does no stack unwinding.
migration/savevm.c +2 -0
@@ -54,6 +54,8 @@#include "qemu/job.h" #include "qemu/main-loop.h" #include "block/snapshot.h" +#include "block/block-io.h" +#include "block/block-global-state.h" #include "qemu/cutils.h" #include "io/channel-buffer.h" #include "io/channel-file.h"
tests/qtest/libqtest.c +1 -1
@@ -386,7 +386,7 @@ static pid_t qtest_create_process(char *cmd) abort(); } -return (pid_t )pi.hProcess; +return (pid_t )GetProcessId (pi.hProcess); }#endif /* _WIN32 */
Signature · 1 line
2.47.0.163.g1226f6d8fa-goog
Quoted 21 lines · Roque Arcudia Hernandez
This contains a series of small compiler fixes to enable the compilation of qemu using clang-cl.
It mainly involves adding some missing header files and updating #ifdefs to handle clang-cl specific things.
Signed-off-by Erwin Jansen <[email protected]>Signed-off-by Roque Arcudia Hernandez <[email protected]>--- include/qemu/compiler.h | 3 ++- include/sysemu/dma.h | 2 ++ include/sysemu/os-win32.h | 2 +- migration/savevm.c | 2 ++ tests/qtest/libqtest.c | 2 +- 5 files changed, 8 insertions(+), 3 deletions(-)include/qemu/compiler.h +0
-0
include/qemu/compiler.h line 29
Quoted 9 lines
include/qemu/compiler.h +2
-1@@ -22,7 +22,8 @@#define QEMU_EXTERN_C extern#endif -#if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__)) +#if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__)) && \ + !defined(__clang__)# define QEMU_PACKED __attribute__((gcc_struct, packed))#else # define QEMU_PACKED __attribute__((packed))
We must use the 'gcc_struct' format for packing on Windows to preserve the correct ABI.
clang doesn't support this yet, which is why we don't permit use of clang on Windows platforms at this time.
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Hi Roque,
Quoted 22 lines · Roque Arcudia Hernandez
This contains a series of small compiler fixes to enable the compilation of qemu using clang-cl.
It mainly involves adding some missing header files and updating #ifdefs to handle clang-cl specific things.
Signed-off-by Erwin Jansen <[email protected]>Signed-off-by Roque Arcudia Hernandez <[email protected]>--- include/qemu/compiler.h | 3 ++- include/sysemu/dma.h | 2 ++ include/sysemu/os-win32.h | 2 +- migration/savevm.c | 2 ++ tests/qtest/libqtest.c | 2 +- 5 files changed, 8 insertions(+), 3 deletions(-)include/sysemu/dma.h +0
-0
include/sysemu/dma.h line 18
Quoted 5 lines
include/sysemu/dma.h +2
-0@@ -14,6 +14,8 @@#include "exec/address-spaces.h" #include "block/block.h" #include "block/accounting.h" +#include "block/aio.h" +#include "qemu/iov.h"
This change, ...
Quoted 10 lines
include/sysemu/dma.h +0
-0typedef enum { DMA_DIRECTION_TO_DEVICE = 0,migration/savevm.c +0
-0
migration/savevm.c line 58
Quoted 5 lines
migration/savevm.c +2
-0@@ -54,6 +54,8 @@#include "qemu/job.h" #include "qemu/main-loop.h" #include "block/snapshot.h" +#include "block/block-io.h" +#include "block/block-global-state.h"
... and this one look sane. But please commit them separately (preferably justifying what declarations are missing), not hidden behind "sysemu/os-win32.h" subject.
migration/savevm.c line 61
Quoted 3 lines
migration/savevm.c +0
-0#include "qemu/cutils.h" #include "io/channel-buffer.h" #include "io/channel-file.h"
Could you post a series (including this patch) ending with a patch exercising clang-cl in a job on our CI?
Thanks,
Phil.