--
Best regards,
LIU Hao
From 1288ab9f2a965bcca5513b36bd29e906c4b7ee2f Mon Sep 17 00:00:00 2001
From: LIU Hao <lh_mo...@126.com>
Date: Tue, 27 Dec 2022 14:32:37 +0800
Subject: [PATCH] crt: Preserve special variables when LTO is in effect

Variables that are required to be placed in explicit sections probably
have special meanings, and shall not be eliminated by LTO. Preserving
all of them might look an overkill, but should be safest.

Signed-off-by: LIU Hao <lh_mo...@126.com>
---
 mingw-w64-crt/include/sect_attribs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mingw-w64-crt/include/sect_attribs.h 
b/mingw-w64-crt/include/sect_attribs.h
index 31b05da8e..66087d782 100644
--- a/mingw-w64-crt/include/sect_attribs.h
+++ b/mingw-w64-crt/include/sect_attribs.h
@@ -65,7 +65,7 @@
 #if defined(_MSC_VER)
 #define _CRTALLOC(x) __declspec(allocate(x))
 #elif defined(__GNUC__)
-#define _CRTALLOC(x) __attribute__ ((section (x) ))
+#define _CRTALLOC(x) __attribute__ ((section (x), used))
 #else
 #error Your compiler is not supported.
 #endif
-- 
2.39.0

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to