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_mouse@126.com>
diff --git a/mingw-w64-crt/include/sect_attribs.h b/mingw-w64-crt/include/sect_attribs.h
index 31b05da..66087d7 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