From 75b773d84c89220463a14a6883d2b2a8e49e5b68 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Mon, 25 Sep 2023 15:36:04 +0400 Subject: win32: avoid discarding the exception handler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Thomas Huth --- include/qemu/compiler.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/qemu/compiler.h') diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h index 7f1bbbf05f..1109482a00 100644 --- a/include/qemu/compiler.h +++ b/include/qemu/compiler.h @@ -206,4 +206,10 @@ #define QEMU_ANNOTATE(x) #endif +#if __has_attribute(used) +# define QEMU_USED __attribute__((used)) +#else +# define QEMU_USED +#endif + #endif /* COMPILER_H */ -- cgit 1.4.1