From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web08.8019.1607045532955372055 for ; Thu, 03 Dec 2020 17:32:13 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: gaoliming@byosoft.com.cn) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Fri, 04 Dec 2020 09:32:07 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , , , Cc: "'Wang, Jian J'" , "'Wu, Hao A'" , "'Justen, Jordan L'" , "'Ard Biesheuvel'" References: <20201201182651.32218-1-cheptsov@ispras.ru> <011401d6c845$6f06e5f0$4d14b1d0$@byosoft.com.cn> In-Reply-To: Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1BBVENIXSBNZGVNb2R1bGVQa2c6IEZpeCB1bmRlZmluZWQgcmVmZXJlbmNlIHRvIG1lbWNweSB3aXRoIFhDT0RFNQ==?= Date: Fri, 4 Dec 2020 09:32:08 +0800 Message-ID: <009801d6c9dd$47ccfc60$d766f520$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQGeSAkaSgvbZ1L+IJn8XDdnuX1rzAEygXFuAs5vic4C6ELS5Kof4NSg Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Create PR for this patch https://github.com/tianocore/edk2/pull/1177 Thanks Liming > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > =E5=8F=91=E4=BB=B6=E4=BA=BA: bounce+27952+68153+4905953+8761045@groups.i= o > =E4=BB=A3=E8=A1=A8 Michae= l D > Kinney > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2020=E5=B9=B412=E6=9C=882=E6=97=A5= 9:30 > =E6=94=B6=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io; gaoliming@byosoft.com= .cn; > lersek@redhat.com; cheptsov@ispras.ru; Kinney, Michael D > > =E6=8A=84=E9=80=81: Wang, Jian J ; Wu, Hao A > ; Justen, Jordan L ; 'Ard > Biesheuvel' > =E4=B8=BB=E9=A2=98: Re: [edk2-devel] [PATCH] MdeModulePkg: Fix undefined= reference to > memcpy with XCODE5 >=20 > I agree. There were 2 issues here: >=20 > 1) Passing a structure a function parameter > 2) Structure assignment >=20 > Reviewed-by: Michael D Kinney >=20 >=20 > Mike >=20 > > -----Original Message----- > > From: devel@edk2.groups.io On Behalf Of > gaoliming > > Sent: Tuesday, December 1, 2020 4:53 PM > > To: devel@edk2.groups.io; lersek@redhat.com; cheptsov@ispras.ru > > Cc: Wang, Jian J ; Wu, Hao A > ; Justen, Jordan L ; > > 'Ard Biesheuvel' > > Subject: =E5=9B=9E=E5=A4=8D: [edk2-devel] [PATCH] MdeModulePkg: Fix un= defined > reference to memcpy with XCODE5 > > > > I agree this fix. We should use the pointer to structure as the functi= on > parameter. > > > > Reviewed-by: Liming Gao > > > > Thanks > > Liming > > > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > > > =E5=8F=91=E4=BB=B6=E4=BA=BA: bounce+27952+68148+4905953+8761045@grou= ps.io > > > =E4=BB=A3=E8=A1=A8 La= szlo > Ersek > > > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2020=E5=B9=B412=E6=9C=882=E6= =97=A5 4:39 > > > =E6=94=B6=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io; cheptsov@ispras.r= u > > > =E6=8A=84=E9=80=81: Jian J Wang ; Hao A Wu > > > ; Jordan Justen ; Ard > > > Biesheuvel > > > =E4=B8=BB=E9=A2=98: Re: [edk2-devel] [PATCH] MdeModulePkg: Fix undef= ined reference > to > > > memcpy with XCODE5 > > > > > > On 12/01/20 19:26, Vitaly Cheptsov wrote: > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3098 > > > > > > > > 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 > > > > CC: Hao A Wu > > > > CC: Jordan Justen > > > > CC: Laszlo Ersek > > > > CC: Ard Biesheuvel > > > > Signed-off-by: Vitaly Cheptsov > > > > --- > > > > 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 =3D 0; FvIndex < Private->FvCount; FvIndex++) { > > > > if (Private->Fv[FvIndex].FvHandle =3D=3D PeiCoreFvHandle.FvHa= ndle) > { > > > > - PeiCoreFvHandle =3D Private->Fv[FvIndex]; > > > > + CopyMem (&PeiCoreFvHandle, &Private->Fv[FvIndex], sizeof > > > (PEI_CORE_FV_HANDLE)); > > > > break; > > > > } > > > > } > > > > Status =3D EFI_SUCCESS; > > > > > > I'm too tired to review this patch now (hello MdeModulePkg reviewers= ), > > > but the idea is correct -- "PeiCoreFvHandle" has type > > > PEI_CORE_FV_HANDLE, from "MdeModulePkg/Core/Pei/PeiMain.h", and > it is > > > a > > > structure type. Structure assignment is indeed not allowed in edk2. > > > > > > Thanks > > > Laszlo > > > > > > > > > > > - ConvertPeiCorePpiPointers (Private, PeiCoreFvHandle); > > > > + ConvertPeiCorePpiPointers (Private, &PeiCoreFvHandle); > > > > > > > > for (FvIndex =3D 0; FvIndex < Private->FvCount; FvIndex++) { > > > > FvHeader =3D 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 =3D CoreFvHandle.FvPpi->FindFileByType ( > > > > - CoreFvHandle.FvPpi, > > > > + Status =3D CoreFvHandle->FvPpi->FindFileByType ( > > > > + CoreFvHandle->FvPpi, > > > > > EFI_FV_FILETYPE_PEI_CORE, > > > > - CoreFvHandle.FvHandle, > > > > + CoreFvHandle->FvHandle, > > > > &PeiCoreFileHandle > > > > ); > > > > ASSERT_EFI_ERROR (Status); > > > > > > > > if (!EFI_ERROR (Status)) { > > > > - Status =3D CoreFvHandle.FvPpi->GetFileInfo (CoreFvHandle.FvPp= i, > > > PeiCoreFileHandle, &FileInfo); > > > > + Status =3D CoreFvHandle->FvPpi->GetFileInfo (CoreFvHandle->Fv= Ppi, > > > PeiCoreFileHandle, &FileInfo); > > > > ASSERT_EFI_ERROR (Status); > > > > > > > > Status =3D PeiGetPe32Data (PeiCoreFileHandle, > &PeiCoreImageBase); > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >=20 >=20 >=20 >=20 >=20