Failed to build edk2: undefined reference to `__stack_chk_guard'

I am trying to build recovery binaries for Hikey970 using the instruction at https://www.96boards.org/documentation/consumer/hikey/hikey970/installation/board-recovery.md.html.

I get the below failure. Please help to resolve the issues

/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/ArmPlatformPkg/PrePi/PeiUniCore/OUTPUT/ArmPlatformPrePiUniCore.lib(PrePi.obj): In function `GetPlatformPpi':
/home/auto-sae/workfolder/hikey970/recovery/edk2/ArmPlatformPkg/PrePi/PrePi.c:55: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/ArmPlatformPkg/PrePi/PrePi.c:55: undefined reference to `__stack_chk_guard'
.
.
/BaseDebugLibSerialPort.lib(DebugLib.obj): In function `DebugPrint':
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c:72: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c:72: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c:99: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c:99: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c:99: undefined reference to `__stack_chk_fail'
/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort/OUTPUT/BaseDebugLibSerialPort.lib(DebugLib.obj): In function `DebugAssert':
.
.
Building ... /home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf [AARCH64]
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiHobLib/Hob.c:816: undefined reference to `__stack_chk_fail'
/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib/OUTPUT/PrePiHobLib.lib(Hob.obj): In function `BuildMemoryTypeInformationHob':
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiHobLib/Hob.c:823: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiHobLib/Hob.c:823: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiHobLib/Hob.c:851: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiHobLib/Hob.c:851: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiHobLib/Hob.c:851: undefined reference to `__stack_chk_fail'
/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib/OUTPUT/PeiPerformanceLib.lib(PeiPerformanceLib.obj): In function `InternalGetPerformanceHobLog':
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c:52: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c:52: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c:87: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c:87: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c:87: undefined reference to `__stack_chk_fail'
/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib/OUTPUT/PeiPerformanceLib.lib(PeiPerformanceLib.obj): In function `StartPerformanceMeasurementEx':
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c:182: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c:182: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c:219: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c:219: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c:219: undefined reference to `__stack_chk_fail'
/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/MdePkg/Library/BasePeCoffLib/BasePeCoffLib/OUTPUT/BasePeCoffLib.lib(BasePeCoff.obj): In function `PeCoffLoaderGetPeHeader':
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:99: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:99: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:558: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:558: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:558: undefined reference to `__stack_chk_fail'
/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/MdePkg/Library/BasePeCoffLib/BasePeCoffLib/OUTPUT/BasePeCoffLib.lib(BasePeCoff.obj): In function `PeCoffLoaderGetImageInfo':
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:594: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:594: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:873: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:873: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:873: undefined reference to `__stack_chk_fail'
/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/MdePkg/Library/BasePeCoffLib/BasePeCoffLib/OUTPUT/BasePeCoffLib.lib(BasePeCoff.obj): In function `PeCoffLoaderRelocateImage':
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:939: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:939: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:1182: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:1182: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:1182: undefined reference to `__stack_chk_fail'
/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/MdePkg/Library/BasePeCoffLib/BasePeCoffLib/OUTPUT/BasePeCoffLib.lib(BasePeCoff.obj): In function `PeCoffLoaderLoadImage':
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:1220: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:1220: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:1672: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:1672: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:1672: undefined reference to `__stack_chk_fail'
/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/MdePkg/Library/BasePeCoffLib/BasePeCoffLib/OUTPUT/BasePeCoffLib.lib(BasePeCoff.obj): In function `PeCoffLoaderRelocateImageForRuntime':
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:1706: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:1706: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:1886: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:1886: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:1886: undefined reference to `__stack_chk_fail'
/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib/OUTPUT/PrePiExtractGuidedSectionLib.lib(PrePiExtractGuidedSectionLib.obj): In function `GetSavedData':
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.c:35: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.c:35: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.c:43: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.c:43: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.c:43: undefined reference to `__stack_chk_fail'
/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib/OUTPUT/PrePiExtractGuidedSectionLib.lib(PrePiExtractGuidedSectionLib.obj): In function `ExtractGuidedSectionLibConstructor':
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.c:217: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.c:217: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.c:247: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.c:247: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.c:247: undefined reference to `__stack_chk_fail'
/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/EmbeddedPkg/Library/PrePiLib/PrePiLib/OUTPUT/PrePiLib.lib(PrePiLib.obj): In function `LoadPeCoffImage':
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/PrePiLib.c:40: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/PrePiLib.c:40: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/PrePiLib.c:87: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/PrePiLib.c:87: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/PrePiLib.c:87: undefined reference to `__stack_chk_fail'
/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/EmbeddedPkg/Library/PrePiLib/PrePiLib/OUTPUT/PrePiLib.lib(PrePiLib.obj): In function `LoadDxeCoreFromFfsFile':
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/PrePiLib.c:103: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/PrePiLib.c:103: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/PrePiLib.c:173: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/PrePiLib.c:173: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/PrePiLib.c:173: undefined reference to `__stack_chk_fail'
/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/EmbeddedPkg/Library/PrePiLib/PrePiLib/OUTPUT/PrePiLib.lib(PrePiLib.obj): In function `LoadDxeCoreFromFv':
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/PrePiLib.c:183: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/PrePiLib.c:183: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/PrePiLib.c:205: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/PrePiLib.c:205: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/PrePiLib.c:205: undefined reference to `__stack_chk_fail'
/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/EmbeddedPkg/Library/PrePiLib/PrePiLib/OUTPUT/PrePiLib.lib(PrePiLib.obj): In function `DecompressFirstFv':
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/PrePiLib.c:213: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/PrePiLib.c:213: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/PrePiLib.c:224: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/PrePiLib.c:224: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/PrePiLib.c:224: undefined reference to `__stack_chk_fail'
/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/EmbeddedPkg/Library/PrePiLib/PrePiLib/OUTPUT/PrePiLib.lib(FwVol.obj): In function `FfsProcessSection':
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/FwVol.c:294: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/FwVol.c:294: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/FwVol.c:413: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/FwVol.c:413: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/FwVol.c:413: undefined reference to `__stack_chk_fail'
/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/EmbeddedPkg/Library/PrePiLib/PrePiLib/OUTPUT/PrePiLib.lib(FwVol.obj): In function `FfsGetFileInfo':
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/FwVol.c:595: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/FwVol.c:595: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/FwVol.c:639: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/FwVol.c:639: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/FwVol.c:639: undefined reference to `__stack_chk_fail'
/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/EmbeddedPkg/Library/PrePiLib/PrePiLib/OUTPUT/PrePiLib.lib(FwVol.obj): In function `FfsGetVolumeInfo':
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/FwVol.c:664: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/FwVol.c:664: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/FwVol.c:694: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/FwVol.c:694: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/FwVol.c:694: undefined reference to `__stack_chk_fail'
/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/EmbeddedPkg/Library/PrePiLib/PrePiLib/OUTPUT/PrePiLib.lib(FwVol.obj): In function `FfsProcessFvFile':
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/FwVol.c:761: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/FwVol.c:761: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/FwVol.c:843: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/FwVol.c:843: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/EmbeddedPkg/Library/PrePiLib/FwVol.c:843: undefined reference to `__stack_chk_fail'
/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/OpenPlatformPkg/Platforms/Hisilicon/HiKey970/Library/HiKey970Lib/HiKey970Lib/OUTPUT/HiKey970Lib.lib(HiKey970.obj): In function `ArmPlatformInitialize':
/home/auto-sae/workfolder/hikey970/recovery/edk2/OpenPlatformPkg/Platforms/Hisilicon/HiKey970/Library/HiKey970Lib/HiKey970.c:110: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/OpenPlatformPkg/Platforms/Hisilicon/HiKey970/Library/HiKey970Lib/HiKey970.c:110: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/OpenPlatformPkg/Platforms/Hisilicon/HiKey970/Library/HiKey970Lib/HiKey970.c:142: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/OpenPlatformPkg/Platforms/Hisilicon/HiKey970/Library/HiKey970Lib/HiKey970.c:142: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/OpenPlatformPkg/Platforms/Hisilicon/HiKey970/Library/HiKey970Lib/HiKey970.c:142: undefined reference to `__stack_chk_fail'
/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib/OUTPUT/ArmMmuBaseLib.lib(ArmMmuLibCore.obj): In function `GetBlockEntryListFromAddress':
/home/auto-sae/workfolder/hikey970/recovery/edk2/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c:197: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c:197: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c:349: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c:349: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c:349: undefined reference to `__stack_chk_fail'
/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib/OUTPUT/ArmMmuBaseLib.lib(ArmMmuLibCore.obj): In function `UpdateRegionMapping':
/home/auto-sae/workfolder/hikey970/recovery/edk2/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c:360: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c:360: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c:409: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c:409: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c:409: undefined reference to `__stack_chk_fail'
/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib/OUTPUT/ArmMmuBaseLib.lib(ArmMmuLibCore.obj): In function `ArmConfigureMmu':
/home/auto-sae/workfolder/hikey970/recovery/edk2/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c:554: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c:554: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c:727: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c:727: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c:727: undefined reference to `__stack_chk_fail'
/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib/OUTPUT/LzmaDecompressLib.lib(LzmaDecompress.obj): In function `LzmaUefiDecompress':
/home/auto-sae/workfolder/hikey970/recovery/edk2/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaDecompress.c:187: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaDecompress.c:187: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaDecompress.c:219: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaDecompress.c:219: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaDecompress.c:219: undefined reference to `__stack_chk_fail'
/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib/OUTPUT/LzmaDecompressLib.lib(LzmaDec.obj): In function `LzmaDec_AllocateProbs':
/home/auto-sae/workfolder/hikey970/recovery/edk2/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzmaDec.c:1039: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzmaDec.c:1039: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzmaDec.c:1045: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzmaDec.c:1045: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzmaDec.c:1045: undefined reference to `__stack_chk_fail'
make: Nothing to be done for 'tbuild'.
/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib/OUTPUT/LzmaDecompressLib.lib(LzmaDec.obj): In function `LzmaDecode':
GNUmakefile:421: recipe for target '/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/ArmPlatformPkg/PrePi/PeiUniCore/DEBUG/ArmPlatformPrePiUniCore.dll' failed
/home/auto-sae/workfolder/hikey970/recovery/edk2/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzmaDec.c:1082: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzmaDec.c:1082: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzmaDec.c:1102: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzmaDec.c:1102: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzmaDec.c:1102: undefined reference to `__stack_chk_fail'
/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib/OUTPUT/ArmMemoryInitPeiLib.lib(MemoryInitPeiLib.obj): In function `InitMmu':
/home/auto-sae/workfolder/hikey970/recovery/edk2/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c:34: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c:34: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c:46: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c:46: undefined reference to `__stack_chk_guard'
/home/auto-sae/workfolder/hikey970/recovery/edk2/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c:46: undefined reference to `__stack_chk_fail'
/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib/OUTPUT/ArmMemoryInitPeiLib.lib(MemoryInitPeiLib.obj): In function `MemoryPeim':

.
.
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c:258: undefined reference to __stack_chk_guard' /home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c:258: undefined reference to __stack_chk_guard’
/home/auto-sae/workfolder/hikey970/recovery/edk2/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c:258: undefined reference to __stack_chk_fail' /home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/OpenPlatformPkg/Platforms/Hisilicon/HiKey970/Library/HiKey970Lib/HiKey970Lib/OUTPUT/HiKey970Lib.lib(HiKey970Mem.obj): In function ArmPlatformGetVirtualMemoryMap’:
/home/auto-sae/workfolder/hikey970/recovery/edk2/OpenPlatformPkg/Platforms/Hisilicon/HiKey970/Library/HiKey970Lib/HiKey970Mem.c:86: undefined reference to __stack_chk_guard' /home/auto-sae/workfolder/hikey970/recovery/edk2/OpenPlatformPkg/Platforms/Hisilicon/HiKey970/Library/HiKey970Lib/HiKey970Mem.c:86: undefined reference to __stack_chk_guard’
/home/auto-sae/workfolder/hikey970/recovery/edk2/OpenPlatformPkg/Platforms/Hisilicon/HiKey970/Library/HiKey970Lib/HiKey970Mem.c:258: undefined reference to __stack_chk_guard' /home/auto-sae/workfolder/hikey970/recovery/edk2/OpenPlatformPkg/Platforms/Hisilicon/HiKey970/Library/HiKey970Lib/HiKey970Mem.c:258: undefined reference to __stack_chk_guard’
/home/auto-sae/workfolder/hikey970/recovery/edk2/OpenPlatformPkg/Platforms/Hisilicon/HiKey970/Library/HiKey970Lib/HiKey970Mem.c:258: undefined reference to `__stack_chk_fail’
collect2: error: ld returned 1 exit status
make: *** [/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/ArmPlatformPkg/PrePi/PeiUniCore/DEBUG/ArmPlatformPrePiUniCore.dll] Error 1

