From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web12.45953.1585558369964325863 for ; Mon, 30 Mar 2020 01:52:50 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: guomin.jiang@intel.com) IronPort-SDR: qi01TJ9jMG52Nq6xDlx2+sK7cEf5Ve3oA2sDVUh8XJK3beFb48wyUslaDOPSfLEa4frCKeagGm AuuFpcM+hsUw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2020 01:52:49 -0700 IronPort-SDR: IFWFa++kqgiVm7TiGaiV7WdMBOt77pzoRJMNEwQb+Mkr+br76OUwNkCtWcz82qzYqgnhUanRAN sY6GAcAMdA9Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,323,1580803200"; d="scan'208";a="448197610" Received: from guominji-mobl.ccr.corp.intel.com ([10.238.5.173]) by fmsmga005.fm.intel.com with ESMTP; 30 Mar 2020 01:52:47 -0700 From: "Guomin Jiang" To: devel@edk2.groups.io Cc: Jian J Wang , Xiaoyu Lu Subject: [PATCH] CryptoPkg/FltUsedLib: Add FltUsedLib for float. Date: Mon, 30 Mar 2020 16:52:47 +0800 Message-Id: <20200330085247.2415-1-guomin.jiang@intel.com> X-Mailer: git-send-email 2.25.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2596 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 Cc: Xiaoyu Lu Signed-off-by: Guomin Jiang --- 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 = #???=0D OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf=0D IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf=0D + FltUsedLib|CryptoPkg/Library/FltUsedLib/FltUsedLib.inf=0D SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf=0D =0D [LibraryClasses.ARM]=0D @@ -232,6 +233,7 @@ CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf=0D CryptoPkg/Library/BaseCryptLibNull/BaseCryptLibNull.inf=0D CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf=0D + CryptoPkg/Library/FltUsedLib/FltUsedLib.inf=0D CryptoPkg/Library/TlsLib/TlsLib.inf=0D CryptoPkg/Library/TlsLibNull/TlsLibNull.inf=0D CryptoPkg/Library/OpensslLib/OpensslLib.inf=0D diff --git a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf b/CryptoPkg/Li= brary/BaseCryptLib/BaseCryptLib.inf index 1bbe4f435a..c82e703aa0 100644 --- a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf +++ b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf @@ -84,6 +84,7 @@ DebugLib=0D OpensslLib=0D IntrinsicLib=0D + FltUsedLib=0D PrintLib=0D =0D #=0D diff --git a/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf b/CryptoPkg/Lib= rary/BaseCryptLib/PeiCryptLib.inf index c836c257f8..342aad008c 100644 --- a/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf +++ b/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf @@ -78,6 +78,7 @@ DebugLib=0D OpensslLib=0D IntrinsicLib=0D + FltUsedLib=0D =0D #=0D # Remove these [BuildOptions] after this library is cleaned up=0D 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=0D OpensslLib=0D IntrinsicLib=0D + FltUsedLib=0D PrintLib=0D =0D #=0D diff --git a/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf b/CryptoPkg/Lib= rary/BaseCryptLib/SmmCryptLib.inf index cc0b65fd25..7fdaaa48a6 100644 --- a/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf +++ b/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf @@ -88,6 +88,7 @@ MemoryAllocationLib=0D OpensslLib=0D IntrinsicLib=0D + FltUsedLib=0D PrintLib=0D =0D #=0D 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=0D + Need include this when use floats.=0D +=0D + Copyright (C) Microsoft Corporation. All rights reserved.
=0D + Copyright (c) 2020, Intel Corporation. All rights reserved.
=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +//=0D +// You need to include this to let the compiler know we are going to use=0D +// floating point=0D +//=0D +int _fltused =3D 0x9875;=0D diff --git a/CryptoPkg/Library/FltUsedLib/FltUsedLib.inf b/CryptoPkg/Librar= y/FltUsedLib/FltUsedLib.inf new file mode 100644 index 0000000000..8d67eadfa5 --- /dev/null +++ b/CryptoPkg/Library/FltUsedLib/FltUsedLib.inf @@ -0,0 +1,33 @@ +## @file=0D +# It is depent on when using floats=0D +#=0D +# Copyright (C) Microsoft Corporation. All rights reserved.
=0D +# Copyright (c) 2020, Intel Corporation. All rights reserved.
=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x00010005=0D + BASE_NAME =3D FltUsedLib=0D + FILE_GUID =3D C004F180-9FE2-4D2B-8318-BADC2A231774= =0D + MODULE_TYPE =3D BASE=0D + VERSION_STRING =3D 1.0=0D + LIBRARY_CLASS =3D FltUsedLib=0D +=0D +#=0D +# The following information is for reference only and not required by the = build tools.=0D +#=0D +# VALID_ARCHITECTURES =3D IA32 X64 AARCH64=0D +#=0D +=0D +[Sources]=0D + FltUsedLib.c=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D +=0D +[BuildOptions]=0D + # Disable GL due to linker error LNK1237=0D + # https://docs.microsoft.com/en-us/cpp/error-messages/tool-errors/linker= -tools-error-lnk1237?view=3Dvs-2017=0D + MSFT:*_*_*_CC_FLAGS =3D /GL-=0D 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=0D DebugLib=0D IntrinsicLib=0D + FltUsedLib=0D MemoryAllocationLib=0D OpensslLib=0D SafeIntLib=0D --=20 2.25.1.windows.1