]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: Fix undefined reference to memcpy with XCODE5
authorVitaly Cheptsov <cheptsov@ispras.ru>
Tue, 1 Dec 2020 18:26:51 +0000 (02:26 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 4 Dec 2020 02:59:38 +0000 (02:59 +0000)
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>
MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
MdeModulePkg/Core/Pei/PeiMain.h
MdeModulePkg/Core/Pei/Ppi/Ppi.c

index b9a279ec73a2b1338dbdf0cfb35c45c4b3d3f255..3369585bcce82a4af3ec29db1a8b466885c0db97 100644 (file)
@@ -1256,13 +1256,13 @@ EvacuateTempRam (
   }\r
   for (FvIndex = 0; FvIndex < Private->FvCount; FvIndex++) {\r
     if (Private->Fv[FvIndex].FvHandle == PeiCoreFvHandle.FvHandle) {\r
-      PeiCoreFvHandle = Private->Fv[FvIndex];\r
+      CopyMem (&PeiCoreFvHandle, &Private->Fv[FvIndex], sizeof (PEI_CORE_FV_HANDLE));\r
       break;\r
     }\r
   }\r
   Status = EFI_SUCCESS;\r
 \r
-  ConvertPeiCorePpiPointers (Private, PeiCoreFvHandle);\r
+  ConvertPeiCorePpiPointers (Private, &PeiCoreFvHandle);\r
 \r
   for (FvIndex = 0; FvIndex < Private->FvCount; FvIndex++) {\r
     FvHeader = Private->Fv[FvIndex].FvHeader;\r
index c27e8fc33bc64321b980a5d508e3075ce0da0070..daa48b4c5f37276ccb50e71d19c75e579ce4df74 100644 (file)
@@ -542,7 +542,7 @@ ConvertPpiPointersFv (
 VOID\r
 ConvertPeiCorePpiPointers (\r
   IN  PEI_CORE_INSTANCE        *PrivateData,\r
-  PEI_CORE_FV_HANDLE           CoreFvHandle\r
+  IN  PEI_CORE_FV_HANDLE       *CoreFvHandle\r
   );\r
 \r
 /**\r
index 541047d98a4a1423baa7a782e136ec403db109d5..0ad71d116fa58d1c67999fae38132a5cfa49fab9 100644 (file)
@@ -1062,7 +1062,7 @@ ProcessPpiListFromSec (
 VOID\r
 ConvertPeiCorePpiPointers (\r
   IN  PEI_CORE_INSTANCE        *PrivateData,\r
-  PEI_CORE_FV_HANDLE           CoreFvHandle\r
+  IN  PEI_CORE_FV_HANDLE       *CoreFvHandle\r
   )\r
 {\r
   EFI_FV_FILE_INFO      FileInfo;\r
@@ -1079,16 +1079,16 @@ ConvertPeiCorePpiPointers (
   //\r
   // Find the PEI Core in the BFV in temporary memory.\r
   //\r
-  Status =  CoreFvHandle.FvPpi->FindFileByType (\r
-                                  CoreFvHandle.FvPpi,\r
+  Status =  CoreFvHandle->FvPpi->FindFileByType (\r
+                                  CoreFvHandle->FvPpi,\r
                                   EFI_FV_FILETYPE_PEI_CORE,\r
-                                  CoreFvHandle.FvHandle,\r
+                                  CoreFvHandle->FvHandle,\r
                                   &PeiCoreFileHandle\r
                                   );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
   if (!EFI_ERROR (Status)) {\r
-    Status = CoreFvHandle.FvPpi->GetFileInfo (CoreFvHandle.FvPpi, PeiCoreFileHandle, &FileInfo);\r
+    Status = CoreFvHandle->FvPpi->GetFileInfo (CoreFvHandle->FvPpi, PeiCoreFileHandle, &FileInfo);\r
     ASSERT_EFI_ERROR (Status);\r
 \r
     Status = PeiGetPe32Data (PeiCoreFileHandle, &PeiCoreImageBase);\r