build.py...
 : error 7000: Failed to execute command
	make tbuild [/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/AARCH64/ArmPlatformPkg/PrePi/PeiUniCore]


build.py...
 : error F002: Failed to build module
	/home/auto-sae/workfolder/hikey970/recovery/edk2/ArmPlatformPkg/PrePi/PeiUniCore.inf [AARCH64, GCC5, DEBUG]

- Failed -
Build end time: 13:29:53, Jul.23 2020
Build total time: 00:00:07

------------------------------------------------------------
                                         Hikey970 DEBUG	fail
------------------------------------------------------------
pass	0
fail	1
#### Generating l-loader.bin
make -f hikey970.mk
make[1]: Entering directory '/home/auto-sae/workfolder/hikey970/recovery/l-loader'
make[1]: *** No rule to make target 'bl1.bin', needed by 'l-loader.bin'.  Stop.
make[1]: Leaving directory '/home/auto-sae/workfolder/hikey970/recovery/l-loader'
Makefile:19: recipe for target 'hikey970' failed
make: *** [hikey970] Error 2
#### Copying generated binaries
cp: cannot stat '/home/auto-sae/workfolder/hikey970/recovery/edk2/Build/HiKey970/DEBUG_GCC5/FV/fip.bin': No such file or directory
cp: cannot stat '/home/auto-sae/workfolder/hikey970/recovery/l-loader/l-loader.bin': No such file or directory

The issue was because of the compiler.
I fixed it after using gcc-linaro-5.5.0-2017.10-x86_64_aarch64-linux- gnu