* [Patch V2] BaseTools: support the NOOPT target with the GCC tool chains @ 2016-10-05 1:30 Yonghong Zhu 2016-10-05 14:48 ` Laszlo Ersek 2016-10-05 22:39 ` Bruce Cran 0 siblings, 2 replies; 10+ messages in thread From: Yonghong Zhu @ 2016-10-05 1:30 UTC (permalink / raw) To: edk2-devel; +Cc: Liming Gao, Laszlo Ersek Update the tools_def.template to add NOOPT support with GCC tool chains. Cc: Liming Gao <liming.gao@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> --- BaseTools/Conf/tools_def.template | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index 5414454..2c0dcd6 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -4333,10 +4333,11 @@ NOOPT_DDK3790xASL_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF *_*_*_OBJCOPY_FLAGS = objcopy not needed for *_*_*_SYMRENAME_PATH = echo *_*_*_SYMRENAME_FLAGS = Symbol renaming not needed for DEBUG_*_*_OBJCOPY_ADDDEBUGFLAG = --add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_NAME).debug RELEASE_*_*_OBJCOPY_ADDDEBUGFLAG = +NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG = --add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_NAME).debug DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common DEFINE GCC_IA32_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe DEFINE GCC_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-address -mno-stack-arg-probe DEFINE GCC_IPF_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -minline-int-divide-min-latency @@ -4767,10 +4768,11 @@ DEFINE GCC5_AARCH64_ASLDLINK_FLAGS = DEF(GCC49_AARCH64_ASLDLINK_FLAGS) *_GCC46_IA32_OBJCOPY_FLAGS = *_GCC46_IA32_NASM_FLAGS = -f elf32 DEBUG_GCC46_IA32_CC_FLAGS = DEF(GCC46_IA32_CC_FLAGS) -Os RELEASE_GCC46_IA32_CC_FLAGS = DEF(GCC46_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable + NOOPT_GCC46_IA32_CC_FLAGS = DEF(GCC46_IA32_CC_FLAGS) -O0 ################## # GCC46 X64 definitions ################## *_GCC46_X64_OBJCOPY_PATH = DEF(GCC46_X64_PREFIX)objcopy @@ -4794,10 +4796,11 @@ RELEASE_GCC46_IA32_CC_FLAGS = DEF(GCC46_IA32_CC_FLAGS) -Os -Wno-unused-but *_GCC46_X64_OBJCOPY_FLAGS = *_GCC46_X64_NASM_FLAGS = -f elf64 DEBUG_GCC46_X64_CC_FLAGS = DEF(GCC46_X64_CC_FLAGS) RELEASE_GCC46_X64_CC_FLAGS = DEF(GCC46_X64_CC_FLAGS) -Wno-unused-but-set-variable + NOOPT_GCC46_X64_CC_FLAGS = DEF(GCC46_X64_CC_FLAGS) -O0 ################## # GCC46 ARM definitions ################## *_GCC46_ARM_OBJCOPY_PATH = echo @@ -4826,10 +4829,11 @@ RELEASE_GCC46_X64_CC_FLAGS = DEF(GCC46_X64_CC_FLAGS) -Wno-unused-but-set-v *_GCC46_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS) *_GCC46_ARM_CC_XIPFLAGS = DEF(GCC46_ARM_CC_XIPFLAGS) DEBUG_GCC46_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -O0 RELEASE_GCC46_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -Wno-unused-but-set-variable + NOOPT_GCC46_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -O0 #################################################################################### # # GCC 4.7 - This configuration is used to compile under Linux to produce # PE/COFF binaries using GCC 4.7. @@ -4873,10 +4877,11 @@ RELEASE_GCC46_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -Wno-unused-but-set-v *_GCC47_IA32_OBJCOPY_FLAGS = *_GCC47_IA32_NASM_FLAGS = -f elf32 DEBUG_GCC47_IA32_CC_FLAGS = DEF(GCC47_IA32_CC_FLAGS) -Os RELEASE_GCC47_IA32_CC_FLAGS = DEF(GCC47_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable + NOOPT_GCC47_IA32_CC_FLAGS = DEF(GCC47_IA32_CC_FLAGS) -O0 ################## # GCC47 X64 definitions ################## *_GCC47_X64_OBJCOPY_PATH = DEF(GCC47_X64_PREFIX)objcopy @@ -4900,10 +4905,11 @@ RELEASE_GCC47_IA32_CC_FLAGS = DEF(GCC47_IA32_CC_FLAGS) -Os -Wno-unused-but *_GCC47_X64_OBJCOPY_FLAGS = *_GCC47_X64_NASM_FLAGS = -f elf64 DEBUG_GCC47_X64_CC_FLAGS = DEF(GCC47_X64_CC_FLAGS) RELEASE_GCC47_X64_CC_FLAGS = DEF(GCC47_X64_CC_FLAGS) -Wno-unused-but-set-variable + NOOPT_GCC47_X64_CC_FLAGS = DEF(GCC47_X64_CC_FLAGS) -O0 ################## # GCC47 ARM definitions ################## *_GCC47_ARM_CC_PATH = ENV(GCC47_ARM_PREFIX)gcc @@ -4931,10 +4937,11 @@ RELEASE_GCC47_X64_CC_FLAGS = DEF(GCC47_X64_CC_FLAGS) -Wno-unused-but-set-v *_GCC47_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS) *_GCC47_ARM_CC_XIPFLAGS = DEF(GCC47_ARM_CC_XIPFLAGS) DEBUG_GCC47_ARM_CC_FLAGS = DEF(GCC47_ARM_CC_FLAGS) -O0 RELEASE_GCC47_ARM_CC_FLAGS = DEF(GCC47_ARM_CC_FLAGS) -Wno-unused-but-set-variable + NOOPT_GCC47_ARM_CC_FLAGS = DEF(GCC47_ARM_CC_FLAGS) -O0 ################## # GCC47 AARCH64 definitions ################## *_GCC47_AARCH64_CC_PATH = ENV(GCC47_AARCH64_PREFIX)gcc @@ -4959,10 +4966,11 @@ RELEASE_GCC47_ARM_CC_FLAGS = DEF(GCC47_ARM_CC_FLAGS) -Wno-unused-but-set-v *_GCC47_AARCH64_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS) *_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 + NOOPT_GCC47_AARCH64_CC_FLAGS = DEF(GCC47_AARCH64_CC_FLAGS) -O0 #################################################################################### # # GCC 4.8 - This configuration is used to compile under Linux to produce # PE/COFF binaries using GCC 4.8. @@ -5006,10 +5014,11 @@ RELEASE_GCC47_AARCH64_CC_FLAGS = DEF(GCC47_AARCH64_CC_FLAGS) -Wno-unused-but-s *_GCC48_IA32_OBJCOPY_FLAGS = *_GCC48_IA32_NASM_FLAGS = -f elf32 DEBUG_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os RELEASE_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable + NOOPT_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -O0 ################## # GCC48 X64 definitions ################## *_GCC48_X64_OBJCOPY_PATH = DEF(GCC48_X64_PREFIX)objcopy @@ -5033,10 +5042,11 @@ RELEASE_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os -Wno-unused-but *_GCC48_X64_OBJCOPY_FLAGS = *_GCC48_X64_NASM_FLAGS = -f elf64 DEBUG_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) RELEASE_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) -Wno-unused-but-set-variable + NOOPT_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) -O0 ################## # GCC48 ARM definitions ################## *_GCC48_ARM_CC_PATH = ENV(GCC48_ARM_PREFIX)gcc @@ -5064,10 +5074,11 @@ RELEASE_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) -Wno-unused-but-set-v *_GCC48_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS) *_GCC48_ARM_CC_XIPFLAGS = DEF(GCC48_ARM_CC_XIPFLAGS) DEBUG_GCC48_ARM_CC_FLAGS = DEF(GCC48_ARM_CC_FLAGS) -O0 RELEASE_GCC48_ARM_CC_FLAGS = DEF(GCC48_ARM_CC_FLAGS) -Wno-unused-but-set-variable + NOOPT_GCC48_ARM_CC_FLAGS = DEF(GCC48_ARM_CC_FLAGS) -O0 ################## # GCC48 AARCH64 definitions ################## *_GCC48_AARCH64_CC_PATH = ENV(GCC48_AARCH64_PREFIX)gcc @@ -5092,10 +5103,11 @@ RELEASE_GCC48_ARM_CC_FLAGS = DEF(GCC48_ARM_CC_FLAGS) -Wno-unused-but-set-v *_GCC48_AARCH64_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS) *_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 + NOOPT_GCC48_AARCH64_CC_FLAGS = DEF(GCC48_AARCH64_CC_FLAGS) -O0 #################################################################################### # # GCC 4.9 - This configuration is used to compile under Linux to produce # PE/COFF binaries using GCC 4.9. @@ -5139,10 +5151,11 @@ RELEASE_GCC48_AARCH64_CC_FLAGS = DEF(GCC48_AARCH64_CC_FLAGS) -Wno-unused-but-s *_GCC49_IA32_OBJCOPY_FLAGS = *_GCC49_IA32_NASM_FLAGS = -f elf32 DEBUG_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os RELEASE_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable + NOOPT_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -O0 ################## # GCC49 X64 definitions ################## *_GCC49_X64_OBJCOPY_PATH = DEF(GCC49_X64_PREFIX)objcopy @@ -5166,10 +5179,11 @@ RELEASE_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os -Wno-unused-but *_GCC49_X64_OBJCOPY_FLAGS = *_GCC49_X64_NASM_FLAGS = -f elf64 DEBUG_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) RELEASE_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -Wno-unused-but-set-variable + NOOPT_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -O0 ################## # GCC49 ARM definitions ################## *_GCC49_ARM_CC_PATH = ENV(GCC49_ARM_PREFIX)gcc @@ -5197,10 +5211,11 @@ RELEASE_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -Wno-unused-but-set-v *_GCC49_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS) *_GCC49_ARM_CC_XIPFLAGS = DEF(GCC49_ARM_CC_XIPFLAGS) DEBUG_GCC49_ARM_CC_FLAGS = DEF(GCC49_ARM_CC_FLAGS) -O0 RELEASE_GCC49_ARM_CC_FLAGS = DEF(GCC49_ARM_CC_FLAGS) -Wno-unused-but-set-variable + NOOPT_GCC49_ARM_CC_FLAGS = DEF(GCC49_ARM_CC_FLAGS) -O0 ################## # GCC49 AARCH64 definitions ################## *_GCC49_AARCH64_CC_PATH = ENV(GCC49_AARCH64_PREFIX)gcc @@ -5229,10 +5244,14 @@ RELEASE_GCC49_ARM_CC_FLAGS = DEF(GCC49_ARM_CC_FLAGS) -Wno-unused-but-set-v 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 -mcmodel=tiny -fomit-frame-pointer RELEASE_GCC49_AARCH64_DLINK_FLAGS = DEF(GCC49_AARCH64_DLINK_FLAGS) + NOOPT_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) -O0 -mcmodel=small + NOOPT_GCC49_AARCH64_DLINK_FLAGS = DEF(GCC49_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000 -O0 + NOOPT_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20 -O0 + #################################################################################### # # GCC 5 - This configuration is used to compile under Linux to produce # PE/COFF binaries using GCC 5 # @@ -5275,10 +5294,11 @@ RELEASE_GCC49_AARCH64_DLINK_FLAGS = DEF(GCC49_AARCH64_DLINK_FLAGS) *_GCC5_IA32_OBJCOPY_FLAGS = *_GCC5_IA32_NASM_FLAGS = -f elf32 DEBUG_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -Os RELEASE_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable + NOOPT_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -O0 ################## # GCC5 X64 definitions ################## *_GCC5_X64_OBJCOPY_PATH = DEF(GCC5_X64_PREFIX)objcopy @@ -5302,10 +5322,11 @@ RELEASE_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -Os -Wno-unused-but-s *_GCC5_X64_OBJCOPY_FLAGS = *_GCC5_X64_NASM_FLAGS = -f elf64 DEBUG_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) RELEASE_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -Wno-unused-but-set-variable + NOOPT_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -O0 ################## # GCC5 ARM definitions ################## *_GCC5_ARM_CC_PATH = ENV(GCC5_ARM_PREFIX)gcc @@ -5334,10 +5355,13 @@ RELEASE_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -Wno-unused-but-set-va DEBUG_GCC5_ARM_DLINK_FLAGS = DEF(GCC5_ARM_DLINK_FLAGS) RELEASE_GCC5_ARM_CC_FLAGS = DEF(GCC5_ARM_CC_FLAGS) -flto -Wno-unused-but-set-variable RELEASE_GCC5_ARM_DLINK_FLAGS = DEF(GCC5_ARM_DLINK_FLAGS) -flto -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-arm -Wl,-plugin-opt=-pass-through=-llto-arm + NOOPT_GCC5_ARM_CC_FLAGS = DEF(GCC5_ARM_CC_FLAGS) -O0 + NOOPT_GCC5_ARM_DLINK_FLAGS = DEF(GCC5_ARM_DLINK_FLAGS) -O0 + ################## # GCC5 AARCH64 definitions ################## *_GCC5_AARCH64_CC_PATH = ENV(GCC5_AARCH64_PREFIX)gcc *_GCC5_AARCH64_SLINK_PATH = ENV(GCC5_AARCH64_PREFIX)gcc-ar @@ -5365,10 +5389,14 @@ RELEASE_GCC5_ARM_DLINK_FLAGS = DEF(GCC5_ARM_DLINK_FLAGS) -flto -Os -L$(WORKS 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 -mcmodel=tiny -fomit-frame-pointer 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 + NOOPT_GCC5_AARCH64_CC_FLAGS = DEF(GCC5_AARCH64_CC_FLAGS) -O0 -mcmodel=small + NOOPT_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000 -O0 + NOOPT_GCC5_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20 -O0 + #################################################################################### # # CLANG35 - This configuration is used to compile under Linux to produce # PE/COFF binaries using the clang compiler and assembler (v3.5 and up) # and GNU linker -- 2.6.1.windows.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [Patch V2] BaseTools: support the NOOPT target with the GCC tool chains 2016-10-05 1:30 [Patch V2] BaseTools: support the NOOPT target with the GCC tool chains Yonghong Zhu @ 2016-10-05 14:48 ` Laszlo Ersek 2016-10-05 16:06 ` Ard Biesheuvel 2016-10-05 22:39 ` Bruce Cran 1 sibling, 1 reply; 10+ messages in thread From: Laszlo Ersek @ 2016-10-05 14:48 UTC (permalink / raw) To: Yonghong Zhu, edk2-devel; +Cc: Liming Gao, Ard Biesheuvel On 10/05/16 03:30, Yonghong Zhu wrote: > Update the tools_def.template to add NOOPT support with GCC tool chains. > > Cc: Liming Gao <liming.gao@intel.com> > Cc: Laszlo Ersek <lersek@redhat.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> > --- > BaseTools/Conf/tools_def.template | 28 ++++++++++++++++++++++++++++ > 1 file changed, 28 insertions(+) I thought I understood what was going on, but apparently I was wrong about that. In this patch, we add or modify: - NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG -- okay - NOOPT_GCC*_(IA32|X64|ARM|AARCH64)_CC_FLAGS -- okay So that part is fine with me. But then we also add / modify: - NOOPT_GCC(49|5)_AARCH64_DLINK_(FLAGS|XIPFLAGS) - NOOPT_GCC5_ARM_DLINK_FLAGS First I thought the latter set of changes was unnecessary, because "ld" didn't use "-O". I checked the manual, and I was wrong: "ld" does know / use "-O". So those changes are fine, I guess. But then: is the patch *complete*? Because I can see some more DLINK stuff, for IA32 and X64 (not just ARM and AARCH64). Is it okay to ignore those? For example: *_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Os -Wl,-m,elf_i386,--oformat=elf32-i386 *_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -Os Where GCC5_X64_DLINK_FLAGS and GCC5_IA32_X64_DLINK_FLAGS even include -flto. (I don't know if "-flto" hampers source level debugging or not.) Is there a way for BaseTools to dump the complete, expanded (i.e., no macro references and no asterisks) macro list? Thanks Laszlo > diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template > index 5414454..2c0dcd6 100755 > --- a/BaseTools/Conf/tools_def.template > +++ b/BaseTools/Conf/tools_def.template > @@ -4333,10 +4333,11 @@ NOOPT_DDK3790xASL_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF > *_*_*_OBJCOPY_FLAGS = objcopy not needed for > *_*_*_SYMRENAME_PATH = echo > *_*_*_SYMRENAME_FLAGS = Symbol renaming not needed for > DEBUG_*_*_OBJCOPY_ADDDEBUGFLAG = --add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_NAME).debug > RELEASE_*_*_OBJCOPY_ADDDEBUGFLAG = > +NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG = --add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_NAME).debug > > DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common > DEFINE GCC_IA32_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe > DEFINE GCC_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-address -mno-stack-arg-probe > DEFINE GCC_IPF_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -minline-int-divide-min-latency > @@ -4767,10 +4768,11 @@ DEFINE GCC5_AARCH64_ASLDLINK_FLAGS = DEF(GCC49_AARCH64_ASLDLINK_FLAGS) > *_GCC46_IA32_OBJCOPY_FLAGS = > *_GCC46_IA32_NASM_FLAGS = -f elf32 > > DEBUG_GCC46_IA32_CC_FLAGS = DEF(GCC46_IA32_CC_FLAGS) -Os > RELEASE_GCC46_IA32_CC_FLAGS = DEF(GCC46_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable > + NOOPT_GCC46_IA32_CC_FLAGS = DEF(GCC46_IA32_CC_FLAGS) -O0 > > ################## > # GCC46 X64 definitions > ################## > *_GCC46_X64_OBJCOPY_PATH = DEF(GCC46_X64_PREFIX)objcopy > @@ -4794,10 +4796,11 @@ RELEASE_GCC46_IA32_CC_FLAGS = DEF(GCC46_IA32_CC_FLAGS) -Os -Wno-unused-but > *_GCC46_X64_OBJCOPY_FLAGS = > *_GCC46_X64_NASM_FLAGS = -f elf64 > > DEBUG_GCC46_X64_CC_FLAGS = DEF(GCC46_X64_CC_FLAGS) > RELEASE_GCC46_X64_CC_FLAGS = DEF(GCC46_X64_CC_FLAGS) -Wno-unused-but-set-variable > + NOOPT_GCC46_X64_CC_FLAGS = DEF(GCC46_X64_CC_FLAGS) -O0 > > ################## > # GCC46 ARM definitions > ################## > *_GCC46_ARM_OBJCOPY_PATH = echo > @@ -4826,10 +4829,11 @@ RELEASE_GCC46_X64_CC_FLAGS = DEF(GCC46_X64_CC_FLAGS) -Wno-unused-but-set-v > *_GCC46_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS) > *_GCC46_ARM_CC_XIPFLAGS = DEF(GCC46_ARM_CC_XIPFLAGS) > > DEBUG_GCC46_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -O0 > RELEASE_GCC46_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -Wno-unused-but-set-variable > + NOOPT_GCC46_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -O0 > > #################################################################################### > # > # GCC 4.7 - This configuration is used to compile under Linux to produce > # PE/COFF binaries using GCC 4.7. > @@ -4873,10 +4877,11 @@ RELEASE_GCC46_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -Wno-unused-but-set-v > *_GCC47_IA32_OBJCOPY_FLAGS = > *_GCC47_IA32_NASM_FLAGS = -f elf32 > > DEBUG_GCC47_IA32_CC_FLAGS = DEF(GCC47_IA32_CC_FLAGS) -Os > RELEASE_GCC47_IA32_CC_FLAGS = DEF(GCC47_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable > + NOOPT_GCC47_IA32_CC_FLAGS = DEF(GCC47_IA32_CC_FLAGS) -O0 > > ################## > # GCC47 X64 definitions > ################## > *_GCC47_X64_OBJCOPY_PATH = DEF(GCC47_X64_PREFIX)objcopy > @@ -4900,10 +4905,11 @@ RELEASE_GCC47_IA32_CC_FLAGS = DEF(GCC47_IA32_CC_FLAGS) -Os -Wno-unused-but > *_GCC47_X64_OBJCOPY_FLAGS = > *_GCC47_X64_NASM_FLAGS = -f elf64 > > DEBUG_GCC47_X64_CC_FLAGS = DEF(GCC47_X64_CC_FLAGS) > RELEASE_GCC47_X64_CC_FLAGS = DEF(GCC47_X64_CC_FLAGS) -Wno-unused-but-set-variable > + NOOPT_GCC47_X64_CC_FLAGS = DEF(GCC47_X64_CC_FLAGS) -O0 > > ################## > # GCC47 ARM definitions > ################## > *_GCC47_ARM_CC_PATH = ENV(GCC47_ARM_PREFIX)gcc > @@ -4931,10 +4937,11 @@ RELEASE_GCC47_X64_CC_FLAGS = DEF(GCC47_X64_CC_FLAGS) -Wno-unused-but-set-v > *_GCC47_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS) > *_GCC47_ARM_CC_XIPFLAGS = DEF(GCC47_ARM_CC_XIPFLAGS) > > DEBUG_GCC47_ARM_CC_FLAGS = DEF(GCC47_ARM_CC_FLAGS) -O0 > RELEASE_GCC47_ARM_CC_FLAGS = DEF(GCC47_ARM_CC_FLAGS) -Wno-unused-but-set-variable > + NOOPT_GCC47_ARM_CC_FLAGS = DEF(GCC47_ARM_CC_FLAGS) -O0 > > ################## > # GCC47 AARCH64 definitions > ################## > *_GCC47_AARCH64_CC_PATH = ENV(GCC47_AARCH64_PREFIX)gcc > @@ -4959,10 +4966,11 @@ RELEASE_GCC47_ARM_CC_FLAGS = DEF(GCC47_ARM_CC_FLAGS) -Wno-unused-but-set-v > *_GCC47_AARCH64_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS) > *_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 > + NOOPT_GCC47_AARCH64_CC_FLAGS = DEF(GCC47_AARCH64_CC_FLAGS) -O0 > > #################################################################################### > # > # GCC 4.8 - This configuration is used to compile under Linux to produce > # PE/COFF binaries using GCC 4.8. > @@ -5006,10 +5014,11 @@ RELEASE_GCC47_AARCH64_CC_FLAGS = DEF(GCC47_AARCH64_CC_FLAGS) -Wno-unused-but-s > *_GCC48_IA32_OBJCOPY_FLAGS = > *_GCC48_IA32_NASM_FLAGS = -f elf32 > > DEBUG_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os > RELEASE_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable > + NOOPT_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -O0 > > ################## > # GCC48 X64 definitions > ################## > *_GCC48_X64_OBJCOPY_PATH = DEF(GCC48_X64_PREFIX)objcopy > @@ -5033,10 +5042,11 @@ RELEASE_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os -Wno-unused-but > *_GCC48_X64_OBJCOPY_FLAGS = > *_GCC48_X64_NASM_FLAGS = -f elf64 > > DEBUG_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) > RELEASE_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) -Wno-unused-but-set-variable > + NOOPT_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) -O0 > > ################## > # GCC48 ARM definitions > ################## > *_GCC48_ARM_CC_PATH = ENV(GCC48_ARM_PREFIX)gcc > @@ -5064,10 +5074,11 @@ RELEASE_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) -Wno-unused-but-set-v > *_GCC48_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS) > *_GCC48_ARM_CC_XIPFLAGS = DEF(GCC48_ARM_CC_XIPFLAGS) > > DEBUG_GCC48_ARM_CC_FLAGS = DEF(GCC48_ARM_CC_FLAGS) -O0 > RELEASE_GCC48_ARM_CC_FLAGS = DEF(GCC48_ARM_CC_FLAGS) -Wno-unused-but-set-variable > + NOOPT_GCC48_ARM_CC_FLAGS = DEF(GCC48_ARM_CC_FLAGS) -O0 > > ################## > # GCC48 AARCH64 definitions > ################## > *_GCC48_AARCH64_CC_PATH = ENV(GCC48_AARCH64_PREFIX)gcc > @@ -5092,10 +5103,11 @@ RELEASE_GCC48_ARM_CC_FLAGS = DEF(GCC48_ARM_CC_FLAGS) -Wno-unused-but-set-v > *_GCC48_AARCH64_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS) > *_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 > + NOOPT_GCC48_AARCH64_CC_FLAGS = DEF(GCC48_AARCH64_CC_FLAGS) -O0 > > #################################################################################### > # > # GCC 4.9 - This configuration is used to compile under Linux to produce > # PE/COFF binaries using GCC 4.9. > @@ -5139,10 +5151,11 @@ RELEASE_GCC48_AARCH64_CC_FLAGS = DEF(GCC48_AARCH64_CC_FLAGS) -Wno-unused-but-s > *_GCC49_IA32_OBJCOPY_FLAGS = > *_GCC49_IA32_NASM_FLAGS = -f elf32 > > DEBUG_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os > RELEASE_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable > + NOOPT_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -O0 > > ################## > # GCC49 X64 definitions > ################## > *_GCC49_X64_OBJCOPY_PATH = DEF(GCC49_X64_PREFIX)objcopy > @@ -5166,10 +5179,11 @@ RELEASE_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os -Wno-unused-but > *_GCC49_X64_OBJCOPY_FLAGS = > *_GCC49_X64_NASM_FLAGS = -f elf64 > > DEBUG_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) > RELEASE_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -Wno-unused-but-set-variable > + NOOPT_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -O0 > > ################## > # GCC49 ARM definitions > ################## > *_GCC49_ARM_CC_PATH = ENV(GCC49_ARM_PREFIX)gcc > @@ -5197,10 +5211,11 @@ RELEASE_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -Wno-unused-but-set-v > *_GCC49_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS) > *_GCC49_ARM_CC_XIPFLAGS = DEF(GCC49_ARM_CC_XIPFLAGS) > > DEBUG_GCC49_ARM_CC_FLAGS = DEF(GCC49_ARM_CC_FLAGS) -O0 > RELEASE_GCC49_ARM_CC_FLAGS = DEF(GCC49_ARM_CC_FLAGS) -Wno-unused-but-set-variable > + NOOPT_GCC49_ARM_CC_FLAGS = DEF(GCC49_ARM_CC_FLAGS) -O0 > > ################## > # GCC49 AARCH64 definitions > ################## > *_GCC49_AARCH64_CC_PATH = ENV(GCC49_AARCH64_PREFIX)gcc > @@ -5229,10 +5244,14 @@ RELEASE_GCC49_ARM_CC_FLAGS = DEF(GCC49_ARM_CC_FLAGS) -Wno-unused-but-set-v > 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 -mcmodel=tiny -fomit-frame-pointer > RELEASE_GCC49_AARCH64_DLINK_FLAGS = DEF(GCC49_AARCH64_DLINK_FLAGS) > > + NOOPT_GCC49_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) -O0 -mcmodel=small > + NOOPT_GCC49_AARCH64_DLINK_FLAGS = DEF(GCC49_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000 -O0 > + NOOPT_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20 -O0 > + > #################################################################################### > # > # GCC 5 - This configuration is used to compile under Linux to produce > # PE/COFF binaries using GCC 5 > # > @@ -5275,10 +5294,11 @@ RELEASE_GCC49_AARCH64_DLINK_FLAGS = DEF(GCC49_AARCH64_DLINK_FLAGS) > *_GCC5_IA32_OBJCOPY_FLAGS = > *_GCC5_IA32_NASM_FLAGS = -f elf32 > > DEBUG_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -Os > RELEASE_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable > + NOOPT_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -O0 > > ################## > # GCC5 X64 definitions > ################## > *_GCC5_X64_OBJCOPY_PATH = DEF(GCC5_X64_PREFIX)objcopy > @@ -5302,10 +5322,11 @@ RELEASE_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -Os -Wno-unused-but-s > *_GCC5_X64_OBJCOPY_FLAGS = > *_GCC5_X64_NASM_FLAGS = -f elf64 > > DEBUG_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) > RELEASE_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -Wno-unused-but-set-variable > + NOOPT_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -O0 > > ################## > # GCC5 ARM definitions > ################## > *_GCC5_ARM_CC_PATH = ENV(GCC5_ARM_PREFIX)gcc > @@ -5334,10 +5355,13 @@ RELEASE_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -Wno-unused-but-set-va > DEBUG_GCC5_ARM_DLINK_FLAGS = DEF(GCC5_ARM_DLINK_FLAGS) > > RELEASE_GCC5_ARM_CC_FLAGS = DEF(GCC5_ARM_CC_FLAGS) -flto -Wno-unused-but-set-variable > RELEASE_GCC5_ARM_DLINK_FLAGS = DEF(GCC5_ARM_DLINK_FLAGS) -flto -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-arm -Wl,-plugin-opt=-pass-through=-llto-arm > > + NOOPT_GCC5_ARM_CC_FLAGS = DEF(GCC5_ARM_CC_FLAGS) -O0 > + NOOPT_GCC5_ARM_DLINK_FLAGS = DEF(GCC5_ARM_DLINK_FLAGS) -O0 > + > ################## > # GCC5 AARCH64 definitions > ################## > *_GCC5_AARCH64_CC_PATH = ENV(GCC5_AARCH64_PREFIX)gcc > *_GCC5_AARCH64_SLINK_PATH = ENV(GCC5_AARCH64_PREFIX)gcc-ar > @@ -5365,10 +5389,14 @@ RELEASE_GCC5_ARM_DLINK_FLAGS = DEF(GCC5_ARM_DLINK_FLAGS) -flto -Os -L$(WORKS > 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 -mcmodel=tiny -fomit-frame-pointer > 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 > > + NOOPT_GCC5_AARCH64_CC_FLAGS = DEF(GCC5_AARCH64_CC_FLAGS) -O0 -mcmodel=small > + NOOPT_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000 -O0 > + NOOPT_GCC5_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20 -O0 > + > #################################################################################### > # > # CLANG35 - This configuration is used to compile under Linux to produce > # PE/COFF binaries using the clang compiler and assembler (v3.5 and up) > # and GNU linker > ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch V2] BaseTools: support the NOOPT target with the GCC tool chains 2016-10-05 14:48 ` Laszlo Ersek @ 2016-10-05 16:06 ` Ard Biesheuvel 2016-10-05 17:56 ` Laszlo Ersek 0 siblings, 1 reply; 10+ messages in thread From: Ard Biesheuvel @ 2016-10-05 16:06 UTC (permalink / raw) To: Laszlo Ersek; +Cc: Yonghong Zhu, edk2-devel@lists.01.org, Liming Gao On 5 October 2016 at 15:48, Laszlo Ersek <lersek@redhat.com> wrote: > On 10/05/16 03:30, Yonghong Zhu wrote: >> Update the tools_def.template to add NOOPT support with GCC tool chains. >> >> Cc: Liming Gao <liming.gao@intel.com> >> Cc: Laszlo Ersek <lersek@redhat.com> >> Contributed-under: TianoCore Contribution Agreement 1.0 >> Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> >> --- >> BaseTools/Conf/tools_def.template | 28 ++++++++++++++++++++++++++++ >> 1 file changed, 28 insertions(+) > > I thought I understood what was going on, but apparently I was wrong > about that. > > In this patch, we add or modify: > - NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG -- okay > - NOOPT_GCC*_(IA32|X64|ARM|AARCH64)_CC_FLAGS -- okay > > So that part is fine with me. But then we also add / modify: > - NOOPT_GCC(49|5)_AARCH64_DLINK_(FLAGS|XIPFLAGS) > - NOOPT_GCC5_ARM_DLINK_FLAGS > > First I thought the latter set of changes was unnecessary, because "ld" > didn't use "-O". I checked the manual, and I was wrong: "ld" does know / > use "-O". So those changes are fine, I guess. > Yes, especially under LTO, in which case code generation is performed during the link stage, which should adhere to the same rules as the compiler. This not only applies to -O, but also to things like -march/-mcpu and -mstrict-align. This is why we pass all CFLAGS to the linker for the GCC5 LTO builds. > But then: is the patch *complete*? Because I can see some more DLINK > stuff, for IA32 and X64 (not just ARM and AARCH64). Is it okay to ignore > those? For example: > > *_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Os > -Wl,-m,elf_i386,--oformat=elf32-i386 > > > *_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -Os > > Where GCC5_X64_DLINK_FLAGS and GCC5_IA32_X64_DLINK_FLAGS even include > -flto. (I don't know if "-flto" hampers source level debugging or not.) > The GCC man page documents -flto as being a bad idea, i.e., """ Link-time optimization does not work well with generation of debugging information. Combining -flto with -g is currently experimental and expected to produce unexpected results. """ (which raises a philosophical question as well, i.e., to which extent expected unexpected results are still unexpected results. But I digress ...) Another note: the DEBUG build for ARM and AARCH64 is essentially NOOPT already, not DEBUG. How does this patch intend to deal with that? ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch V2] BaseTools: support the NOOPT target with the GCC tool chains 2016-10-05 16:06 ` Ard Biesheuvel @ 2016-10-05 17:56 ` Laszlo Ersek 2016-10-05 18:06 ` Ard Biesheuvel 0 siblings, 1 reply; 10+ messages in thread From: Laszlo Ersek @ 2016-10-05 17:56 UTC (permalink / raw) To: Ard Biesheuvel; +Cc: edk2-devel@lists.01.org, Liming Gao On 10/05/16 18:06, Ard Biesheuvel wrote: > On 5 October 2016 at 15:48, Laszlo Ersek <lersek@redhat.com> wrote: >> On 10/05/16 03:30, Yonghong Zhu wrote: >>> Update the tools_def.template to add NOOPT support with GCC tool chains. >>> >>> Cc: Liming Gao <liming.gao@intel.com> >>> Cc: Laszlo Ersek <lersek@redhat.com> >>> Contributed-under: TianoCore Contribution Agreement 1.0 >>> Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> >>> --- >>> BaseTools/Conf/tools_def.template | 28 ++++++++++++++++++++++++++++ >>> 1 file changed, 28 insertions(+) >> >> I thought I understood what was going on, but apparently I was wrong >> about that. >> >> In this patch, we add or modify: >> - NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG -- okay >> - NOOPT_GCC*_(IA32|X64|ARM|AARCH64)_CC_FLAGS -- okay >> >> So that part is fine with me. But then we also add / modify: >> - NOOPT_GCC(49|5)_AARCH64_DLINK_(FLAGS|XIPFLAGS) >> - NOOPT_GCC5_ARM_DLINK_FLAGS >> >> First I thought the latter set of changes was unnecessary, because "ld" >> didn't use "-O". I checked the manual, and I was wrong: "ld" does know / >> use "-O". So those changes are fine, I guess. >> > > Yes, especially under LTO, in which case code generation is performed > during the link stage, which should adhere to the same rules as the > compiler. This not only applies to -O, but also to things like > -march/-mcpu and -mstrict-align. This is why we pass all CFLAGS to the > linker for the GCC5 LTO builds. > >> But then: is the patch *complete*? Because I can see some more DLINK >> stuff, for IA32 and X64 (not just ARM and AARCH64). Is it okay to ignore >> those? For example: >> >> *_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Os >> -Wl,-m,elf_i386,--oformat=elf32-i386 >> >> >> *_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -Os >> >> Where GCC5_X64_DLINK_FLAGS and GCC5_IA32_X64_DLINK_FLAGS even include >> -flto. (I don't know if "-flto" hampers source level debugging or not.) >> > > The GCC man page documents -flto as being a bad idea, i.e., > > """ > Link-time optimization does not work well with generation of debugging > information. Combining -flto with -g is currently experimental and > expected to produce unexpected results. > """ > > (which raises a philosophical question as well, i.e., to which extent > expected unexpected results are still unexpected results. But I > digress ...) > > Another note: the DEBUG build for ARM and AARCH64 is essentially NOOPT > already, not DEBUG. How does this patch intend to deal with that? It just copies the DEBUG settings to NOOPT (via deep copy, not by reference). I believe that's OK. Thanks Laszlo ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch V2] BaseTools: support the NOOPT target with the GCC tool chains 2016-10-05 17:56 ` Laszlo Ersek @ 2016-10-05 18:06 ` Ard Biesheuvel 2016-10-05 22:46 ` B Cran 0 siblings, 1 reply; 10+ messages in thread From: Ard Biesheuvel @ 2016-10-05 18:06 UTC (permalink / raw) To: Laszlo Ersek; +Cc: edk2-devel@lists.01.org, Liming Gao On 5 October 2016 at 18:56, Laszlo Ersek <lersek@redhat.com> wrote: > On 10/05/16 18:06, Ard Biesheuvel wrote: >> On 5 October 2016 at 15:48, Laszlo Ersek <lersek@redhat.com> wrote: >>> On 10/05/16 03:30, Yonghong Zhu wrote: >>>> Update the tools_def.template to add NOOPT support with GCC tool chains. >>>> >>>> Cc: Liming Gao <liming.gao@intel.com> >>>> Cc: Laszlo Ersek <lersek@redhat.com> >>>> Contributed-under: TianoCore Contribution Agreement 1.0 >>>> Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> >>>> --- >>>> BaseTools/Conf/tools_def.template | 28 ++++++++++++++++++++++++++++ >>>> 1 file changed, 28 insertions(+) >>> >>> I thought I understood what was going on, but apparently I was wrong >>> about that. >>> >>> In this patch, we add or modify: >>> - NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG -- okay >>> - NOOPT_GCC*_(IA32|X64|ARM|AARCH64)_CC_FLAGS -- okay >>> >>> So that part is fine with me. But then we also add / modify: >>> - NOOPT_GCC(49|5)_AARCH64_DLINK_(FLAGS|XIPFLAGS) >>> - NOOPT_GCC5_ARM_DLINK_FLAGS >>> >>> First I thought the latter set of changes was unnecessary, because "ld" >>> didn't use "-O". I checked the manual, and I was wrong: "ld" does know / >>> use "-O". So those changes are fine, I guess. >>> >> >> Yes, especially under LTO, in which case code generation is performed >> during the link stage, which should adhere to the same rules as the >> compiler. This not only applies to -O, but also to things like >> -march/-mcpu and -mstrict-align. This is why we pass all CFLAGS to the >> linker for the GCC5 LTO builds. >> >>> But then: is the patch *complete*? Because I can see some more DLINK >>> stuff, for IA32 and X64 (not just ARM and AARCH64). Is it okay to ignore >>> those? For example: >>> >>> *_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Os >>> -Wl,-m,elf_i386,--oformat=elf32-i386 >>> >>> >>> *_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -Os >>> >>> Where GCC5_X64_DLINK_FLAGS and GCC5_IA32_X64_DLINK_FLAGS even include >>> -flto. (I don't know if "-flto" hampers source level debugging or not.) >>> >> >> The GCC man page documents -flto as being a bad idea, i.e., >> >> """ >> Link-time optimization does not work well with generation of debugging >> information. Combining -flto with -g is currently experimental and >> expected to produce unexpected results. >> """ >> >> (which raises a philosophical question as well, i.e., to which extent >> expected unexpected results are still unexpected results. But I >> digress ...) >> >> Another note: the DEBUG build for ARM and AARCH64 is essentially NOOPT >> already, not DEBUG. How does this patch intend to deal with that? > > It just copies the DEBUG settings to NOOPT (via deep copy, not by > reference). I believe that's OK. > OK, fair enough. Leif and I can look into this in the future. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch V2] BaseTools: support the NOOPT target with the GCC tool chains 2016-10-05 18:06 ` Ard Biesheuvel @ 2016-10-05 22:46 ` B Cran 0 siblings, 0 replies; 10+ messages in thread From: B Cran @ 2016-10-05 22:46 UTC (permalink / raw) To: Ard Biesheuvel; +Cc: Laszlo Ersek, edk2-devel@lists.01.org, Liming Gao Tested-by: Bruce Cran <bruce.cran@gmail.com> > On Oct 5, 2016, at 12:06 PM, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote: > >> On 5 October 2016 at 18:56, Laszlo Ersek <lersek@redhat.com> wrote: >>> On 10/05/16 18:06, Ard Biesheuvel wrote: >>>> On 5 October 2016 at 15:48, Laszlo Ersek <lersek@redhat.com> wrote: >>>>> On 10/05/16 03:30, Yonghong Zhu wrote: >>>>> Update the tools_def.template to add NOOPT support with GCC tool chains. >>>>> >>>>> Cc: Liming Gao <liming.gao@intel.com> >>>>> Cc: Laszlo Ersek <lersek@redhat.com> >>>>> Contributed-under: TianoCore Contribution Agreement 1.0 >>>>> Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> >>>>> --- >>>>> BaseTools/Conf/tools_def.template | 28 ++++++++++++++++++++++++++++ >>>>> 1 file changed, 28 insertions(+) >>>> >>>> I thought I understood what was going on, but apparently I was wrong >>>> about that. >>>> >>>> In this patch, we add or modify: >>>> - NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG -- okay >>>> - NOOPT_GCC*_(IA32|X64|ARM|AARCH64)_CC_FLAGS -- okay >>>> >>>> So that part is fine with me. But then we also add / modify: >>>> - NOOPT_GCC(49|5)_AARCH64_DLINK_(FLAGS|XIPFLAGS) >>>> - NOOPT_GCC5_ARM_DLINK_FLAGS >>>> >>>> First I thought the latter set of changes was unnecessary, because "ld" >>>> didn't use "-O". I checked the manual, and I was wrong: "ld" does know / >>>> use "-O". So those changes are fine, I guess. >>>> >>> >>> Yes, especially under LTO, in which case code generation is performed >>> during the link stage, which should adhere to the same rules as the >>> compiler. This not only applies to -O, but also to things like >>> -march/-mcpu and -mstrict-align. This is why we pass all CFLAGS to the >>> linker for the GCC5 LTO builds. >>> >>>> But then: is the patch *complete*? Because I can see some more DLINK >>>> stuff, for IA32 and X64 (not just ARM and AARCH64). Is it okay to ignore >>>> those? For example: >>>> >>>> *_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Os >>>> -Wl,-m,elf_i386,--oformat=elf32-i386 >>>> >>>> >>>> *_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -Os >>>> >>>> Where GCC5_X64_DLINK_FLAGS and GCC5_IA32_X64_DLINK_FLAGS even include >>>> -flto. (I don't know if "-flto" hampers source level debugging or not.) >>>> >>> >>> The GCC man page documents -flto as being a bad idea, i.e., >>> >>> """ >>> Link-time optimization does not work well with generation of debugging >>> information. Combining -flto with -g is currently experimental and >>> expected to produce unexpected results. >>> """ >>> >>> (which raises a philosophical question as well, i.e., to which extent >>> expected unexpected results are still unexpected results. But I >>> digress ...) >>> >>> Another note: the DEBUG build for ARM and AARCH64 is essentially NOOPT >>> already, not DEBUG. How does this patch intend to deal with that? >> >> It just copies the DEBUG settings to NOOPT (via deep copy, not by >> reference). I believe that's OK. >> > > OK, fair enough. Leif and I can look into this in the future. > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch V2] BaseTools: support the NOOPT target with the GCC tool chains 2016-10-05 1:30 [Patch V2] BaseTools: support the NOOPT target with the GCC tool chains Yonghong Zhu 2016-10-05 14:48 ` Laszlo Ersek @ 2016-10-05 22:39 ` Bruce Cran 2016-10-06 8:19 ` Laszlo Ersek 1 sibling, 1 reply; 10+ messages in thread From: Bruce Cran @ 2016-10-05 22:39 UTC (permalink / raw) To: Yonghong Zhu, edk2-devel; +Cc: Laszlo Ersek, Liming Gao On 10/04/2016 07:30 PM, Yonghong Zhu wrote: > Update the tools_def.template to add NOOPT support with GCC tool chains. > > Cc: Liming Gao <liming.gao@intel.com> > Cc: Laszlo Ersek <lersek@redhat.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Bruce Cran <bruce.cran@gmail.com> Tested-by: Bruce Cran <bruce.cran@gmail.com> Tested with both GCC49 and GCC5 toolchain settings (using gcc 6.2.1 for both) and verified that both have functional debugging, though gdb skips around with GCC5 as expected due to LTCG. -- Bruce ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch V2] BaseTools: support the NOOPT target with the GCC tool chains 2016-10-05 22:39 ` Bruce Cran @ 2016-10-06 8:19 ` Laszlo Ersek 2016-10-06 8:20 ` Ard Biesheuvel 0 siblings, 1 reply; 10+ messages in thread From: Laszlo Ersek @ 2016-10-06 8:19 UTC (permalink / raw) To: Bruce Cran, Yonghong Zhu, edk2-devel; +Cc: Liming Gao, Ard Biesheuvel On 10/06/16 00:39, Bruce Cran wrote: > On 10/04/2016 07:30 PM, Yonghong Zhu wrote: > >> Update the tools_def.template to add NOOPT support with GCC tool chains. >> >> Cc: Liming Gao <liming.gao@intel.com> >> Cc: Laszlo Ersek <lersek@redhat.com> >> Contributed-under: TianoCore Contribution Agreement 1.0 >> Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> > > Reviewed-by: Bruce Cran <bruce.cran@gmail.com> > Tested-by: Bruce Cran <bruce.cran@gmail.com> > > Tested with both GCC49 and GCC5 toolchain settings (using gcc 6.2.1 for > both) and verified that both have functional debugging, though gdb skips > around with GCC5 as expected due to LTCG. > Right; as I mentioned up-thread, I wonder if we should disable -flto and -Os in NOOPT_GCC5_IA32_DLINK_FLAGS and NOOPT_GCC5_X64_DLINK_FLAGS. How about we add the following to Yonghong's v2? - first, move "-flto" from GCC5_IA32_X64_DLINK_FLAGS and GCC5_X64_DLINK_FLAGS to the users of those macros (both GCC5- and CLANG38-related users exist), - second, for the GCC5 users of these macros: split them into DEBUG/RELEASE/NOOPT, and remove -Os from NOOPT. The end result is that none of the earlier macro values change, except for NOOPT_GCC5_(IA32|X64)_DLINK_FLAGS; those two lose both -flto and -Os, which is our purpose. This would eliminate the skipping around that you mention. What do you guys think? See the patch below (again, to be applied on top of Yonghong's v2, or to be squashed into it). Thanks! Laszlo ------------------- diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index 2c0dcd67b906..60b2c2578f8d 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -4477,9 +4477,9 @@ DEFINE GCC5_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -flto -fno-built DEFINE GCC5_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -flto -fno-builtin -DUSING_LTO DEFINE GCC5_IA32_X64_DLINK_COMMON = DEF(GCC49_IA32_X64_DLINK_COMMON) DEFINE GCC5_IA32_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_ASLDLINK_FLAGS) -DEFINE GCC5_IA32_X64_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_FLAGS) -flto +DEFINE GCC5_IA32_X64_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_FLAGS) DEFINE GCC5_IA32_DLINK2_FLAGS = DEF(GCC49_IA32_DLINK2_FLAGS) -Wno-error -DEFINE GCC5_X64_DLINK_FLAGS = DEF(GCC49_X64_DLINK_FLAGS) -flto +DEFINE GCC5_X64_DLINK_FLAGS = DEF(GCC49_X64_DLINK_FLAGS) DEFINE GCC5_X64_DLINK2_FLAGS = DEF(GCC49_X64_DLINK2_FLAGS) -Wno-error DEFINE GCC5_ASM_FLAGS = DEF(GCC49_ASM_FLAGS) DEFINE GCC5_ARM_ASM_FLAGS = DEF(GCC49_ARM_ASM_FLAGS) @@ -5288,7 +5288,6 @@ RELEASE_GCC49_AARCH64_DLINK_FLAGS = DEF(GCC49_AARCH64_DLINK_FLAGS) *_GCC5_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32 -fno-lto *_GCC5_IA32_ASLDLINK_FLAGS = DEF(GCC5_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386 *_GCC5_IA32_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m32 -march=i386 -*_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Os -Wl,-m,elf_i386,--oformat=elf32-i386 *_GCC5_IA32_DLINK2_FLAGS = DEF(GCC5_IA32_DLINK2_FLAGS) *_GCC5_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS) *_GCC5_IA32_OBJCOPY_FLAGS = @@ -5298,6 +5297,10 @@ RELEASE_GCC49_AARCH64_DLINK_FLAGS = DEF(GCC49_AARCH64_DLINK_FLAGS) RELEASE_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable NOOPT_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -O0 + DEBUG_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Wl,-m,elf_i386,--oformat=elf32-i386 -flto -Os +RELEASE_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Wl,-m,elf_i386,--oformat=elf32-i386 -flto -Os + NOOPT_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Wl,-m,elf_i386,--oformat=elf32-i386 + ################## # GCC5 X64 definitions ################## @@ -5316,7 +5319,6 @@ RELEASE_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -Os -Wno-unused-but-s *_GCC5_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64 -fno-lto *_GCC5_X64_ASLDLINK_FLAGS = DEF(GCC5_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_x86_64 *_GCC5_X64_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m64 -*_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -Os *_GCC5_X64_DLINK2_FLAGS = DEF(GCC5_X64_DLINK2_FLAGS) *_GCC5_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS) *_GCC5_X64_OBJCOPY_FLAGS = @@ -5326,6 +5328,10 @@ RELEASE_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -Os -Wno-unused-but-s RELEASE_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -Wno-unused-but-set-variable NOOPT_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -O0 + DEBUG_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -flto -Os +RELEASE_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -flto -Os + NOOPT_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) + ################## # GCC5 ARM definitions ################## @@ -5516,7 +5522,7 @@ DEFINE CLANG38_ALL_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) -Wno-empty-body -f *_CLANG38_IA32_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m32 -march=i386 DEF(CLANG38_IA32_TARGET) DEBUG_CLANG38_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET) -g RELEASE_CLANG38_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET) -*_CLANG38_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Wl,-Oz -Wl,-melf_i386 -Wl,--oformat=elf32-i386 +*_CLANG38_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Wl,-Oz -Wl,-melf_i386 -Wl,--oformat=elf32-i386 *_CLANG38_IA32_DLINK2_FLAGS = DEF(GCC5_IA32_DLINK2_FLAGS) -O3 *_CLANG38_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS) *_CLANG38_IA32_OBJCOPY_FLAGS = @@ -5545,7 +5551,7 @@ RELEASE_CLANG38_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto - *_CLANG38_X64_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m64 DEF(CLANG38_X64_TARGET) DEBUG_CLANG38_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -fpie -Oz -flto DEF(CLANG38_X64_TARGET) -g RELEASE_CLANG38_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -fpie -Oz -flto DEF(CLANG38_X64_TARGET) -*_CLANG38_X64_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Wl,-Oz -Wl,-melf_x86_64 -Wl,--oformat=elf64-x86-64 -Wl,-pie -mcmodel=small +*_CLANG38_X64_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Wl,-Oz -Wl,-melf_x86_64 -Wl,--oformat=elf64-x86-64 -Wl,-pie -mcmodel=small *_CLANG38_X64_DLINK2_FLAGS = DEF(GCC5_X64_DLINK2_FLAGS) -O3 *_CLANG38_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS) *_CLANG38_X64_OBJCOPY_FLAGS = ------------------- ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [Patch V2] BaseTools: support the NOOPT target with the GCC tool chains 2016-10-06 8:19 ` Laszlo Ersek @ 2016-10-06 8:20 ` Ard Biesheuvel 2016-10-08 7:20 ` Gao, Liming 0 siblings, 1 reply; 10+ messages in thread From: Ard Biesheuvel @ 2016-10-06 8:20 UTC (permalink / raw) To: Laszlo Ersek Cc: Bruce Cran, Yonghong Zhu, edk2-devel@lists.01.org, Liming Gao On 6 October 2016 at 09:19, Laszlo Ersek <lersek@redhat.com> wrote: > On 10/06/16 00:39, Bruce Cran wrote: >> On 10/04/2016 07:30 PM, Yonghong Zhu wrote: >> >>> Update the tools_def.template to add NOOPT support with GCC tool chains. >>> >>> Cc: Liming Gao <liming.gao@intel.com> >>> Cc: Laszlo Ersek <lersek@redhat.com> >>> Contributed-under: TianoCore Contribution Agreement 1.0 >>> Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> >> >> Reviewed-by: Bruce Cran <bruce.cran@gmail.com> >> Tested-by: Bruce Cran <bruce.cran@gmail.com> >> >> Tested with both GCC49 and GCC5 toolchain settings (using gcc 6.2.1 for >> both) and verified that both have functional debugging, though gdb skips >> around with GCC5 as expected due to LTCG. >> > > Right; as I mentioned up-thread, I wonder if we should disable -flto and -Os in NOOPT_GCC5_IA32_DLINK_FLAGS and NOOPT_GCC5_X64_DLINK_FLAGS. > > How about we add the following to Yonghong's v2? > - first, move "-flto" from GCC5_IA32_X64_DLINK_FLAGS and GCC5_X64_DLINK_FLAGS to the users of those macros (both GCC5- and CLANG38-related users exist), > - second, for the GCC5 users of these macros: split them into DEBUG/RELEASE/NOOPT, and remove -Os from NOOPT. > > The end result is that none of the earlier macro values change, except for NOOPT_GCC5_(IA32|X64)_DLINK_FLAGS; those two lose both -flto and -Os, which is our purpose. This would eliminate the skipping around that you mention. > > What do you guys think? See the patch below (again, to be applied on top of Yonghong's v2, or to be squashed into it). > I agree. If we are going through the trouble of having a separate NOOPT flavor, it should at least do what it says on the tin. If it skips around, using it has no advantage over using DEBUG ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch V2] BaseTools: support the NOOPT target with the GCC tool chains 2016-10-06 8:20 ` Ard Biesheuvel @ 2016-10-08 7:20 ` Gao, Liming 0 siblings, 0 replies; 10+ messages in thread From: Gao, Liming @ 2016-10-08 7:20 UTC (permalink / raw) To: Ard Biesheuvel, Laszlo Ersek; +Cc: Bruce Cran, edk2-devel@lists.01.org I agree to disable LTO and Os in NOOPT target. ARM tool chain setting has disabled them in GCC5. We can refer to ARM setting, then update GCC5 IA32 and X86 arch. Thanks Liming > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Ard Biesheuvel > Sent: Thursday, October 06, 2016 4:21 PM > To: Laszlo Ersek <lersek@redhat.com> > Cc: Bruce Cran <bruce@cran.org.uk>; edk2-devel@lists.01.org <edk2- > devel@ml01.01.org>; Gao, Liming <liming.gao@intel.com> > Subject: Re: [edk2] [Patch V2] BaseTools: support the NOOPT target with the > GCC tool chains > > On 6 October 2016 at 09:19, Laszlo Ersek <lersek@redhat.com> wrote: > > On 10/06/16 00:39, Bruce Cran wrote: > >> On 10/04/2016 07:30 PM, Yonghong Zhu wrote: > >> > >>> Update the tools_def.template to add NOOPT support with GCC tool > chains. > >>> > >>> Cc: Liming Gao <liming.gao@intel.com> > >>> Cc: Laszlo Ersek <lersek@redhat.com> > >>> Contributed-under: TianoCore Contribution Agreement 1.0 > >>> Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> > >> > >> Reviewed-by: Bruce Cran <bruce.cran@gmail.com> > >> Tested-by: Bruce Cran <bruce.cran@gmail.com> > >> > >> Tested with both GCC49 and GCC5 toolchain settings (using gcc 6.2.1 for > >> both) and verified that both have functional debugging, though gdb skips > >> around with GCC5 as expected due to LTCG. > >> > > > > Right; as I mentioned up-thread, I wonder if we should disable -flto and -Os > in NOOPT_GCC5_IA32_DLINK_FLAGS and NOOPT_GCC5_X64_DLINK_FLAGS. > > > > How about we add the following to Yonghong's v2? > > - first, move "-flto" from GCC5_IA32_X64_DLINK_FLAGS and > GCC5_X64_DLINK_FLAGS to the users of those macros (both GCC5- and > CLANG38-related users exist), > > - second, for the GCC5 users of these macros: split them into > DEBUG/RELEASE/NOOPT, and remove -Os from NOOPT. > > > > The end result is that none of the earlier macro values change, except for > NOOPT_GCC5_(IA32|X64)_DLINK_FLAGS; those two lose both -flto and -Os, > which is our purpose. This would eliminate the skipping around that you > mention. > > > > What do you guys think? See the patch below (again, to be applied on top > of Yonghong's v2, or to be squashed into it). > > > > I agree. If we are going through the trouble of having a separate > NOOPT flavor, it should at least do what it says on the tin. If it > skips around, using it has no advantage over using DEBUG > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2016-10-08 7:20 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-10-05 1:30 [Patch V2] BaseTools: support the NOOPT target with the GCC tool chains Yonghong Zhu 2016-10-05 14:48 ` Laszlo Ersek 2016-10-05 16:06 ` Ard Biesheuvel 2016-10-05 17:56 ` Laszlo Ersek 2016-10-05 18:06 ` Ard Biesheuvel 2016-10-05 22:46 ` B Cran 2016-10-05 22:39 ` Bruce Cran 2016-10-06 8:19 ` Laszlo Ersek 2016-10-06 8:20 ` Ard Biesheuvel 2016-10-08 7:20 ` Gao, Liming
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox