]> git.proxmox.com Git - mirror_edk2.git/commitdiff
CryptoPkg IntrinsicLib: Make _fltused always be used
authorLiming Gao <liming.gao@intel.com>
Thu, 17 Oct 2019 06:55:53 +0000 (14:55 +0800)
committerLiming Gao <liming.gao@intel.com>
Thu, 24 Oct 2019 01:41:34 +0000 (09:41 +0800)
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1603
With this change, global variable _fltused will not be removed by LTO

Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c

index 6e4d4a68cc3ff910b7f4d676262cdc66f4204940..94fe341bec9d1dceade0fa0acb643afa67fce7df 100644 (file)
@@ -2,7 +2,7 @@
   Intrinsic Memory Routines Wrapper Implementation for OpenSSL-based\r
   Cryptographic Library.\r
 \r
   Intrinsic Memory Routines Wrapper Implementation for OpenSSL-based\r
   Cryptographic Library.\r
 \r
-Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>\r
 SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
@@ -13,9 +13,15 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 \r
 typedef UINTN  size_t;\r
 \r
 \r
 typedef UINTN  size_t;\r
 \r
+#if defined(__GNUC__) || defined(__clang__)\r
+  #define GLOBAL_USED __attribute__((used))\r
+#else\r
+  #define GLOBAL_USED\r
+#endif\r
+\r
 /* OpenSSL will use floating point support, and C compiler produces the _fltused\r
    symbol by default. Simply define this symbol here to satisfy the linker. */\r
 /* OpenSSL will use floating point support, and C compiler produces the _fltused\r
    symbol by default. Simply define this symbol here to satisfy the linker. */\r
-int _fltused = 1;\r
+int  GLOBAL_USED _fltused = 1;\r
 \r
 /* Sets buffers to a specified character */\r
 void * memset (void *dest, int ch, size_t count)\r
 \r
 /* Sets buffers to a specified character */\r
 void * memset (void *dest, int ch, size_t count)\r