Re: [edk2] undefined reference to `__stack_chk_fail'

Subject: Re: [edk2] undefined reference to `__stack_chk_fail'

From: Shivamurthy Shastri <shiva.linuxworks@gmail.com>

To: edk2-devel@lists.sourceforge.net, Olivier Martin <olivier.martin@arm.com>

Date: 2012-12-12 02:18:00

Hi Olivier,

Patch worked for me. But I am using build command with "-b DEBUG" option.
This give me some "unused-but-set-variable" errors.
I think following changes in the patch should work:

diff --git a/ArmPlatformPkg/Documentation/patches/BaseTools-Pending-Patches.patch b/ArmPlatformPkg/Documentation/patches/BaseTools-Pending-Patches.patch
index fd91660..f64ccfb 100755
--- a/ArmPlatformPkg/Documentation/patches/BaseTools-Pending-Patches.patch
+++ b/ArmPlatformPkg/Documentation/patches/BaseTools-Pending-Patches.patch
@@ -86,7 +86,7 @@ Index: BaseTools/Conf/tools_def.template
- DEBUG_ARMLINUXGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARMGCC_CC_FLAGS) -Wno-address -O0
-RELEASE_ARMLINUXGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARMGCC_CC_FLAGS) -Wno-address -Wno-unused-but-set-variable
-+ DEBUG_ARMLINUXGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARMGCC_CC_FLAGS) -fno-stack-protector -mno-unaligned-access -O0
++ DEBUG_ARMLINUXGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARMGCC_CC_FLAGS) -fno-stack-protector -mno-unaligned-access -Wno-unused-but-set-variable -O0^M
+RELEASE_ARMLINUXGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARMGCC_CC_FLAGS) -fno-stack-protector -mno-unaligned-access -Wno-unused-but-set-variable
#################


--
Thanks and Regards,
Shiva.


On Mon, Oct 22, 2012 at 2:40 PM, Olivier Martin <olivier.martin@arm.com> wrote:
Hi Nicola,
If you apply the pending BaseTools patches:
patch -p0 <
ArmPlatformPkg/Documentation/patches/BaseTools-Pending-Patches.patch
that should solve your build errors.

The ARMLINUXGCC flags have been updated in the BaseTools repository but the
BaseTools have not been synced up with EDK2 repository for a while.

Olivier

