public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Vitaly Cheptsov" <cheptsov@ispras.ru>
To: devel@edk2.groups.io
Cc: Vitaly Cheptsov <cheptsov@ispras.ru>,
	Jian J Wang <jian.j.wang@intel.com>,
	Hao A Wu <hao.a.wu@intel.com>,
	Jordan Justen <jordan.l.justen@intel.com>,
	Laszlo Ersek <lersek@redhat.com>,
	Ard Biesheuvel <ard.biesheuvel@arm.com>
Subject: [PATCH] MdeModulePkg: Fix undefined reference to memcpy with XCODE5
Date: Tue,  1 Dec 2020 21:26:51 +0300	[thread overview]
Message-ID: <20201201182651.32218-1-cheptsov@ispras.ru> (raw)

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>
---
 MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c |  4 ++--
 MdeModulePkg/Core/Pei/PeiMain.h               |  2 +-
 MdeModulePkg/Core/Pei/Ppi/Ppi.c               | 10 +++++-----
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
index b9a279e..3369585 100644
--- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
+++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
@@ -1256,13 +1256,13 @@ EvacuateTempRam (
   }
   for (FvIndex = 0; FvIndex < Private->FvCount; FvIndex++) {
     if (Private->Fv[FvIndex].FvHandle == PeiCoreFvHandle.FvHandle) {
-      PeiCoreFvHandle = Private->Fv[FvIndex];
+      CopyMem (&PeiCoreFvHandle, &Private->Fv[FvIndex], sizeof (PEI_CORE_FV_HANDLE));
       break;
     }
   }
   Status = EFI_SUCCESS;
 
-  ConvertPeiCorePpiPointers (Private, PeiCoreFvHandle);
+  ConvertPeiCorePpiPointers (Private, &PeiCoreFvHandle);
 
   for (FvIndex = 0; FvIndex < Private->FvCount; FvIndex++) {
     FvHeader = Private->Fv[FvIndex].FvHeader;
diff --git a/MdeModulePkg/Core/Pei/PeiMain.h b/MdeModulePkg/Core/Pei/PeiMain.h
index c27e8fc..daa48b4 100644
--- a/MdeModulePkg/Core/Pei/PeiMain.h
+++ b/MdeModulePkg/Core/Pei/PeiMain.h
@@ -542,7 +542,7 @@ ConvertPpiPointersFv (
 VOID
 ConvertPeiCorePpiPointers (
   IN  PEI_CORE_INSTANCE        *PrivateData,
-  PEI_CORE_FV_HANDLE           CoreFvHandle
+  IN  PEI_CORE_FV_HANDLE       *CoreFvHandle
   );
 
 /**
diff --git a/MdeModulePkg/Core/Pei/Ppi/Ppi.c b/MdeModulePkg/Core/Pei/Ppi/Ppi.c
index 541047d..0ad71d1 100644
--- a/MdeModulePkg/Core/Pei/Ppi/Ppi.c
+++ b/MdeModulePkg/Core/Pei/Ppi/Ppi.c
@@ -1062,7 +1062,7 @@ ProcessPpiListFromSec (
 VOID
 ConvertPeiCorePpiPointers (
   IN  PEI_CORE_INSTANCE        *PrivateData,
-  PEI_CORE_FV_HANDLE           CoreFvHandle
+  IN  PEI_CORE_FV_HANDLE       *CoreFvHandle
   )
 {
   EFI_FV_FILE_INFO      FileInfo;
@@ -1079,16 +1079,16 @@ ConvertPeiCorePpiPointers (
   //
   // Find the PEI Core in the BFV in temporary memory.
   //
-  Status =  CoreFvHandle.FvPpi->FindFileByType (
-                                  CoreFvHandle.FvPpi,
+  Status =  CoreFvHandle->FvPpi->FindFileByType (
+                                  CoreFvHandle->FvPpi,
                                   EFI_FV_FILETYPE_PEI_CORE,
-                                  CoreFvHandle.FvHandle,
+                                  CoreFvHandle->FvHandle,
                                   &PeiCoreFileHandle
                                   );
   ASSERT_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);
 
     Status = PeiGetPe32Data (PeiCoreFileHandle, &PeiCoreImageBase);
-- 
2.24.3 (Apple Git-128)


             reply	other threads:[~2020-12-01 18:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01 18:26 Vitaly Cheptsov [this message]
2020-12-01 20:38 ` [edk2-devel] [PATCH] MdeModulePkg: Fix undefined reference to memcpy with XCODE5 Laszlo Ersek
2020-12-02  0:52   ` 回复: " gaoliming
2020-12-02  1:29     ` Michael D Kinney
2020-12-04  1:32       ` 回复: " gaoliming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201201182651.32218-1-cheptsov@ispras.ru \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox