[edk2-devel] [edk2-platforms][PATCH v1 2/7] Platform/Sgi: add no-stack-protector flag for StMM builds

Prabin CA posted 7 patches 1 year, 5 months ago
There is a newer version of this series
[edk2-devel] [edk2-platforms][PATCH v1 2/7] Platform/Sgi: add no-stack-protector flag for StMM builds
Posted by Prabin CA 1 year, 5 months ago
Add the no-stack-protector compiler flag to allow StandaloneMM builds
on both AArch64 and x86 host. Without this flag, the link stage fails
with the following errors on multiple files when built with gcc
(Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0:

undefined reference to `__stack_chk_guard'
undefined reference to `__stack_chk_fail'

Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
Signed-off-by: Prabin CA <prabin.ca@arm.com>
---
 Platform/ARM/SgiPkg/SgiPlatformMm.dsc.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Platform/ARM/SgiPkg/SgiPlatformMm.dsc.inc b/Platform/ARM/SgiPkg/SgiPlatformMm.dsc.inc
index ab54b3b25f4c..2a8c678c0816 100644
--- a/Platform/ARM/SgiPkg/SgiPlatformMm.dsc.inc
+++ b/Platform/ARM/SgiPkg/SgiPlatformMm.dsc.inc
@@ -145,5 +145,5 @@ [Components.AARCH64]
 #
 ###################################################################################################
 [BuildOptions.AARCH64]
-  GCC:*_*_*_CC_FLAGS = -mstrict-align -march=armv8-a -D DISABLE_NEW_DEPRECATED_INTERFACES
+  GCC:*_*_*_CC_FLAGS = -mstrict-align -march=armv8-a -fno-stack-protector -D DISABLE_NEW_DEPRECATED_INTERFACES
   GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113189): https://edk2.groups.io/g/devel/message/113189
Mute This Topic: https://groups.io/mt/103528421/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [edk2-platforms][PATCH v1 2/7] Platform/Sgi: add no-stack-protector flag for StMM builds
Posted by Rebecca Cran via groups.io 1 year, 5 months ago
Wouldn't it be better to add the Stack Protector library 
(MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf) instead of 
disabling it?

-- 
Rebecca Cran


On 1/4/2024 11:49 AM, Prabin CA via groups.io wrote:
> Add the no-stack-protector compiler flag to allow StandaloneMM builds
> on both AArch64 and x86 host. Without this flag, the link stage fails
> with the following errors on multiple files when built with gcc
> (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0:
> 
> undefined reference to `__stack_chk_guard'
> undefined reference to `__stack_chk_fail'
> 
> Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
> Signed-off-by: Prabin CA <prabin.ca@arm.com>
> ---
>   Platform/ARM/SgiPkg/SgiPlatformMm.dsc.inc | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Platform/ARM/SgiPkg/SgiPlatformMm.dsc.inc b/Platform/ARM/SgiPkg/SgiPlatformMm.dsc.inc
> index ab54b3b25f4c..2a8c678c0816 100644
> --- a/Platform/ARM/SgiPkg/SgiPlatformMm.dsc.inc
> +++ b/Platform/ARM/SgiPkg/SgiPlatformMm.dsc.inc
> @@ -145,5 +145,5 @@ [Components.AARCH64]
>   #
>   ###################################################################################################
>   [BuildOptions.AARCH64]
> -  GCC:*_*_*_CC_FLAGS = -mstrict-align -march=armv8-a -D DISABLE_NEW_DEPRECATED_INTERFACES
> +  GCC:*_*_*_CC_FLAGS = -mstrict-align -march=armv8-a -fno-stack-protector -D DISABLE_NEW_DEPRECATED_INTERFACES
>     GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113199): https://edk2.groups.io/g/devel/message/113199
Mute This Topic: https://groups.io/mt/103528421/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-