MdeModulePkg: Fix undefined reference to memcpy with XCODE5

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3098

XCODE5 toolchain in NOOPT mode generates memcpy when trying
to copy PEI_CORE_FV_HANDLE structure. This breaks OVMF
compilation with XCODE5.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Vitaly Cheptsov <cheptsov@ispras.ru>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
This commit is contained in:
Vitaly Cheptsov
2020-12-02 02:26:51 +08:00
committed by mergify[bot]
parent 6af76adbbf
commit 31e8a47b62
3 changed files with 8 additions and 8 deletions

View File

@ -1256,13 +1256,13 @@ EvacuateTempRam (
} }
for (FvIndex = 0; FvIndex < Private->FvCount; FvIndex++) { for (FvIndex = 0; FvIndex < Private->FvCount; FvIndex++) {
if (Private->Fv[FvIndex].FvHandle == PeiCoreFvHandle.FvHandle) { if (Private->Fv[FvIndex].FvHandle == PeiCoreFvHandle.FvHandle) {
PeiCoreFvHandle = Private->Fv[FvIndex]; CopyMem (&PeiCoreFvHandle, &Private->Fv[FvIndex], sizeof (PEI_CORE_FV_HANDLE));
break; break;
} }
} }
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
ConvertPeiCorePpiPointers (Private, PeiCoreFvHandle); ConvertPeiCorePpiPointers (Private, &PeiCoreFvHandle);
for (FvIndex = 0; FvIndex < Private->FvCount; FvIndex++) { for (FvIndex = 0; FvIndex < Private->FvCount; FvIndex++) {
FvHeader = Private->Fv[FvIndex].FvHeader; FvHeader = Private->Fv[FvIndex].FvHeader;

View File

@ -542,7 +542,7 @@ ConvertPpiPointersFv (
VOID VOID
ConvertPeiCorePpiPointers ( ConvertPeiCorePpiPointers (
IN PEI_CORE_INSTANCE *PrivateData, IN PEI_CORE_INSTANCE *PrivateData,
PEI_CORE_FV_HANDLE CoreFvHandle IN PEI_CORE_FV_HANDLE *CoreFvHandle
); );
/** /**

View File

@ -1062,7 +1062,7 @@ ProcessPpiListFromSec (
VOID VOID
ConvertPeiCorePpiPointers ( ConvertPeiCorePpiPointers (
IN PEI_CORE_INSTANCE *PrivateData, IN PEI_CORE_INSTANCE *PrivateData,
PEI_CORE_FV_HANDLE CoreFvHandle IN PEI_CORE_FV_HANDLE *CoreFvHandle
) )
{ {
EFI_FV_FILE_INFO FileInfo; EFI_FV_FILE_INFO FileInfo;
@ -1079,16 +1079,16 @@ ConvertPeiCorePpiPointers (
// //
// Find the PEI Core in the BFV in temporary memory. // Find the PEI Core in the BFV in temporary memory.
// //
Status = CoreFvHandle.FvPpi->FindFileByType ( Status = CoreFvHandle->FvPpi->FindFileByType (
CoreFvHandle.FvPpi, CoreFvHandle->FvPpi,
EFI_FV_FILETYPE_PEI_CORE, EFI_FV_FILETYPE_PEI_CORE,
CoreFvHandle.FvHandle, CoreFvHandle->FvHandle,
&PeiCoreFileHandle &PeiCoreFileHandle
); );
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
Status = CoreFvHandle.FvPpi->GetFileInfo (CoreFvHandle.FvPpi, PeiCoreFileHandle, &FileInfo); Status = CoreFvHandle->FvPpi->GetFileInfo (CoreFvHandle->FvPpi, PeiCoreFileHandle, &FileInfo);
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
Status = PeiGetPe32Data (PeiCoreFileHandle, &PeiCoreImageBase); Status = PeiGetPe32Data (PeiCoreFileHandle, &PeiCoreImageBase);