Re: 回复: [edk2-devel] [PATCH 1/1] BaseTools: disable stack protector (gcc, AARCH64)

2022-04-20 Thread Oliver Steffen

On 20.04.2022 07:36, gaoliming wrote:

GCC Stack Protector options come from GCC4.9.3. But, there is GCC48 in
tools_def. I am not sure whether GCC48 is still used.


A valid point.

GCC 4.8 accepts -fno-stack-protector.
For IA32 and X64 this option is set in GCC48_$ARCH_CC_FLAGS.
Setting it for AARCH64 starting with GCC4.8 would be more consistent
than setting it for all versions by default.

Cheers,
 Oliver



Thanks
Liming


-邮件原件-
发件人: devel@edk2.groups.io  代表 Oliver Steffen
发送时间: 2022年4月19日 22:47
收件人: devel@edk2.groups.io
抄送: bob.c.f...@intel.com; gaolim...@byosoft.com.cn;
yuwei.c...@intel.com; Oliver Steffen 
主题: [edk2-devel] [PATCH 1/1] BaseTools: disable stack protector (gcc,
AARCH64)

Explicity disable the stack protection with
-fno-stack-protection for builds using GCC on
AARCH64.

The gcc on Ubuntu enables -fstack-protector-strong
by default starting with Ubuntu 21.10.

GenFw fails if stack protection is enabled.

Signed-off-by: Oliver Steffen 
---
 BaseTools/Conf/tools_def.template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Conf/tools_def.template
b/BaseTools/Conf/tools_def.template
index 9c310cf23d25..bd3edf0d219b 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -1872,7 +1872,7 @@ DEFINE GCC_IA32_CC_FLAGS   =
DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -
 DEFINE GCC_X64_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS)
-mno-red-zone -Wno-address -mno-stack-arg-probe
 DEFINE GCC_ARM_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS)
-mlittle-endian -mabi=aapcs -fno-short-enums -funsigned-char
-ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address
-mthumb -mfloat-abi=soft -fno-pic -fno-pie
 DEFINE GCC_ARM_CC_XIPFLAGS = -mno-unaligned-access
-DEFINE GCC_AARCH64_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS)
-mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char
-ffunction-sections -fdata-sections -Wno-address
-fno-asynchronous-unwind-tables -fno-unwind-tables -fno-pic -fno-pie
-ffixed-x18
+DEFINE GCC_AARCH64_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS)
-mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char
-ffunction-sections -fdata-sections -Wno-address
-fno-asynchronous-unwind-tables -fno-unwind-tables -fno-pic -fno-pie
-ffixed-x18 -fno-stack-protector
 DEFINE GCC_AARCH64_CC_XIPFLAGS = -mstrict-align
-mgeneral-regs-only
 DEFINE GCC_DLINK_FLAGS_COMMON  = -nostdlib --pie
 DEFINE GCC_DLINK2_FLAGS_COMMON =
-Wl,--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
--
2.35.1


















-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89118): https://edk2.groups.io/g/devel/message/89118
Mute This Topic: https://groups.io/mt/90574237/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




回复: [edk2-devel] [PATCH 1/1] BaseTools: disable stack protector (gcc, AARCH64)

2022-04-19 Thread gaoliming
GCC Stack Protector options come from GCC4.9.3. But, there is GCC48 in
tools_def. I am not sure whether GCC48 is still used.

Thanks
Liming

> -邮件原件-
> 发件人: devel@edk2.groups.io  代表 Oliver Steffen
> 发送时间: 2022年4月19日 22:47
> 收件人: devel@edk2.groups.io
> 抄送: bob.c.f...@intel.com; gaolim...@byosoft.com.cn;
> yuwei.c...@intel.com; Oliver Steffen 
> 主题: [edk2-devel] [PATCH 1/1] BaseTools: disable stack protector (gcc,
> AARCH64)
> 
> Explicity disable the stack protection with
> -fno-stack-protection for builds using GCC on
> AARCH64.
> 
> The gcc on Ubuntu enables -fstack-protector-strong
> by default starting with Ubuntu 21.10.
> 
> GenFw fails if stack protection is enabled.
> 
> Signed-off-by: Oliver Steffen 
> ---
>  BaseTools/Conf/tools_def.template | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Conf/tools_def.template
> b/BaseTools/Conf/tools_def.template
> index 9c310cf23d25..bd3edf0d219b 100755
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -1872,7 +1872,7 @@ DEFINE GCC_IA32_CC_FLAGS   =
> DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -
>  DEFINE GCC_X64_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS)
> -mno-red-zone -Wno-address -mno-stack-arg-probe
>  DEFINE GCC_ARM_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS)
> -mlittle-endian -mabi=aapcs -fno-short-enums -funsigned-char
> -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address
> -mthumb -mfloat-abi=soft -fno-pic -fno-pie
>  DEFINE GCC_ARM_CC_XIPFLAGS = -mno-unaligned-access
> -DEFINE GCC_AARCH64_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS)
> -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char
> -ffunction-sections -fdata-sections -Wno-address
> -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-pic -fno-pie
> -ffixed-x18
> +DEFINE GCC_AARCH64_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS)
> -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char
> -ffunction-sections -fdata-sections -Wno-address
> -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-pic -fno-pie
> -ffixed-x18 -fno-stack-protector
>  DEFINE GCC_AARCH64_CC_XIPFLAGS = -mstrict-align
> -mgeneral-regs-only
>  DEFINE GCC_DLINK_FLAGS_COMMON  = -nostdlib --pie
>  DEFINE GCC_DLINK2_FLAGS_COMMON =
> -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
> --
> 2.35.1
> 
> 
> 
> 
> 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89090): https://edk2.groups.io/g/devel/message/89090
Mute This Topic: https://groups.io/mt/90574237/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-