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

Liming Gao posted 11 patches 6 years, 3 months ago
There is a newer version of this series
[edk2-devel] [Patch v2 09/11] CryptoPkg IntrinsicLib: Make _fltused always be used
Posted by Liming Gao 6 years, 3 months ago
With this change, global variable _fltused will not be removed by LTO

Signed-off-by: Liming Gao <liming.gao@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 (#48961): https://edk2.groups.io/g/devel/message/48961
Mute This Topic: https://groups.io/mt/34540592/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [Patch v2 09/11] CryptoPkg IntrinsicLib: Make _fltused always be used
Posted by Wang, Jian J 6 years, 3 months ago
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Liming Gao
> Sent: Tuesday, October 15, 2019 8:27 AM
> To: devel@edk2.groups.io
> Subject: [edk2-devel] [Patch v2 09/11] CryptoPkg IntrinsicLib: Make _fltused
> always be used
> 
> With this change, global variable _fltused will not be removed by LTO
> 
> Signed-off-by: Liming Gao <liming.gao@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 (#49037): https://edk2.groups.io/g/devel/message/49037
Mute This Topic: https://groups.io/mt/34540592/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [Patch v2 09/11] CryptoPkg IntrinsicLib: Make _fltused always be used
Posted by Philippe Mathieu-Daudé 6 years, 3 months ago
On 10/15/19 2:26 AM, Liming Gao wrote:
> With this change, global variable _fltused will not be removed by LTO
> 
> Signed-off-by: Liming Gao <liming.gao@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)
> 

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


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

View/Reply Online (#48992): https://edk2.groups.io/g/devel/message/48992
Mute This Topic: https://groups.io/mt/34540592/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-