]> git.ipfire.org Git - thirdparty/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)
committerMichael Tokarev <mjt@tls.msk.ru>
Thu, 5 Oct 2023 05:42:38 +0000 (08:42 +0300)
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>
(cherry picked from commit 75b773d84c89220463a14a6883d2b2a8e49e5b68)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(mjt: trivial context fixup in include/qemu/compiler.h)

include/qemu/compiler.h
util/oslib-win32.c

index a309f90c76823139d056d16b74057e455f9b518f..5c7f63f351f302b94ca2c01c8f64817dbf2ddabd 100644 (file)
 #define BUILTIN_SUBCLL_BROKEN
 #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)