-----Original Message-----
From: Nicola Johnsen [mailto:nicolajohnsen@yahoo.co.uk]
Sent: 22 October 2012 10:07
To: edk2-devel@lists.sourceforge.net
Subject: [edk2] undefined reference to `__stack_chk_fail'

Hi, I'm using the latest EDK2 code and I'm trying to build a boot loader for
the VE board with the Cortex-A15:

build -a ARM -p
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc -t ARMLINUXGCC

But I get the following error:

/code/uefi/tianocore/edk2/Build/ArmVExpress-RTSM-A15_MPCore/DEBUG_ARMLINUXGC
C/ARM/ArmPlatformPkg/Sec/Sec/OUTPUT/ArmPlatformSec.lib(Sec.obj): In function
`CEntryPoint':
/code/uefi/tianocore/edk2/ArmPlatformPkg/Sec/Sec.c:127: undefined reference
to `__stack_chk_fail'
/code/uefi/tianocore/edk2/ArmPlatformPkg/Sec/Sec.c:127: undefined reference
to `__stack_chk_guard'
/code/uefi/tianocore/edk2/Build/ArmVExpress-RTSM-A15_MPCore/DEBUG_ARMLINUXGC
C/ARM/MdePkg/Library/BasePrintLib/BasePrintLib/OUTPUT/BasePrintLib.lib(Print
LibInternal.obj): In function `BasePrintLibConvertValueToString':
/code/uefi/tianocore/edk2/MdePkg/Library/BasePrintLib/PrintLibInternal.c:268
: undefined reference to `__stack_chk_fail'
/code/uefi/tianocore/edk2/MdePkg/Library/BasePrintLib/PrintLibInternal.c:268
: undefined reference to `__stack_chk_guard'
/code/uefi/tianocore/edk2/Build/ArmVExpress-RTSM-A15_MPCore/DEBUG_ARMLINUXGC
C/ARM/MdePkg/Library/BasePrintLib/BasePrintLib/OUTPUT/BasePrintLib.lib(Print
LibInternal.obj): In function `BasePrintLibSPrintMarker':
/code/uefi/tianocore/edk2/MdePkg/Library/BasePrintLib/PrintLibInternal.c:426
: undefined reference to `__stack_chk_guard'
/code/uefi/tianocore/edk2/MdePkg/Library/BasePrintLib/PrintLibInternal.c:955
: undefined reference to `__stack_chk_fail'
/code/uefi/tianocore/edk2/MdePkg/Library/BasePrintLib/PrintLibInternal.c:955
: undefined reference to `__stack_chk_guard'
/code/uefi/tianocore/edk2/Build/ArmVExpress-RTSM-A15_MPCore/DEBUG_ARMLINUXGC
C/ARM/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort/OUTPUT/Ba
seDebugLibSerialPort.lib(DebugLib.obj): In function `DebugPrint':
/code/uefi/tianocore/edk2/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c:9
9: undefined reference to `__stack_chk_fail'
/code/uefi/tianocore/edk2/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c:9
9: undefined reference to `__stack_chk_guard'
/code/uefi/tianocore/edk2/Build/ArmVExpress-RTSM-A15_MPCore/DEBUG_ARMLINUXGC
C/ARM/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort/OUTPUT/Ba
seDebugLibSerialPort.lib(DebugLib.obj): In function `DebugAssert':
/code/uefi/tianocore/edk2/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c:1
51: undefined reference to `__stack_chk_fail'
/code/uefi/tianocore/edk2/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c:1
51: undefined reference to `__stack_chk_guard'
/code/uefi/tianocore/edk2/Build/ArmVExpress-RTSM-A15_MPCore/DEBUG_ARMLINUXGC
C/ARM/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib/OUT
PUT/DebugUnixPeCoffExtraActionLib.lib(DebugPeCoffExtraActionLib.obj): In
function `PeCoffLoaderRelocateImageExtraAction':
/code/uefi/tianocore/edk2/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCo
ffExtraActionLib.c:100: undefined reference to `__stack_chk_fail'
/code/uefi/tianocore/edk2/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCo
ffExtraActionLib.c:100: undefined reference to `__stack_chk_guard'
/code/uefi/tianocore/edk2/Build/ArmVExpress-RTSM-A15_MPCore/DEBUG_ARMLINUXGC
C/ARM/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib/OUT
PUT/DebugUnixPeCoffExtraActionLib.lib(DebugPeCoffExtraActionLib.obj): In
function `PeCoffLoaderUnloadImageExtraAction':
/code/uefi/tianocore/edk2/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCo
ffExtraActionLib.c:135: undefined reference to `__stack_chk_fail'
/code/uefi/tianocore/edk2/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCo
ffExtraActionLib.c:135: undefined reference to `__stack_chk_guard'
/code/uefi/tianocore/edk2/Build/ArmVExpress-RTSM-A15_MPCore/DEBUG_ARMLINUXGC
C/ARM/MdePkg/Library/BasePeCoffLib/BasePeCoffLib/OUTPUT/BasePeCoffLib.lib(Ba
sePeCoff.obj): In function `PeCoffLoaderGetPeHeader':
/code/uefi/tianocore/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:238:
undefined reference to `__stack_chk_guard'
/code/uefi/tianocore/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:423:
undefined reference to `__stack_chk_fail'
/code/uefi/tianocore/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:423:
undefined reference to `__stack_chk_guard'
/code/uefi/tianocore/edk2/Build/ArmVExpress-RTSM-A15_MPCore/DEBUG_ARMLINUXGC
C/ARM/MdePkg/Library/BasePeCoffLib/BasePeCoffLib/OUTPUT/BasePeCoffLib.lib(Ba
sePeCoff.obj): In function `PeCoffLoaderGetImageInfo':
/code/uefi/tianocore/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:615:
undefined reference to `__stack_chk_guard'
/code/uefi/tianocore/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:739:
undefined reference to `__stack_chk_fail'
/code/uefi/tianocore/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c:739:
undefined reference to `__stack_chk_guard'
/code/uefi/tianocore/edk2/Build/ArmVExpress-RTSM-A15_MPCore/DEBUG_ARMLINUXGC
C/ARM/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLibBa
se/OUTPUT/DefaultExceptionHandlerBaseLib.lib(DefaultExceptionHandler.obj):
In function `DefaultExceptionHandler':
/code/uefi/tianocore/edk2/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultE
xceptionHandler.c:233: undefined reference to `__stack_chk_guard'
/code/uefi/tianocore/edk2/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultE
xceptionHandler.c:268: undefined reference to `__stack_chk_fail'
/code/uefi/tianocore/edk2/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultE
xceptionHandler.c:268: undefined reference to `__stack_chk_guard'
make: ***
[/code/uefi/tianocore/edk2/Build/ArmVExpress-RTSM-A15_MPCore/DEBUG_ARMLINUXG
CC/ARM/ArmPlatformPkg/Sec/Sec/DEBUG/ArmPlatformSec.dll] Error 1


build.py...
: error 7000: Failed to execute command
make --no-print-directory tbuild
[/code/uefi/tianocore/edk2/Build/ArmVExpress-RTSM-A15_MPCore/DEBUG_ARMLINUXG
CC/ARM/ArmPlatformPkg/Sec/Sec]


build.py...
: error F002: Failed to build module
/code/uefi/tianocore/edk2/ArmPlatformPkg/Sec/Sec.inf [ARM, ARMLINUXGCC,
DEBUG]

- Failed -
Build end time: 10:00:09, Oct.22 2012
Build total time: 00:00:02

Any idea what the problem is?


Cheers, Nicola

----------------------------------------------------------------------------
--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel





------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel