CryptoPkg: Use Openssl NASM for Windows host-based unit tests

The optimized NASM assembly files from Openssl project for
IA32/X64 assume a Windows calling convention. Those NASM
files must be used for both firmware builds where the
default compiler calling convention is the Windows calling
convention and host-based unit tests built using any of the
compilers supported in Windows environment.

All the VS20xx tool chains in the MSFT tool family use a
Windows calling convention. The CLANGPDB tool chain under
both Windows and Linux environments also use a Windows
calling convention. Set PcdOpensslLibAssemblySourceStyleNasm
to TRUE for these conditions.

Host-based unit tests built in a Windows environment also
use a Windows calling convention. If WIN_HOST_BUILD is set
indicating a Windows build environment and
HOST_BASED_UNIT_TESTING_ENABLED is also set indicating
host-based unit tests, then
PcdOpensslLibAssemblySourceStyleNasm must be set to TRUE.

Otherwise a Linux calling convention is assumed and
PcdOpensslLibAssemblySourceStyleNasm uses its DEC default
value of FALSE that uses the Openssl project optimized
.S files that assume a Linux calling convention.

Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
This commit is contained in:
Michael D Kinney 2025-12-26 11:41:39 -08:00 committed by mergify[bot]
parent 27020f33a1
commit 706a3f989e

View file

@ -8,6 +8,17 @@
##
[PcdsFeatureFlag]
#
# Use Openssl NASM assembly source files that assume Windows calling convention
# if the family is MSFT or the toolchain is CLANGPDB for Windows or Linux.
# Also use Openssl NASM assembly source files that assume Windows calling
# convention if host-based unit tests are being build for Windows.
# Otherwise, the Openssl .S assembly source files that assume the Linux calling
# convention.
#
!if "$(FAMILY)" == "MSFT" || "$(TOOL_CHAIN_TAG)" == "CLANGPDB"
gEfiCryptoPkgTokenSpaceGuid.PcdOpensslLibAssemblySourceStyleNasm|TRUE
!endif
!if $(HOST_BASED_UNIT_TESTING_ENABLED) AND $(WIN_HOST_BUILD)
gEfiCryptoPkgTokenSpaceGuid.PcdOpensslLibAssemblySourceStyleNasm|TRUE
!endif