From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by mx.groups.io with SMTP id smtpd.web12.46046.1585558991187268643 for ; Mon, 30 Mar 2020 02:03:11 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=zdD+7umK; spf=pass (domain: linaro.org, ip: 209.85.221.67, mailfrom: ard.biesheuvel@linaro.org) Received: by mail-wr1-f67.google.com with SMTP id m11so14708225wrx.10 for ; Mon, 30 Mar 2020 02:03:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HE1eoOGeTpEjEL7kGchyeRq/kI4nJkCN+gTmAONF7+4=; b=zdD+7umKtQBD+r5Lx6Y6M40ObvZI6pq4k0D9EIXJqXUtU72mN2plW6jcjQVBiONCyG xxYoNFYGboZgwD//QBPIwANCjoEFjRL4SHvkxAXX7ljVd/TDP3wbPD4AZY7eIbwsxEOD O5UALor1FMw1Cj+Jcd7gUzLMD/o4JZeY8YyHNTQh4fOPn4IX+/fOpSHjgReiNDERlPmJ MY3Ph7mrrQ/qggVb3dEIcJbDigFjeKeDchKaU+LyxCIb7RlFBMBRcbELQ8YA8w8s16gw M/dml+X6GCrcqVXNwbBa+xcla2CXBmBzqi/xd1ezotww97FXV4i0ylSDbhF2yFd6UoJx /TKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HE1eoOGeTpEjEL7kGchyeRq/kI4nJkCN+gTmAONF7+4=; b=HEtKaRudbhfx4SYxJEo465qlBz97zJJGgjHrX0ze40aemP2iX09W08LrYwqaAil4DM K21EozKKRfQUnRuec6/coyQWbKgY9jmtTPs1TJHASgBdos9w7hvXWsmiq0Quj2ONgTou sqgg5tVBvI444Bfx0Lwj4YbXIUvFKr8Usu/ev6hq007qz4l3ChNg3CQrh/V9VSLmyTN4 IQA9denizL+xIq+/arC+BCsjQ/grSU39BjiYN9gR0DeOQZJ80oqk+ZixKisDTpIMRssb 1Qhr3wsLVn3gTjWb7/Io08htcz7PxRY3LogbW3SmOH/yYTelmf+5HMs22XGZHHGWCE1Y d3wQ== X-Gm-Message-State: ANhLgQ3UZX3uA0wokE25rpXzIQbniiDzluHWAoK2f5gqIxqeFhaOrwnO DqMpJOFx3ZuF3c6OCjwyT9sMq5f5qR+fJxMIHQ7P3MNNtWo= X-Google-Smtp-Source: ADFU+vtUCkYI7oZAbygGc4VhU4wJ0I4BM7fo43ePHB7ckxsXjRF5JJR/vW91eBFGp1lI8NsCDpGotpJ+es4bfoFvGT4= X-Received: by 2002:a5d:604a:: with SMTP id j10mr13486897wrt.126.1585558989283; Mon, 30 Mar 2020 02:03:09 -0700 (PDT) MIME-Version: 1.0 References: <20200330085247.2415-1-guomin.jiang@intel.com> In-Reply-To: <20200330085247.2415-1-guomin.jiang@intel.com> From: "Ard Biesheuvel" Date: Mon, 30 Mar 2020 11:02:58 +0200 Message-ID: Subject: Re: [edk2-devel] [PATCH] CryptoPkg/FltUsedLib: Add FltUsedLib for float. To: edk2-devel-groups-io , guomin.jiang@intel.com, Laszlo Ersek Cc: Jian J Wang , Xiaoyu Lu Content-Type: text/plain; charset="UTF-8" On Mon, 30 Mar 2020 at 10:52, Guomin Jiang wrote: > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2596 > > 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 Doesn't this affect *every* platform? Isn't there a better way to do this? E.g., using weak linkage? > --- > 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.
> + Copyright (c) 2020, Intel Corporation. All rights reserved.
> + 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.
> +# Copyright (c) 2020, Intel Corporation. All rights reserved.
> +# 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://docs.microsoft.com/en-us/cpp/error-messages/tool-errors/linker-tools-error-lnk1237?view=vs-2017 > + 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://edk2.groups.io/g/devel/message/56613 > Mute This Topic: https://groups.io/mt/72648022/1761188 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub [ard.biesheuvel@linaro.org] > ------------ >