From 55d0a45d514497b1e4db725d79ddc5881c28b618 Mon Sep 17 00:00:00 2001 From: LIU Hao Date: Thu, 12 Dec 2024 15:39:17 +0800 Subject: [PATCH] xglobals: Preserve special variables when LTO is enabled --- mcfgthread/xglobals.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mcfgthread/xglobals.c b/mcfgthread/xglobals.c index 4c0312e02..2f99a5f74 100644 --- a/mcfgthread/xglobals.c +++ b/mcfgthread/xglobals.c @@ -366,7 +366,8 @@ extern const PVOID __safe_se_handler_table[]; extern const ULONG __safe_se_handler_count; # endif -IMAGE_LOAD_CONFIG_DIRECTORY _load_config_used = +__attribute__((__used__)) +const IMAGE_LOAD_CONFIG_DIRECTORY _load_config_used = { .Size = sizeof(IMAGE_LOAD_CONFIG_DIRECTORY), # if defined __i386__ && defined _MSC_VER @@ -376,7 +377,8 @@ IMAGE_LOAD_CONFIG_DIRECTORY _load_config_used = }; # if defined _MSC_VER -int _fltused = 0x9875; /* dunno what it does but LINK complains. */ +__attribute__((__used__)) +const int _fltused = 0x9875; /* dunno what it does but LINK complains. */ # endif #else /* __MCF_IN_DLL */