From: marcandre.lureau@redhat.com
To: qemu-devel@nongnu.org
Cc: thuth@redhat.com,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Stefan Weil" <sw@weilnetz.de>
Subject: [PATCH] win32: avoid discarding the exception handler
Date: Mon, 25 Sep 2023 15:39:42 +0400 [thread overview]
Message-ID: <20230925113942.267924-1-marcandre.lureau@redhat.com> (raw)
From: Marc-André Lureau <marcandre.lureau@redhat.com>
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.
Fixes:
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>
---
include/qemu/compiler.h | 6 ++++++
util/oslib-win32.c | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
index a309f90c76..5c7f63f351 100644
--- a/include/qemu/compiler.h
+++ b/include/qemu/compiler.h
@@ -197,4 +197,10 @@
#define BUILTIN_SUBCLL_BROKEN
#endif
+#if __has_attribute(used)
+# define QEMU_USED __attribute__((used))
+#else
+# define QEMU_USED
+#endif
+
#endif /* COMPILER_H */
diff --git a/util/oslib-win32.c b/util/oslib-win32.c
index 19a0ea7fbe..55b0189dc3 100644
--- a/util/oslib-win32.c
+++ b/util/oslib-win32.c
@@ -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)
--
2.41.0
next reply other threads:[~2023-09-25 11:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-25 11:39 marcandre.lureau [this message]
2023-09-25 11:56 ` [PATCH] win32: avoid discarding the exception handler Thomas Huth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230925113942.267924-1-marcandre.lureau@redhat.com \
--to=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sw@weilnetz.de \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).