public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Bret Barkelew" <bret.barkelew@microsoft.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"guomin.jiang@intel.com" <guomin.jiang@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>, Xiaoyu Lu <xiaoyux.lu@intel.com>
Subject: Re: [EXTERNAL] [edk2-devel] [PATCH] CryptoPkg/FltUsedLib: Add FltUsedLib for float.
Date: Mon, 30 Mar 2020 16:55:05 +0000	[thread overview]
Message-ID: <CY4PR21MB074318E396AD685A4A33E894EFCB0@CY4PR21MB0743.namprd21.prod.outlook.com> (raw)
In-Reply-To: <20200330085247.2415-1-guomin.jiang@intel.com>

[-- Attachment #1: Type: text/plain, Size: 8308 bytes --]

Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>

- Bret

________________________________
From: devel@edk2.groups.io <devel@edk2.groups.io> on behalf of Guomin Jiang via Groups.Io <guomin.jiang=intel.com@groups.io>
Sent: Monday, March 30, 2020 1:52:47 AM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Jian J Wang <jian.j.wang@intel.com>; Xiaoyu Lu <xiaoyux.lu@intel.com>
Subject: [EXTERNAL] [edk2-devel] [PATCH] CryptoPkg/FltUsedLib: Add FltUsedLib for float.

REF: https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2596&amp;data=02%7C01%7CBret.Barkelew%40microsoft.com%7Cdcda1866343d4d6dab3908d7d487ba8e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637211551721384527&amp;sdata=LCgdHl1VW1DIGzMCei5PDRP7UQtD%2FERzkumrbgpYuJs%3D&amp;reserved=0

OpenSSL requires _fltused to be defined as a constant anywhere floating
point is used.
This is to satisfy the linker, however, it is possible to compile a
module with multiple definitions of fltused. This causes the
MSVC compiler to fail the build.
To solve this problem, the FltUsedLib was created that is one spot
that the global static can exist.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
Signed-off-by: Guomin Jiang <guomin.jiang@intel.com>
---
 CryptoPkg/CryptoPkg.dsc                       |  2 ++
 .../Library/BaseCryptLib/BaseCryptLib.inf     |  1 +
 .../Library/BaseCryptLib/PeiCryptLib.inf      |  1 +
 .../Library/BaseCryptLib/RuntimeCryptLib.inf  |  1 +
 .../Library/BaseCryptLib/SmmCryptLib.inf      |  1 +
 CryptoPkg/Library/FltUsedLib/FltUsedLib.c     | 14 ++++++++
 CryptoPkg/Library/FltUsedLib/FltUsedLib.inf   | 33 +++++++++++++++++++
 CryptoPkg/Library/TlsLib/TlsLib.inf           |  1 +
 8 files changed, 54 insertions(+)
 create mode 100644 CryptoPkg/Library/FltUsedLib/FltUsedLib.c
 create mode 100644 CryptoPkg/Library/FltUsedLib/FltUsedLib.inf

diff --git a/CryptoPkg/CryptoPkg.dsc b/CryptoPkg/CryptoPkg.dsc
index 4cb37b1349..e9854087b5 100644
--- a/CryptoPkg/CryptoPkg.dsc
+++ b/CryptoPkg/CryptoPkg.dsc
@@ -97,6 +97,7 @@
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf                                          #???

   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf

   IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf

+  FltUsedLib|CryptoPkg/Library/FltUsedLib/FltUsedLib.inf

   SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf



 [LibraryClasses.ARM]

@@ -232,6 +233,7 @@
   CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf

   CryptoPkg/Library/BaseCryptLibNull/BaseCryptLibNull.inf

   CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf

+  CryptoPkg/Library/FltUsedLib/FltUsedLib.inf

   CryptoPkg/Library/TlsLib/TlsLib.inf

   CryptoPkg/Library/TlsLibNull/TlsLibNull.inf

   CryptoPkg/Library/OpensslLib/OpensslLib.inf

diff --git a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
index 1bbe4f435a..c82e703aa0 100644
--- a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
@@ -84,6 +84,7 @@
   DebugLib

   OpensslLib

   IntrinsicLib

+  FltUsedLib

   PrintLib



 #

diff --git a/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf b/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
index c836c257f8..342aad008c 100644
--- a/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
@@ -78,6 +78,7 @@
   DebugLib

   OpensslLib

   IntrinsicLib

+  FltUsedLib



 #

 # Remove these [BuildOptions] after this library is cleaned up

diff --git a/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf b/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
index bff308a4f5..dcf209d7f5 100644
--- a/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
@@ -89,6 +89,7 @@
   DebugLib

   OpensslLib

   IntrinsicLib

+  FltUsedLib

   PrintLib



 #

diff --git a/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf b/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
index cc0b65fd25..7fdaaa48a6 100644
--- a/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
@@ -88,6 +88,7 @@
   MemoryAllocationLib

   OpensslLib

   IntrinsicLib

+  FltUsedLib

   PrintLib



 #

diff --git a/CryptoPkg/Library/FltUsedLib/FltUsedLib.c b/CryptoPkg/Library/FltUsedLib/FltUsedLib.c
new file mode 100644
index 0000000000..8f2487ea13
--- /dev/null
+++ b/CryptoPkg/Library/FltUsedLib/FltUsedLib.c
@@ -0,0 +1,14 @@
+/** @file

+  Need include this when use floats.

+

+  Copyright (C) Microsoft Corporation. All rights reserved.<BR>

+  Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>

+  SPDX-License-Identifier: BSD-2-Clause-Patent

+

+**/

+

+//

+// You need to include this to let the compiler know we are going to use

+// floating point

+//

+int _fltused = 0x9875;

diff --git a/CryptoPkg/Library/FltUsedLib/FltUsedLib.inf b/CryptoPkg/Library/FltUsedLib/FltUsedLib.inf
new file mode 100644
index 0000000000..8d67eadfa5
--- /dev/null
+++ b/CryptoPkg/Library/FltUsedLib/FltUsedLib.inf
@@ -0,0 +1,33 @@
+## @file

+# It is depent on when using floats

+#

+# Copyright (C) Microsoft Corporation. All rights reserved.<BR>

+# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>

+# SPDX-License-Identifier: BSD-2-Clause-Patent

+#

+##

+

+[Defines]

+  INF_VERSION                    = 0x00010005

+  BASE_NAME                      = FltUsedLib

+  FILE_GUID                      = C004F180-9FE2-4D2B-8318-BADC2A231774

+  MODULE_TYPE                    = BASE

+  VERSION_STRING                 = 1.0

+  LIBRARY_CLASS                  = FltUsedLib

+

+#

+# The following information is for reference only and not required by the build tools.

+#

+#  VALID_ARCHITECTURES           = IA32 X64 AARCH64

+#

+

+[Sources]

+  FltUsedLib.c

+

+[Packages]

+  MdePkg/MdePkg.dec

+

+[BuildOptions]

+  # Disable GL due to linker error LNK1237

+  # https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fcpp%2Ferror-messages%2Ftool-errors%2Flinker-tools-error-lnk1237%3Fview%3Dvs-2017&amp;data=02%7C01%7CBret.Barkelew%40microsoft.com%7Cdcda1866343d4d6dab3908d7d487ba8e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637211551721384527&amp;sdata=vULhLfRubt3e7xbVLa%2BHC0E34JTcgOSbdYndn%2FxNEps%3D&amp;reserved=0

+  MSFT:*_*_*_CC_FLAGS = /GL-

diff --git a/CryptoPkg/Library/TlsLib/TlsLib.inf b/CryptoPkg/Library/TlsLib/TlsLib.inf
index 2f3ce695c3..febbdf5149 100644
--- a/CryptoPkg/Library/TlsLib/TlsLib.inf
+++ b/CryptoPkg/Library/TlsLib/TlsLib.inf
@@ -37,6 +37,7 @@
   BaseMemoryLib

   DebugLib

   IntrinsicLib

+  FltUsedLib

   MemoryAllocationLib

   OpensslLib

   SafeIntLib

--
2.25.1.windows.1


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

View/Reply Online (#56613): https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fedk2.groups.io%2Fg%2Fdevel%2Fmessage%2F56613&amp;data=02%7C01%7CBret.Barkelew%40microsoft.com%7Cdcda1866343d4d6dab3908d7d487ba8e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637211551721384527&amp;sdata=DHVFRPBfEkbBLIgrIdwQxnGH0XjtN1oxsZYVyLDIqf4%3D&amp;reserved=0
Mute This Topic: https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.io%2Fmt%2F72648022%2F1822150&amp;data=02%7C01%7CBret.Barkelew%40microsoft.com%7Cdcda1866343d4d6dab3908d7d487ba8e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637211551721384527&amp;sdata=KyjsUA%2BJ4U6YdFn22%2BHhr%2F0JF5AojkVTU52vmE1zh2Q%3D&amp;reserved=0
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fedk2.groups.io%2Fg%2Fdevel%2Funsub&amp;data=02%7C01%7CBret.Barkelew%40microsoft.com%7Cdcda1866343d4d6dab3908d7d487ba8e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637211551721384527&amp;sdata=04dDAgBNEz8Ra5JuAfOVK3dvos1vhfQDma5Y2Qv4eao%3D&amp;reserved=0  [brbarkel@microsoft.com]
-=-=-=-=-=-=


[-- Attachment #2: Type: text/html, Size: 15167 bytes --]

      parent reply	other threads:[~2020-03-30 16:55 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-30  8:52 [PATCH] CryptoPkg/FltUsedLib: Add FltUsedLib for float Guomin Jiang
2020-03-30  9:02 ` [edk2-devel] " Ard Biesheuvel
2020-03-30 19:04   ` Laszlo Ersek
2020-03-30 21:27     ` Matthew Carlson
2020-03-30 21:41       ` Ard Biesheuvel
2020-03-31 12:42         ` Laszlo Ersek
2020-03-31 14:36           ` Michael D Kinney
2020-03-31 22:29             ` Laszlo Ersek
2020-03-31 22:57               ` Sean
2020-03-31 23:36                 ` Michael D Kinney
2020-04-01  6:42             ` Ard Biesheuvel
2020-04-01 16:38               ` Michael D Kinney
2020-04-14  5:02                 ` Ni, Ray
2020-04-14  7:01                   ` Guomin Jiang
2020-04-17  8:15                     ` Ard Biesheuvel
2020-04-23  2:36                       ` Guomin Jiang
     [not found]                   ` <16059D94172527B2.17445@groups.io>
2020-04-23  1:33                     ` Guomin Jiang
2020-04-23  3:31                       ` Ni, Ray
2020-04-23  4:04                         ` Guomin Jiang
2020-04-23  5:49                           ` Liming Gao
2020-04-24  5:07                             ` Guomin Jiang
2020-04-26 15:32                               ` Liming Gao
2020-04-27  2:32                                 ` Ni, Ray
2020-03-31  1:40     ` Guomin Jiang
2020-03-31  7:13       ` Ard Biesheuvel
2020-03-31 12:32         ` Laszlo Ersek
2020-03-30 16:55 ` Bret Barkelew [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CY4PR21MB074318E396AD685A4A33E894EFCB0@CY4PR21MB0743.namprd21.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox