[edk2-devel] [Patch 09/12] CryptoPkg IntrinsicLib: Make _fltused always be used

Liming Gao liming.gao at intel.com
Fri Sep 27 07:46:32 UTC 2019


With this change, global variable _fltused will not be removed by LTO

Signed-off-by: Liming Gao <liming.gao at intel.com>
---
 CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

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


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#48201): https://edk2.groups.io/g/devel/message/48201
Mute This Topic: https://groups.io/mt/34309062/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list