From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: redhat.com, ip: 209.132.183.28, mailfrom: lersek@redhat.com) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by groups.io with SMTP; Thu, 09 May 2019 10:16:10 -0700 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B8C6E308421A; Thu, 9 May 2019 17:16:09 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-234.rdu2.redhat.com [10.10.120.234]) by smtp.corp.redhat.com (Postfix) with ESMTP id A4FA65B681; Thu, 9 May 2019 17:16:08 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH v2 3/6] CryptoPkg/IntrinsicLib: Fix possible unresolved external symbol issue To: devel@edk2.groups.io, xiaoyux.lu@intel.com Cc: Jian J Wang , Ting Ye References: <1557379429-7527-1-git-send-email-xiaoyux.lu@intel.com> <1557379429-7527-3-git-send-email-xiaoyux.lu@intel.com> From: "Laszlo Ersek" Message-ID: <159ea41f-7828-db11-b807-86f6f7fe1447@redhat.com> Date: Thu, 9 May 2019 19:16:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1557379429-7527-3-git-send-email-xiaoyux.lu@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 09 May 2019 17:16:09 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 05/09/19 07:23, Xiaoyu lu wrote: > From: Xiaoyu Lu > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1089 > > This is for the upcoming upgrade to OpenSSL_1_1_1b > > Compiler optimization(Visual Studio) may automatically use _ftol2 > instead of some type conversion. For example: > > OpensslLib.lib(drbg_lib.obj) : error LNK2001: > unresolved external symbol __ftol2 > > This patch add _ftol2 function for the compiler intrinsic. > > Cc: Jian J Wang > Cc: Ting Ye > Signed-off-by: Xiaoyu Lu > --- > CryptoPkg/Library/IntrinsicLib/Ia32/MathFtol.c | 22 ++++++++++++++++++++++ > CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf | 4 +++- > 2 files changed, 25 insertions(+), 1 deletion(-) > create mode 100644 CryptoPkg/Library/IntrinsicLib/Ia32/MathFtol.c > > diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathFtol.c b/CryptoPkg/Library/IntrinsicLib/Ia32/MathFtol.c > new file mode 100644 > index 0000000..147a19a > --- /dev/null > +++ b/CryptoPkg/Library/IntrinsicLib/Ia32/MathFtol.c > @@ -0,0 +1,22 @@ > +/** @file > + 64-bit Math Worker Function. > + The 32-bit versions of C compiler generate calls to library routines > + to handle 64-bit math. These functions use non-standard calling conventions. > + > +Copyright (c) 2019, Intel Corporation. All rights reserved.
> +SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +/* > + * Floating point to integer conversion. > + */ > +__declspec(naked) void _ftol2 (void) > +{ > + _asm { > + fistp qword ptr [esp-8] > + mov edx, [esp-4] > + mov eax, [esp-8] > + ret > + } > +} > diff --git a/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf b/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf > index 5a20967..fcbb933 100644 > --- a/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf > +++ b/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf > @@ -1,7 +1,7 @@ > ## @file > # Intrinsic Routines Wrapper Library Instance. > # > -# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
> +# Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
> # SPDX-License-Identifier: BSD-2-Clause-Patent > # > ## > @@ -29,9 +29,11 @@ > > Ia32/MathLShiftS64.c | MSFT > Ia32/MathRShiftU64.c | MSFT > + Ia32/MathFtol.c | MSFT > > Ia32/MathLShiftS64.c | INTEL > Ia32/MathRShiftU64.c | INTEL > + Ia32/MathFtol.c | INTEL > > Ia32/MathLShiftS64.nasm | GCC > Ia32/MathRShiftU64.nasm | GCC > Thank you for splitting this out; this is a nice improvement for the structure of the patch series. Thanks Laszlo