mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-12-10 18:43:42 +01:00
gconstructor: Add attribute used for TLS callback pointer
This is needed to ensure that the pointer is not removed by an optimization pass. Theoretically, we'd have to add both 'used' and 'retain' attributes, however for PE targets 'used' includes the effect of 'retain' [1], and GCC warns if 'retain' is used in PE targets. Fixes the constructor test in LTO builds. [1] https://reviews.llvm.org/D96838
This commit is contained in:
@@ -60,7 +60,7 @@ __pragma (comment (linker, "/INCLUDE:" G_MSVC_SYMBOL_PREFIX "_ptr_" #func))
|
||||
static void NTAPI func (PVOID, DWORD, PVOID); \
|
||||
\
|
||||
G_BEGIN_DECLS \
|
||||
__attribute__ ((section (".CRT$XLCE"))) \
|
||||
__attribute__ ((section (".CRT$XLCE"), used)) \
|
||||
G_EXTERN_CONST PIMAGE_TLS_CALLBACK _ptr_##func = func; \
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user