From 1b280f88d7a42d99bf8f9df970a6852c66a5a8e0 Mon Sep 17 00:00:00 2001 From: vit9696 Date: Fri, 6 Nov 2020 23:59:15 +0300 Subject: [PATCH] OcGuardLib: Avoid undefined reference to 64-bit mul builtin on IA-32 --- Library/OcGuardLib/BitOverflow.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Library/OcGuardLib/BitOverflow.c b/Library/OcGuardLib/BitOverflow.c index da0a689ca9e..1bb76b4cdce 100644 --- a/Library/OcGuardLib/BitOverflow.c +++ b/Library/OcGuardLib/BitOverflow.c @@ -319,9 +319,13 @@ OcOverflowMulS64 ( INT64 *Result ) { -#if defined(OC_HAS_TYPE_GENERIC_BUILTINS) + // + // Intel 32-bit architectures do not have hardware signed 64-bit + // multiplication with overflow. + // +#if defined(OC_HAS_TYPE_GENERIC_BUILTINS) && !defined(MDE_CPU_IA32) return __builtin_mul_overflow(A, B, Result); -#elif defined(OC_HAS_TYPE_SPECIFIC_BUILTINS) +#elif defined(OC_HAS_TYPE_SPECIFIC_BUILTINS) && !defined(MDE_CPU_IA32) return __builtin_smulll_overflow(A, B, Result); #else UINT64 AU;