summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXiaoyu Lu <xiaoyux.lu@intel.com>2019-05-29 18:40:32 +0000
committerJian J Wang <jian.j.wang@intel.com>2019-06-03 08:28:01 +0800
commit96dbfad9b00b8ba85fad59a913eca6b5161d2fad (patch)
treefec96b32600b0084e7864dde0ecb2eaf97ea498a
parent7eee0488944fcf03f4faae2ccb05aa1939eaf905 (diff)
downloadedk2-96dbfad9b00b8ba85fad59a913eca6b5161d2fad.tar.gz
edk2-96dbfad9b00b8ba85fad59a913eca6b5161d2fad.tar.bz2
edk2-96dbfad9b00b8ba85fad59a913eca6b5161d2fad.zip
CryptoPkg/IntrinsicLib: Fix possible unresolved external symbol issue
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 <jian.j.wang@intel.com> Cc: Ting Ye <ting.ye@intel.com> Signed-off-by: Xiaoyu Lu <xiaoyux.lu@intel.com> Tested-by: Gary Lin <glin@suse.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
-rw-r--r--CryptoPkg/Library/IntrinsicLib/Ia32/MathFtol.c22
-rw-r--r--CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf4
2 files changed, 25 insertions, 1 deletions
diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathFtol.c b/CryptoPkg/Library/IntrinsicLib/Ia32/MathFtol.c
new file mode 100644
index 0000000000..147a19a4ad
--- /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.<BR>
+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 5a20967b6c..fcbb93316c 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.<BR>
+# Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>
# 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