Is there a legitimate reason not to define memcpy? It'd be easier to do so and comply to the compiler's requirements. On Wed, 25 May 2022, 23:38 Yao, Jiewen, wrote: > Hi > > Would you please use CopyMem() for the structure assignment? > > VgpuGop->GopModeInfo = *GopModeInfo; > > > > That is best known method to resolve memcpy symbol issue. > > > > Thank you > > Yao Jiewen > > > > > > *From:* Pedro Falcato > *Sent:* Thursday, May 26, 2022 1:01 AM > *To:* Ard Biesheuvel > *Cc:* edk2-devel-groups-io ; Rebecca Cran < > quic_rcran@quicinc.com>; Ard Biesheuvel ; Yao, > Jiewen ; Justen, Jordan L ; > Gerd Hoffmann > *Subject:* Re: [edk2-devel] OvmfPkgX64 doesn't build with CLANG38 (clang > 14.0.3) NOOPT - undefined reference to `memcpy' > > > > On Wed, May 25, 2022 at 5:45 PM Ard Biesheuvel wrote: > > On Wed, 25 May 2022 at 18:44, Pedro Falcato > wrote: > > > > > > > > On Wed, May 25, 2022 at 4:50 PM Ard Biesheuvel wrote: > >> > >> On Wed, 25 May 2022 at 17:08, Rebecca Cran > wrote: > >> > > >> > I noticed OvmfPkg/OvmfPkgX64.dsc doesn't build with `-t CLANG38 -b > >> > NOOPT` (with clang version 14.0.2) with the latest edk2 master > >> > (07c0c2eb0a5970db614ebce1060fc79d6904bdfd): > >> > > >> > make: Nothing to be done for 'tbuild'. > >> > /usr/bin/ld: /usr/bin/ld: DWARF error: invalid or unhandled FORM > value: > >> > 0x23 > >> > > /home/bcran/src/upstream/uefi/edk2/Build/OvmfX64/NOOPT_CLANG38/X64/OvmfPkg/VirtioGpuDxe/VirtioGpu/OUTPUT/VirtioGpuDxe.lib(Gop.obj): > >> > in function `GopSetMode': > >> > Gop.c:(.text.GopSetMode+0x418): undefined reference to `memcpy' > >> > >> Can you dump the object file to see where the memcpy() call is emitted? > > > > I think I found the smoking gun: > https://github.com/tianocore/edk2/blob/916f90baa547b3ebef8fa87c530e2f0c8e35e1e3/OvmfPkg/VirtioGpuDxe/Gop.c#L512 > > Indeed. We don't support struct assignment in Tianocore code, exactly > for this reason. > > Note: We should think about providing some basic libc functions in base > EDK2 as some are required by the clang/GCC compilers (see > https://gcc.gnu.org/onlinedocs/gcc/Standards.html, grep for memcpy or > freestanding). > > Passing -ffreestanding would also be a good idea as to let the compiler > know it's dealing with a freestanding environment vs a hosted user-space > one. > > > > All the best, > > Pedro >