diff mbox series

[edk2] BaseTools/tools_def AARCH64: enable frame pointers for RELEASE builds

Message ID 20170915231356.23936-1-ard.biesheuvel@linaro.org
State Accepted
Commit 424a5ec33b3d5a842bff3f4695d0bd709c91a163
Headers show
Series [edk2] BaseTools/tools_def AARCH64: enable frame pointers for RELEASE builds | expand

Commit Message

Ard Biesheuvel Sept. 15, 2017, 11:13 p.m. UTC
Commit 8f0b62a5dac0 ("BaseTools/tools_def AARCH64: enable frame pointers
for DEBUG builds") removed the -fomit-frame-pointer switch from the
shared CFLAGS between AARCH64 DEBUG and RELEASE build, and move it to
the RELEASE specific ones, so that DEBUG builds can produce a backtrace
when a crash occurs.

This is actually a useful thing to have for RELEASE builds as well.
AArch64 has 30 general purpose registers, and so the performance hit of
having a frame pointer is unlikely to be noticeable, nor are the
additional 8 bytes of stack space likely to present a problem.

So remove -fomit-frame-pointer altogether this time.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 BaseTools/Conf/tools_def.template | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

-- 
2.11.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Leif Lindholm Sept. 16, 2017, 7:33 a.m. UTC | #1
On Fri, Sep 15, 2017 at 04:13:56PM -0700, Ard Biesheuvel wrote:
> Commit 8f0b62a5dac0 ("BaseTools/tools_def AARCH64: enable frame pointers

> for DEBUG builds") removed the -fomit-frame-pointer switch from the

> shared CFLAGS between AARCH64 DEBUG and RELEASE build, and move it to

> the RELEASE specific ones, so that DEBUG builds can produce a backtrace

> when a crash occurs.

> 

> This is actually a useful thing to have for RELEASE builds as well.

> AArch64 has 30 general purpose registers, and so the performance hit of

> having a frame pointer is unlikely to be noticeable, nor are the

> additional 8 bytes of stack space likely to present a problem.

> 

> So remove -fomit-frame-pointer altogether this time.

> 

> Contributed-under: TianoCore Contribution Agreement 1.1

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>


Looks sensible.
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>


/
    Leif

> ---

>  BaseTools/Conf/tools_def.template | 10 +++++-----

>  1 file changed, 5 insertions(+), 5 deletions(-)

> 

> diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template

> index cbb5024c1bd3..e93c2a0bf1ef 100755

> --- a/BaseTools/Conf/tools_def.template

> +++ b/BaseTools/Conf/tools_def.template

> @@ -4990,7 +4990,7 @@ RELEASE_GCC47_ARM_CC_FLAGS       = DEF(GCC47_ARM_CC_FLAGS) -Wno-unused-but-set-v

>  *_GCC47_AARCH64_CC_XIPFLAGS      = DEF(GCC47_AARCH64_CC_XIPFLAGS)

>  

>    DEBUG_GCC47_AARCH64_CC_FLAGS   = DEF(GCC47_AARCH64_CC_FLAGS) -O0

> -RELEASE_GCC47_AARCH64_CC_FLAGS   = DEF(GCC47_AARCH64_CC_FLAGS) -Wno-unused-but-set-variable -fomit-frame-pointer

> +RELEASE_GCC47_AARCH64_CC_FLAGS   = DEF(GCC47_AARCH64_CC_FLAGS) -Wno-unused-but-set-variable

>    NOOPT_GCC47_AARCH64_CC_FLAGS   = DEF(GCC47_AARCH64_CC_FLAGS) -O0

>  

>  ####################################################################################

> @@ -5130,7 +5130,7 @@ RELEASE_GCC48_ARM_CC_FLAGS       = DEF(GCC48_ARM_CC_FLAGS) -Wno-unused-but-set-v

>  *_GCC48_AARCH64_CC_XIPFLAGS      = DEF(GCC48_AARCH64_CC_XIPFLAGS)

>  

>    DEBUG_GCC48_AARCH64_CC_FLAGS   = DEF(GCC48_AARCH64_CC_FLAGS) -O0

> -RELEASE_GCC48_AARCH64_CC_FLAGS   = DEF(GCC48_AARCH64_CC_FLAGS) -Wno-unused-but-set-variable -fomit-frame-pointer

> +RELEASE_GCC48_AARCH64_CC_FLAGS   = DEF(GCC48_AARCH64_CC_FLAGS) -Wno-unused-but-set-variable

>    NOOPT_GCC48_AARCH64_CC_FLAGS   = DEF(GCC48_AARCH64_CC_FLAGS) -O0

>  

>  ####################################################################################

> @@ -5272,7 +5272,7 @@ RELEASE_GCC49_ARM_CC_FLAGS       = DEF(GCC49_ARM_CC_FLAGS) -Wno-unused-but-set-v

>    DEBUG_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000

>    DEBUG_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20

>  

> -RELEASE_GCC49_AARCH64_CC_FLAGS     = DEF(GCC49_AARCH64_CC_FLAGS) -Wno-unused-but-set-variable -Wno-unused-const-variable -mcmodel=tiny -fomit-frame-pointer

> +RELEASE_GCC49_AARCH64_CC_FLAGS     = DEF(GCC49_AARCH64_CC_FLAGS) -Wno-unused-but-set-variable -Wno-unused-const-variable -mcmodel=tiny

>  RELEASE_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS)

>  

>    NOOPT_GCC49_AARCH64_CC_FLAGS     = DEF(GCC49_AARCH64_CC_FLAGS) -O0 -mcmodel=small

> @@ -5428,7 +5428,7 @@ RELEASE_GCC5_ARM_DLINK_FLAGS     = DEF(GCC5_ARM_DLINK_FLAGS) -flto -Os -L$(WORKS

>    DEBUG_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000

>    DEBUG_GCC5_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20

>  

> -RELEASE_GCC5_AARCH64_CC_FLAGS    = DEF(GCC5_AARCH64_CC_FLAGS) -flto -Wno-unused-but-set-variable -Wno-unused-const-variable -mcmodel=tiny -fomit-frame-pointer

> +RELEASE_GCC5_AARCH64_CC_FLAGS    = DEF(GCC5_AARCH64_CC_FLAGS) -flto -Wno-unused-but-set-variable -Wno-unused-const-variable -mcmodel=tiny

>  RELEASE_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -flto -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64 -Wno-lto-type-mismatch

>  

>    NOOPT_GCC5_AARCH64_CC_FLAGS    = DEF(GCC5_AARCH64_CC_FLAGS) -O0 -mcmodel=small

> @@ -5513,7 +5513,7 @@ RELEASE_CLANG35_ARM_CC_FLAGS     = DEF(CLANG35_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(P

>  *_CLANG35_AARCH64_CC_XIPFLAGS    = DEF(GCC_AARCH64_CC_XIPFLAGS)

>  

>    DEBUG_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O0

> -RELEASE_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -Oz -fomit-frame-pointer

> +RELEASE_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -Oz

>  

>  ####################################################################################

>  #

> -- 

> 2.11.0

> 

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Gao, Liming Sept. 18, 2017, 5:06 a.m. UTC | #2
Reviewed-by: Liming Gao <liming.gao@intel.com>


>-----Original Message-----

>From: Leif Lindholm [mailto:leif.lindholm@linaro.org]

>Sent: Saturday, September 16, 2017 3:34 PM

>To: Ard Biesheuvel <ard.biesheuvel@linaro.org>

>Cc: edk2-devel@lists.01.org; Gao, Liming <liming.gao@intel.com>; Zhu,

>Yonghong <yonghong.zhu@intel.com>

>Subject: Re: [PATCH] BaseTools/tools_def AARCH64: enable frame pointers

>for RELEASE builds

>

>On Fri, Sep 15, 2017 at 04:13:56PM -0700, Ard Biesheuvel wrote:

>> Commit 8f0b62a5dac0 ("BaseTools/tools_def AARCH64: enable frame

>pointers

>> for DEBUG builds") removed the -fomit-frame-pointer switch from the

>> shared CFLAGS between AARCH64 DEBUG and RELEASE build, and move it

>to

>> the RELEASE specific ones, so that DEBUG builds can produce a backtrace

>> when a crash occurs.

>>

>> This is actually a useful thing to have for RELEASE builds as well.

>> AArch64 has 30 general purpose registers, and so the performance hit of

>> having a frame pointer is unlikely to be noticeable, nor are the

>> additional 8 bytes of stack space likely to present a problem.

>>

>> So remove -fomit-frame-pointer altogether this time.

>>

>> Contributed-under: TianoCore Contribution Agreement 1.1

>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

>

>Looks sensible.

>Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

>

>/

>    Leif

>

>> ---

>>  BaseTools/Conf/tools_def.template | 10 +++++-----

>>  1 file changed, 5 insertions(+), 5 deletions(-)

>>

>> diff --git a/BaseTools/Conf/tools_def.template

>b/BaseTools/Conf/tools_def.template

>> index cbb5024c1bd3..e93c2a0bf1ef 100755

>> --- a/BaseTools/Conf/tools_def.template

>> +++ b/BaseTools/Conf/tools_def.template

>> @@ -4990,7 +4990,7 @@ RELEASE_GCC47_ARM_CC_FLAGS       =

>DEF(GCC47_ARM_CC_FLAGS) -Wno-unused-but-set-v

>>  *_GCC47_AARCH64_CC_XIPFLAGS      =

>DEF(GCC47_AARCH64_CC_XIPFLAGS)

>>

>>    DEBUG_GCC47_AARCH64_CC_FLAGS   = DEF(GCC47_AARCH64_CC_FLAGS)

>-O0

>> -RELEASE_GCC47_AARCH64_CC_FLAGS   = DEF(GCC47_AARCH64_CC_FLAGS)

>-Wno-unused-but-set-variable -fomit-frame-pointer

>> +RELEASE_GCC47_AARCH64_CC_FLAGS   =

>DEF(GCC47_AARCH64_CC_FLAGS) -Wno-unused-but-set-variable

>>    NOOPT_GCC47_AARCH64_CC_FLAGS   = DEF(GCC47_AARCH64_CC_FLAGS)

>-O0

>>

>>

>###########################################################

>#########################

>> @@ -5130,7 +5130,7 @@ RELEASE_GCC48_ARM_CC_FLAGS       =

>DEF(GCC48_ARM_CC_FLAGS) -Wno-unused-but-set-v

>>  *_GCC48_AARCH64_CC_XIPFLAGS      =

>DEF(GCC48_AARCH64_CC_XIPFLAGS)

>>

>>    DEBUG_GCC48_AARCH64_CC_FLAGS   = DEF(GCC48_AARCH64_CC_FLAGS)

>-O0

>> -RELEASE_GCC48_AARCH64_CC_FLAGS   = DEF(GCC48_AARCH64_CC_FLAGS)

>-Wno-unused-but-set-variable -fomit-frame-pointer

>> +RELEASE_GCC48_AARCH64_CC_FLAGS   =

>DEF(GCC48_AARCH64_CC_FLAGS) -Wno-unused-but-set-variable

>>    NOOPT_GCC48_AARCH64_CC_FLAGS   = DEF(GCC48_AARCH64_CC_FLAGS)

>-O0

>>

>>

>###########################################################

>#########################

>> @@ -5272,7 +5272,7 @@ RELEASE_GCC49_ARM_CC_FLAGS       =

>DEF(GCC49_ARM_CC_FLAGS) -Wno-unused-but-set-v

>>    DEBUG_GCC49_AARCH64_DLINK_FLAGS  =

>DEF(GCC49_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000

>>    DEBUG_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20

>>

>> -RELEASE_GCC49_AARCH64_CC_FLAGS     =

>DEF(GCC49_AARCH64_CC_FLAGS) -Wno-unused-but-set-variable -Wno-

>unused-const-variable -mcmodel=tiny -fomit-frame-pointer

>> +RELEASE_GCC49_AARCH64_CC_FLAGS     =

>DEF(GCC49_AARCH64_CC_FLAGS) -Wno-unused-but-set-variable -Wno-

>unused-const-variable -mcmodel=tiny

>>  RELEASE_GCC49_AARCH64_DLINK_FLAGS  =

>DEF(GCC49_AARCH64_DLINK_FLAGS)

>>

>>    NOOPT_GCC49_AARCH64_CC_FLAGS     =

>DEF(GCC49_AARCH64_CC_FLAGS) -O0 -mcmodel=small

>> @@ -5428,7 +5428,7 @@ RELEASE_GCC5_ARM_DLINK_FLAGS     =

>DEF(GCC5_ARM_DLINK_FLAGS) -flto -Os -L$(WORKS

>>    DEBUG_GCC5_AARCH64_DLINK_FLAGS =

>DEF(GCC5_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000

>>    DEBUG_GCC5_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20

>>

>> -RELEASE_GCC5_AARCH64_CC_FLAGS    = DEF(GCC5_AARCH64_CC_FLAGS)

>-flto -Wno-unused-but-set-variable -Wno-unused-const-variable -

>mcmodel=tiny -fomit-frame-pointer

>> +RELEASE_GCC5_AARCH64_CC_FLAGS    = DEF(GCC5_AARCH64_CC_FLAGS)

>-flto -Wno-unused-but-set-variable -Wno-unused-const-variable -

>mcmodel=tiny

>>  RELEASE_GCC5_AARCH64_DLINK_FLAGS =

>DEF(GCC5_AARCH64_DLINK_FLAGS) -flto -Os -

>L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64 -Wl,-plugin-opt=-pass-

>through=-llto-aarch64 -Wno-lto-type-mismatch

>>

>>    NOOPT_GCC5_AARCH64_CC_FLAGS    = DEF(GCC5_AARCH64_CC_FLAGS) -

>O0 -mcmodel=small

>> @@ -5513,7 +5513,7 @@ RELEASE_CLANG35_ARM_CC_FLAGS     =

>DEF(CLANG35_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(P

>>  *_CLANG35_AARCH64_CC_XIPFLAGS    = DEF(GCC_AARCH64_CC_XIPFLAGS)

>>

>>    DEBUG_CLANG35_AARCH64_CC_FLAGS =

>DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)

>-O0

>> -RELEASE_CLANG35_AARCH64_CC_FLAGS =

>DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)

>-Oz -fomit-frame-pointer

>> +RELEASE_CLANG35_AARCH64_CC_FLAGS =

>DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)

>-Oz

>>

>>

>###########################################################

>#########################

>>  #

>> --

>> 2.11.0

>>

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Ard Biesheuvel Sept. 19, 2017, 4:42 p.m. UTC | #3
On 17 September 2017 at 22:06, Gao, Liming <liming.gao@intel.com> wrote:
> Reviewed-by: Liming Gao <liming.gao@intel.com>

>

[...]
>>>

>>> So remove -fomit-frame-pointer altogether this time.

>>>

>>> Contributed-under: TianoCore Contribution Agreement 1.1

>>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

>>

>>Looks sensible.

>>Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

>>


Pushed as 424a5ec33b3d5a842bff3f4695d0bd709c91a163

Thanks.
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox series

Patch

diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index cbb5024c1bd3..e93c2a0bf1ef 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4990,7 +4990,7 @@  RELEASE_GCC47_ARM_CC_FLAGS       = DEF(GCC47_ARM_CC_FLAGS) -Wno-unused-but-set-v
 *_GCC47_AARCH64_CC_XIPFLAGS      = DEF(GCC47_AARCH64_CC_XIPFLAGS)
 
   DEBUG_GCC47_AARCH64_CC_FLAGS   = DEF(GCC47_AARCH64_CC_FLAGS) -O0
-RELEASE_GCC47_AARCH64_CC_FLAGS   = DEF(GCC47_AARCH64_CC_FLAGS) -Wno-unused-but-set-variable -fomit-frame-pointer
+RELEASE_GCC47_AARCH64_CC_FLAGS   = DEF(GCC47_AARCH64_CC_FLAGS) -Wno-unused-but-set-variable
   NOOPT_GCC47_AARCH64_CC_FLAGS   = DEF(GCC47_AARCH64_CC_FLAGS) -O0
 
 ####################################################################################
@@ -5130,7 +5130,7 @@  RELEASE_GCC48_ARM_CC_FLAGS       = DEF(GCC48_ARM_CC_FLAGS) -Wno-unused-but-set-v
 *_GCC48_AARCH64_CC_XIPFLAGS      = DEF(GCC48_AARCH64_CC_XIPFLAGS)
 
   DEBUG_GCC48_AARCH64_CC_FLAGS   = DEF(GCC48_AARCH64_CC_FLAGS) -O0
-RELEASE_GCC48_AARCH64_CC_FLAGS   = DEF(GCC48_AARCH64_CC_FLAGS) -Wno-unused-but-set-variable -fomit-frame-pointer
+RELEASE_GCC48_AARCH64_CC_FLAGS   = DEF(GCC48_AARCH64_CC_FLAGS) -Wno-unused-but-set-variable
   NOOPT_GCC48_AARCH64_CC_FLAGS   = DEF(GCC48_AARCH64_CC_FLAGS) -O0
 
 ####################################################################################
@@ -5272,7 +5272,7 @@  RELEASE_GCC49_ARM_CC_FLAGS       = DEF(GCC49_ARM_CC_FLAGS) -Wno-unused-but-set-v
   DEBUG_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000
   DEBUG_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
 
-RELEASE_GCC49_AARCH64_CC_FLAGS     = DEF(GCC49_AARCH64_CC_FLAGS) -Wno-unused-but-set-variable -Wno-unused-const-variable -mcmodel=tiny -fomit-frame-pointer
+RELEASE_GCC49_AARCH64_CC_FLAGS     = DEF(GCC49_AARCH64_CC_FLAGS) -Wno-unused-but-set-variable -Wno-unused-const-variable -mcmodel=tiny
 RELEASE_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS)
 
   NOOPT_GCC49_AARCH64_CC_FLAGS     = DEF(GCC49_AARCH64_CC_FLAGS) -O0 -mcmodel=small
@@ -5428,7 +5428,7 @@  RELEASE_GCC5_ARM_DLINK_FLAGS     = DEF(GCC5_ARM_DLINK_FLAGS) -flto -Os -L$(WORKS
   DEBUG_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000
   DEBUG_GCC5_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
 
-RELEASE_GCC5_AARCH64_CC_FLAGS    = DEF(GCC5_AARCH64_CC_FLAGS) -flto -Wno-unused-but-set-variable -Wno-unused-const-variable -mcmodel=tiny -fomit-frame-pointer
+RELEASE_GCC5_AARCH64_CC_FLAGS    = DEF(GCC5_AARCH64_CC_FLAGS) -flto -Wno-unused-but-set-variable -Wno-unused-const-variable -mcmodel=tiny
 RELEASE_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -flto -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64 -Wno-lto-type-mismatch
 
   NOOPT_GCC5_AARCH64_CC_FLAGS    = DEF(GCC5_AARCH64_CC_FLAGS) -O0 -mcmodel=small
@@ -5513,7 +5513,7 @@  RELEASE_CLANG35_ARM_CC_FLAGS     = DEF(CLANG35_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(P
 *_CLANG35_AARCH64_CC_XIPFLAGS    = DEF(GCC_AARCH64_CC_XIPFLAGS)
 
   DEBUG_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O0
-RELEASE_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -Oz -fomit-frame-pointer
+RELEASE_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -Oz
 
 ####################################################################################
 #