From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.groups.io with SMTP id smtpd.web09.2141.1606855129688416225 for ; Tue, 01 Dec 2020 12:38:49 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LQnKRvOx; spf=pass (domain: redhat.com, ip: 216.205.24.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606855128; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ltSIlxuRrq7pvvhiXv4JH+nVlIQrfqrmCs2wCzb7Lno=; b=LQnKRvOxCHEC9EE6EzSpuJbXpLkguDQw6Oh8gE3nsg/JFkWCkEQ5j2CLvoB4QxfXFUJ+EJ WpFKFsRLGc3ykxOl8Y+L+uCBasmayu8Bm6dxKJN4A3z9lcrXoVbk93LeWPLr5aqyZx3Tkd q5FHnF5+zhZCUt+/TCQTFEJ+cqPF8wI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-525-CbW6yvsoP4ep2hFL7DgceA-1; Tue, 01 Dec 2020 15:38:43 -0500 X-MC-Unique: CbW6yvsoP4ep2hFL7DgceA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BB150185E48B; Tue, 1 Dec 2020 20:38:40 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-112-239.ams2.redhat.com [10.36.112.239]) by smtp.corp.redhat.com (Postfix) with ESMTP id 25EB35C1B4; Tue, 1 Dec 2020 20:38:38 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH] MdeModulePkg: Fix undefined reference to memcpy with XCODE5 To: devel@edk2.groups.io, cheptsov@ispras.ru Cc: Jian J Wang , Hao A Wu , Jordan Justen , Ard Biesheuvel References: <20201201182651.32218-1-cheptsov@ispras.ru> From: "Laszlo Ersek" Message-ID: Date: Tue, 1 Dec 2020 21:38:35 +0100 MIME-Version: 1.0 In-Reply-To: <20201201182651.32218-1-cheptsov@ispras.ru> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 12/01/20 19:26, Vitaly Cheptsov wrote: > 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 > 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 = 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; 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 = 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); >