Hi,

I made SavedDataGuid STATIC and issue goes away with this. 
Thanks for your help :)


Any pointer for similar error in PrintLib.c:
/home/tools/meenakshi/edk2/MdePkg/Library/BasePrintLib/PrintLib.c:415: 
undefined reference to `memcpy'

Issue is coming on calling BasePrintLibSPrintMarker:

UINTN
EFIAPI
AsciiVSPrint (
  OUT CHAR8         *StartOfBuffer,
  IN  UINTN         BufferSize,
  IN  CONST CHAR8   *FormatString,
  IN  VA_LIST       Marker
  )
{
  return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, 0, FormatString, 
Marker, NULL);
}


Thanks,
Meenakshi

-----Original Message---- -
From: [email protected] [mailto:[email protected]] 
Sent: Thursday, May 12, 2016 12:23 PM
To: Meenakshi Aggarwal <[email protected]>
Cc: [email protected]
Subject: Re: [edk2] facing compilation failure : undefined reference to memcpy()


> On May 11, 2016, at 11:45 PM, Meenakshi Aggarwal <[email protected]> 
> wrote:
> 
> Hi,
> 
> I am working on a 64 bit arm based SoC.
> 
> I am uprev'ing my edk2 code base to latest master branch:
> Commit id -  ce1647fc608e8193b416a08da633019de611199c
> 
> 
> I am able to compile my code successfully in DEBUG mode but in RELEASE mode I 
> am facing following error:
> 
> 
> Building ... 
> /home/tools/meenakshi/edk2/LS2080aRdbPkg/Library/LS2080aPrePi/PeiMPCor
> e.inf [AARCH64] "aarch64-linux-gnu-ld" -o 
> /home/tools/meenakshi/edk2/Build/LS2080aRdb/RELEASE_GCC48/AARCH64/LS20
> 80aRdbPkg/Library/LS2080aPrePi/PeiMPCore/DEBUG/ArmPlatformPrePiMPCore.
> dll --emit-relocs -nostdlib --gc-sections -u _ModuleEntryPoint -e 
> _ModuleEntryPoint -Map 
> /home/tools/meenakshi/edk2/Build/LS2080aRdb/RELEASE_GCC48/AARCH64/LS20
> 80aRdbPkg/Library/LS2080aPrePi/PeiMPCore/DEBUG/ArmPlatformPrePiMPCore.
> map -z common-page-size=0x20 --start-group  
> @/home/tools/meenakshi/edk2/Build/LS2080aRdb/RELEASE_GCC48/AARCH64/LS2
> 080aRdbPkg/Library/LS2080aPrePi/PeiMPCore/OUTPUT/static_library_files.
> lst --end-group 
> --script=/home/tools/meenakshi/edk2/BaseTools/Scripts/GccBase.lds 
> --defsym=PECOFF_HEADER_SIZE=0x228
> /home/tools/meenakshi/edk2/Build/LS2080aRdb/RELEASE_GCC48/AARCH64/MdePkg/Library/BasePrintLib/BasePrintLib/OUTPUT/BasePrintLib.lib(PrintLib.obj):
>  In function `AsciiVSPrint':
> /home/tools/meenakshi/edk2/MdePkg/Library/BasePrintLib/PrintLib.c:415: 
> undefined reference to `memcpy'
> /home/tools/meenakshi/edk2/Build/LS2080aRdb/RELEASE_GCC48/AARCH64/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib/OUTPUT/PrePiExtractGuidedSectionLib.lib(PrePiExtractGuidedSectionLib.obj):
>  In function `GetSavedData':
> /home/tools/meenakshi/edk2/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.c:37:
>  undefined reference to `memcpy'
> /home/tools/meenakshi/edk2/Build/LS2080aRdb/RELEASE_GCC48/AARCH64/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib/OUTPUT/PrePiExtractGuidedSectionLib.lib(PrePiExtractGuidedSectionLib.obj):
>  In function `ExtractGuidedSectionLibConstructor':
> /home/tools/meenakshi/edk2/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.c:219:
>  undefined reference to `memcpy'
> make: *** 
> [/home/tools/meenakshi/edk2/Build/LS2080aRdb/RELEASE_GCC48/AARCH64/LS2
> 080aRdbPkg/Library/LS2080aPrePi/PeiMPCore/DEBUG/ArmPlatformPrePiMPCore
> .dll] Error 1
> 

This looks like a bug. The edk2 does not provide memcpy(), and the compiler 
will sometime generate a memcpy() call for an assignment that > 64 bits. It 
kind of all depends on what the optimizer does. 

The error points to a GUID being assigned with =, and sizeof(GUID) == 16. 

PRE_PI_EXTRACT_GUIDED_SECTION_DATA *
GetSavedData (
  VOID
  )
{
  EFI_HOB_GUID_TYPE *GuidHob;
  GUID              SavedDataGuid = PRE_PI_EXTRACT_GUIDED_SECTION_DATA_GUID;

I would guess if you make SavedDataGuid static, or global the issue will go 
away. 

Thanks,

Andrew Fish


> 
> Please help what I am missing in my board package, some header file or 
> library or anything else.
> I tried compiling it with both AARCH64 toolchains gcc-4.8 and gcc-4.9, but no 
> gain.
> 
> Thanks,
> Meenakshi
> 
> 
> _______________________________________________
> edk2-devel mailing list
> [email protected]
> https://lists.01.org/mailman/listinfo/edk2-devel

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to