]> git.proxmox.com Git - mirror_qemu.git/commitdiff
win32: avoid discarding the exception handler
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Mon, 25 Sep 2023 11:36:04 +0000 (15:36 +0400)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Tue, 3 Oct 2023 11:05:20 +0000 (15:05 +0400)
In all likelihood, the compiler with lto doesn't see the function being
used, from assembly macro __try1. Help it by marking the function has
being used.

Resolves:
https://gitlab.com/qemu-project/qemu/-/issues/1904

Fixes: commit d89f30b4df ("win32: wrap socket close() with an exception handler")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
include/qemu/compiler.h
util/oslib-win32.c

index 7f1bbbf05f4f16d04a783a3a87928b4c33b5f42f..1109482a000cf958fce8ad3eaa825c837931da2b 100644 (file)
 #define QEMU_ANNOTATE(x)
 #endif
 
+#if __has_attribute(used)
+# define QEMU_USED __attribute__((used))
+#else
+# define QEMU_USED
+#endif
+
 #endif /* COMPILER_H */
index 19a0ea7fbe661a6dcd11fa16cc642210ec791a38..55b0189dc30424d3223f11d0775f40b939420707 100644 (file)
@@ -479,7 +479,7 @@ int qemu_bind_wrap(int sockfd, const struct sockaddr *addr,
     return ret;
 }
 
-EXCEPTION_DISPOSITION
+QEMU_USED EXCEPTION_DISPOSITION
 win32_close_exception_handler(struct _EXCEPTION_RECORD *exception_record,
                               void *registration, struct _CONTEXT *context,
                               void *dispatcher)