CryptoPkg: workaround for MSVC linking tolower

Currently when building NOOPT tests in MSVC, the linker cannot
pick the correct tolower for the host runtime. A small
workaround to make the build work in MSVC.

Signed-off-by: Alexander Gryanko <xpahos@gmail.com>
This commit is contained in:
Alexander Gryanko
2025-06-24 02:54:17 +03:00
committed by mergify[bot]
parent d55642f537
commit 5125e2d6b1

View File

@@ -14,10 +14,23 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/DebugLib.h>
/* Convert character to lowercase */
#ifdef _MSC_VER
//
// Workaround for building NOOPT on Windows systems. Due to disabled
// optimization, the MSVC compiler cannot hide this function
// implementation from the linker.
//
int
tolower_noos (
int c
)
#pragma comment(linker, "/alternatename:tolower=tolower_noos")
#else
int
tolower (
int c
)
#endif
{
if (('A' <= (c)) && ((c) <= 'Z')) {
return (c - ('A' - 'a'));