Re: [edk2] [PATCH v2 2/2] BaseTools GCC: add support for GCC/X64 and GCC/AARCH64 in LTO mode
On 23 July 2016 at 03:34, Jordan Justenwrote: > On 2016-07-22 14:46:54, Ard Biesheuvel wrote: >> On 22 July 2016 at 23:19, Jordan Justen wrote: >> > I think the subject should include be something like "add GCC5 >> > toolchain for X64/AARCH64 with LTO support". >> > >> > On 2016-07-18 05:09:15, Ard Biesheuvel wrote: >> >> This adds support for GCC 5.x in LTO mode for IA32, X64, ARM and >> >> AARCH64. Due to the fact that the GCC project switched to a new >> >> numbering scheme where the first digit is now incremented for every >> >> major release, the new toolchain is simply called 'GCC5', and is >> >> intended to support all GCC v5.x releases. >> >> >> >> Note that this requires the use of an wrapper script, since the GCC >> >> toolchain family usually invokes the linker directly, whereas LTO >> >> requires GCC to be invoked with the linker arguments decorated with >> >> -Wl,xxx prefixes. >> > >> > Does it require the wrapper script? Steven's GCC5 toolchain didn't >> > have it. Also, I was able to convert the GCC49 toolchain to invoke gcc >> > for the linker, rather than ld. Like Steven's GCC5, I had to add -Wl >> > to various flags. Based on this, I was wondering if we could just >> > convert all of the GCC toolchains to invoke gcc for linking. >> > >> >> Steven's patches introduced a new build rule family, which I would >> like to avoid, since it would make GCC:xxx [BuildOptions] sections >> mutually incompatible between GCC44 - GCC49 and GCC5 and later, which >> would probably result in some packages being left behind, and new >> packages not bothering to add support for GCC49 and older. Packages >> supporting both would need to add explicit rules for each GCCx >> version, which is also not great for maintainability. As it turns out, >> we don't have that many DLINK or DLINK2 flags in our various .DSC and >> .INF files, but the ones we do have need to be fixed up at the same >> time that the build rule is updated. >> >> So if nobody is opposed to having a flag day, and switch over all of >> Tianocore to use the 'gcc' executable as the linker, and fix up all >> the fallout in a single patch, I'm up for it. >> > > My first choice would be to convert all the toolchains to use gcc for > linking. I'm not certain it will work for all toolchains though. > > My second choice would be to just add another build rule family. I > think it is less of a hassle than a new wrapper tool. (The issues > Liming raises...) > Yes, using a wrapper script is a concern. I think adding a build rule family is the best option, but I would prefer to add one in a way that does not split GCC44 - GCC49 and CLANG35 on the one hand and GCC5 and up on the other. So I will rewrite this to move the 'legacy' GCC toolchains to a cloned GCCLD build rule family, and apply subsequent changes to move to 'gcc' as the linker to GCC44 and up ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v2 2/2] BaseTools GCC: add support for GCC/X64 and GCC/AARCH64 in LTO mode
On 2016-07-22 14:46:54, Ard Biesheuvel wrote: > On 22 July 2016 at 23:19, Jordan Justenwrote: > > I think the subject should include be something like "add GCC5 > > toolchain for X64/AARCH64 with LTO support". > > > > On 2016-07-18 05:09:15, Ard Biesheuvel wrote: > >> This adds support for GCC 5.x in LTO mode for IA32, X64, ARM and > >> AARCH64. Due to the fact that the GCC project switched to a new > >> numbering scheme where the first digit is now incremented for every > >> major release, the new toolchain is simply called 'GCC5', and is > >> intended to support all GCC v5.x releases. > >> > >> Note that this requires the use of an wrapper script, since the GCC > >> toolchain family usually invokes the linker directly, whereas LTO > >> requires GCC to be invoked with the linker arguments decorated with > >> -Wl,xxx prefixes. > > > > Does it require the wrapper script? Steven's GCC5 toolchain didn't > > have it. Also, I was able to convert the GCC49 toolchain to invoke gcc > > for the linker, rather than ld. Like Steven's GCC5, I had to add -Wl > > to various flags. Based on this, I was wondering if we could just > > convert all of the GCC toolchains to invoke gcc for linking. > > > > Steven's patches introduced a new build rule family, which I would > like to avoid, since it would make GCC:xxx [BuildOptions] sections > mutually incompatible between GCC44 - GCC49 and GCC5 and later, which > would probably result in some packages being left behind, and new > packages not bothering to add support for GCC49 and older. Packages > supporting both would need to add explicit rules for each GCCx > version, which is also not great for maintainability. As it turns out, > we don't have that many DLINK or DLINK2 flags in our various .DSC and > .INF files, but the ones we do have need to be fixed up at the same > time that the build rule is updated. > > So if nobody is opposed to having a flag day, and switch over all of > Tianocore to use the 'gcc' executable as the linker, and fix up all > the fallout in a single patch, I'm up for it. > My first choice would be to convert all the toolchains to use gcc for linking. I'm not certain it will work for all toolchains though. My second choice would be to just add another build rule family. I think it is less of a hassle than a new wrapper tool. (The issues Liming raises...) -Jordan > > >> > >> Since IA32 and X64 enable compiler optimizations (-Os) for both DEBUG > >> and RELEASE builds, LTO support is equally enabled for both targets. > >> On ARM and AARCH64, DEBUG builds are not optimized, and so the LTO > >> optimizations are only enabled for RELEASE. > >> > >> Contributed-under: TianoCore Contribution Agreement 1.0 > >> Signed-off-by: Ard Biesheuvel > >> --- > >> BaseTools/Conf/tools_def.template | 156 > >> BaseTools/Scripts/lto-ld-wrapper.py | 39 + > >> 2 files changed, 195 insertions(+) > >> > >> diff --git a/BaseTools/Conf/tools_def.template > >> b/BaseTools/Conf/tools_def.template > >> index f9b26fad44de..56bcf04690d4 100644 > >> --- a/BaseTools/Conf/tools_def.template > >> +++ b/BaseTools/Conf/tools_def.template > >> @@ -197,6 +197,9 @@ DEFINE GCC48_X64_PREFIX= ENV(GCC48_BIN) > >> DEFINE GCC49_IA32_PREFIX = ENV(GCC49_BIN) > >> DEFINE GCC49_X64_PREFIX= ENV(GCC49_BIN) > >> > >> +DEFINE GCC5_IA32_PREFIX= ENV(GCC5_BIN) > >> +DEFINE GCC5_X64_PREFIX = ENV(GCC5_BIN) > >> + > >> DEFINE UNIX_IASL_BIN = ENV(IASL_PREFIX)iasl > >> DEFINE WIN_ASL_BIN_DIR = C:\ASL > >> DEFINE WIN_IASL_BIN= DEF(WIN_ASL_BIN_DIR)\iasl.exe > >> @@ -4450,6 +4453,27 @@ DEFINE GCC49_AARCH64_DLINK2_FLAGS= > >> DEF(GCC48_AARCH64_DLINK2_FLAGS) > >> DEFINE GCC49_ARM_ASLDLINK_FLAGS = DEF(GCC48_ARM_ASLDLINK_FLAGS) > >> DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS) > >> > >> +DEFINE GCC5_IA32_CC_FLAGS= DEF(GCC49_IA32_CC_FLAGS) -flto > >> +DEFINE GCC5_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -flto > >> +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_DLINK2_FLAGS= DEF(GCC49_IA32_DLINK2_FLAGS) > >> +DEFINE GCC5_X64_DLINK_FLAGS = DEF(GCC49_X64_DLINK_FLAGS) > >> +DEFINE GCC5_X64_DLINK2_FLAGS = DEF(GCC49_X64_DLINK2_FLAGS) > >> +DEFINE GCC5_ASM_FLAGS= DEF(GCC49_ASM_FLAGS) > >> +DEFINE GCC5_ARM_ASM_FLAGS= DEF(GCC49_ARM_ASM_FLAGS) > >> +DEFINE GCC5_AARCH64_ASM_FLAGS= DEF(GCC49_AARCH64_ASM_FLAGS) > >> +DEFINE GCC5_ARM_CC_FLAGS = DEF(GCC49_ARM_CC_FLAGS) > >> +DEFINE GCC5_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) > >> +DEFINE GCC5_AARCH64_CC_XIPFLAGS = DEF(GCC49_AARCH64_CC_XIPFLAGS) > >>
Re: [edk2] [PATCH v2 2/2] BaseTools GCC: add support for GCC/X64 and GCC/AARCH64 in LTO mode
On 22 July 2016 at 23:19, Jordan Justenwrote: > I think the subject should include be something like "add GCC5 > toolchain for X64/AARCH64 with LTO support". > > On 2016-07-18 05:09:15, Ard Biesheuvel wrote: >> This adds support for GCC 5.x in LTO mode for IA32, X64, ARM and >> AARCH64. Due to the fact that the GCC project switched to a new >> numbering scheme where the first digit is now incremented for every >> major release, the new toolchain is simply called 'GCC5', and is >> intended to support all GCC v5.x releases. >> >> Note that this requires the use of an wrapper script, since the GCC >> toolchain family usually invokes the linker directly, whereas LTO >> requires GCC to be invoked with the linker arguments decorated with >> -Wl,xxx prefixes. > > Does it require the wrapper script? Steven's GCC5 toolchain didn't > have it. Also, I was able to convert the GCC49 toolchain to invoke gcc > for the linker, rather than ld. Like Steven's GCC5, I had to add -Wl > to various flags. Based on this, I was wondering if we could just > convert all of the GCC toolchains to invoke gcc for linking. > Steven's patches introduced a new build rule family, which I would like to avoid, since it would make GCC:xxx [BuildOptions] sections mutually incompatible between GCC44 - GCC49 and GCC5 and later, which would probably result in some packages being left behind, and new packages not bothering to add support for GCC49 and older. Packages supporting both would need to add explicit rules for each GCCx version, which is also not great for maintainability. As it turns out, we don't have that many DLINK or DLINK2 flags in our various .DSC and .INF files, but the ones we do have need to be fixed up at the same time that the build rule is updated. So if nobody is opposed to having a flag day, and switch over all of Tianocore to use the 'gcc' executable as the linker, and fix up all the fallout in a single patch, I'm up for it. -- Ard. >> >> Since IA32 and X64 enable compiler optimizations (-Os) for both DEBUG >> and RELEASE builds, LTO support is equally enabled for both targets. >> On ARM and AARCH64, DEBUG builds are not optimized, and so the LTO >> optimizations are only enabled for RELEASE. >> >> Contributed-under: TianoCore Contribution Agreement 1.0 >> Signed-off-by: Ard Biesheuvel >> --- >> BaseTools/Conf/tools_def.template | 156 >> BaseTools/Scripts/lto-ld-wrapper.py | 39 + >> 2 files changed, 195 insertions(+) >> >> diff --git a/BaseTools/Conf/tools_def.template >> b/BaseTools/Conf/tools_def.template >> index f9b26fad44de..56bcf04690d4 100644 >> --- a/BaseTools/Conf/tools_def.template >> +++ b/BaseTools/Conf/tools_def.template >> @@ -197,6 +197,9 @@ DEFINE GCC48_X64_PREFIX= ENV(GCC48_BIN) >> DEFINE GCC49_IA32_PREFIX = ENV(GCC49_BIN) >> DEFINE GCC49_X64_PREFIX= ENV(GCC49_BIN) >> >> +DEFINE GCC5_IA32_PREFIX= ENV(GCC5_BIN) >> +DEFINE GCC5_X64_PREFIX = ENV(GCC5_BIN) >> + >> DEFINE UNIX_IASL_BIN = ENV(IASL_PREFIX)iasl >> DEFINE WIN_ASL_BIN_DIR = C:\ASL >> DEFINE WIN_IASL_BIN= DEF(WIN_ASL_BIN_DIR)\iasl.exe >> @@ -4450,6 +4453,27 @@ DEFINE GCC49_AARCH64_DLINK2_FLAGS= >> DEF(GCC48_AARCH64_DLINK2_FLAGS) >> DEFINE GCC49_ARM_ASLDLINK_FLAGS = DEF(GCC48_ARM_ASLDLINK_FLAGS) >> DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS) >> >> +DEFINE GCC5_IA32_CC_FLAGS= DEF(GCC49_IA32_CC_FLAGS) -flto >> +DEFINE GCC5_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -flto >> +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_DLINK2_FLAGS= DEF(GCC49_IA32_DLINK2_FLAGS) >> +DEFINE GCC5_X64_DLINK_FLAGS = DEF(GCC49_X64_DLINK_FLAGS) >> +DEFINE GCC5_X64_DLINK2_FLAGS = DEF(GCC49_X64_DLINK2_FLAGS) >> +DEFINE GCC5_ASM_FLAGS= DEF(GCC49_ASM_FLAGS) >> +DEFINE GCC5_ARM_ASM_FLAGS= DEF(GCC49_ARM_ASM_FLAGS) >> +DEFINE GCC5_AARCH64_ASM_FLAGS= DEF(GCC49_AARCH64_ASM_FLAGS) >> +DEFINE GCC5_ARM_CC_FLAGS = DEF(GCC49_ARM_CC_FLAGS) >> +DEFINE GCC5_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) >> +DEFINE GCC5_AARCH64_CC_XIPFLAGS = DEF(GCC49_AARCH64_CC_XIPFLAGS) >> +DEFINE GCC5_ARM_DLINK_FLAGS = DEF(GCC49_ARM_DLINK_FLAGS) -flto >> +DEFINE GCC5_ARM_DLINK2_FLAGS = DEF(GCC49_ARM_DLINK2_FLAGS) >> +DEFINE GCC5_AARCH64_DLINK_FLAGS = DEF(GCC49_AARCH64_DLINK_FLAGS) -flto >> +DEFINE GCC5_AARCH64_DLINK2_FLAGS = DEF(GCC49_AARCH64_DLINK2_FLAGS) >> +DEFINE GCC5_ARM_ASLDLINK_FLAGS = DEF(GCC49_ARM_ASLDLINK_FLAGS) >> +DEFINE GCC5_AARCH64_ASLDLINK_FLAGS = DEF(GCC49_AARCH64_ASLDLINK_FLAGS) >> + >> >>
Re: [edk2] [PATCH v2 2/2] BaseTools GCC: add support for GCC/X64 and GCC/AARCH64 in LTO mode
I think the subject should include be something like "add GCC5 toolchain for X64/AARCH64 with LTO support". On 2016-07-18 05:09:15, Ard Biesheuvel wrote: > This adds support for GCC 5.x in LTO mode for IA32, X64, ARM and > AARCH64. Due to the fact that the GCC project switched to a new > numbering scheme where the first digit is now incremented for every > major release, the new toolchain is simply called 'GCC5', and is > intended to support all GCC v5.x releases. > > Note that this requires the use of an wrapper script, since the GCC > toolchain family usually invokes the linker directly, whereas LTO > requires GCC to be invoked with the linker arguments decorated with > -Wl,xxx prefixes. Does it require the wrapper script? Steven's GCC5 toolchain didn't have it. Also, I was able to convert the GCC49 toolchain to invoke gcc for the linker, rather than ld. Like Steven's GCC5, I had to add -Wl to various flags. Based on this, I was wondering if we could just convert all of the GCC toolchains to invoke gcc for linking. -Jordan > > Since IA32 and X64 enable compiler optimizations (-Os) for both DEBUG > and RELEASE builds, LTO support is equally enabled for both targets. > On ARM and AARCH64, DEBUG builds are not optimized, and so the LTO > optimizations are only enabled for RELEASE. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Ard Biesheuvel> --- > BaseTools/Conf/tools_def.template | 156 > BaseTools/Scripts/lto-ld-wrapper.py | 39 + > 2 files changed, 195 insertions(+) > > diff --git a/BaseTools/Conf/tools_def.template > b/BaseTools/Conf/tools_def.template > index f9b26fad44de..56bcf04690d4 100644 > --- a/BaseTools/Conf/tools_def.template > +++ b/BaseTools/Conf/tools_def.template > @@ -197,6 +197,9 @@ DEFINE GCC48_X64_PREFIX= ENV(GCC48_BIN) > DEFINE GCC49_IA32_PREFIX = ENV(GCC49_BIN) > DEFINE GCC49_X64_PREFIX= ENV(GCC49_BIN) > > +DEFINE GCC5_IA32_PREFIX= ENV(GCC5_BIN) > +DEFINE GCC5_X64_PREFIX = ENV(GCC5_BIN) > + > DEFINE UNIX_IASL_BIN = ENV(IASL_PREFIX)iasl > DEFINE WIN_ASL_BIN_DIR = C:\ASL > DEFINE WIN_IASL_BIN= DEF(WIN_ASL_BIN_DIR)\iasl.exe > @@ -4450,6 +4453,27 @@ DEFINE GCC49_AARCH64_DLINK2_FLAGS= > DEF(GCC48_AARCH64_DLINK2_FLAGS) > DEFINE GCC49_ARM_ASLDLINK_FLAGS = DEF(GCC48_ARM_ASLDLINK_FLAGS) > DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS) > > +DEFINE GCC5_IA32_CC_FLAGS= DEF(GCC49_IA32_CC_FLAGS) -flto > +DEFINE GCC5_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -flto > +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_DLINK2_FLAGS= DEF(GCC49_IA32_DLINK2_FLAGS) > +DEFINE GCC5_X64_DLINK_FLAGS = DEF(GCC49_X64_DLINK_FLAGS) > +DEFINE GCC5_X64_DLINK2_FLAGS = DEF(GCC49_X64_DLINK2_FLAGS) > +DEFINE GCC5_ASM_FLAGS= DEF(GCC49_ASM_FLAGS) > +DEFINE GCC5_ARM_ASM_FLAGS= DEF(GCC49_ARM_ASM_FLAGS) > +DEFINE GCC5_AARCH64_ASM_FLAGS= DEF(GCC49_AARCH64_ASM_FLAGS) > +DEFINE GCC5_ARM_CC_FLAGS = DEF(GCC49_ARM_CC_FLAGS) > +DEFINE GCC5_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) > +DEFINE GCC5_AARCH64_CC_XIPFLAGS = DEF(GCC49_AARCH64_CC_XIPFLAGS) > +DEFINE GCC5_ARM_DLINK_FLAGS = DEF(GCC49_ARM_DLINK_FLAGS) -flto > +DEFINE GCC5_ARM_DLINK2_FLAGS = DEF(GCC49_ARM_DLINK2_FLAGS) > +DEFINE GCC5_AARCH64_DLINK_FLAGS = DEF(GCC49_AARCH64_DLINK_FLAGS) -flto > +DEFINE GCC5_AARCH64_DLINK2_FLAGS = DEF(GCC49_AARCH64_DLINK2_FLAGS) > +DEFINE GCC5_ARM_ASLDLINK_FLAGS = DEF(GCC49_ARM_ASLDLINK_FLAGS) > +DEFINE GCC5_AARCH64_ASLDLINK_FLAGS = DEF(GCC49_AARCH64_ASLDLINK_FLAGS) > + > > > # > # Unix GCC And Intel Linux ACPI Compiler > @@ -5183,6 +5207,138 @@ RELEASE_GCC49_AARCH64_DLINK_FLAGS = > DEF(GCC49_AARCH64_DLINK_FLAGS) > > > > # > +# GCC 5 - This configuration is used to compile under Linux to produce > +# PE/COFF binaries using GCC 5 > +# > + > +*_GCC5_*_*_FAMILY= GCC > + > +*_GCC5_*_MAKE_PATH = DEF(GCC5_IA32_PREFIX)make > +*_GCC5_*_*_DLL = ENV(GCC5_DLL) > +*_GCC5_*_ASL_PATH= DEF(UNIX_IASL_BIN) > + > +*_GCC5_*_PP_FLAGS= DEF(GCC_PP_FLAGS) > +*_GCC5_*_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) > +*_GCC5_*_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) > +*_GCC5_*_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) > +*_GCC5_*_APP_FLAGS = >
Re: [edk2] [PATCH v2 2/2] BaseTools GCC: add support for GCC/X64 and GCC/AARCH64 in LTO mode
On 22 July 2016 at 10:38, Gao, Limingwrote: > Ard: > I have some comments on GCC5 DLINK PATH definition. *_GCC5_*_DLINK_PATH > = $(EDK_TOOLS_PATH)/Scripts/lto-ld-wrapper.py > 1) It directly points to python script. In OS, python script need be trigged > by python execute. > 2) Most windows users directly use the binary base tools. They may not > install python, and not directly use python script in build process. This > patch still breaks windows GCC5 build. > > So, I suggest: > 1) Add lto-ld-wrapper script in BaseTools/BinWrappers/PosixLike to call > $(EDK_TOOLS_PATH)/Scripts/lto-ld-wrapper.py for Linux > 2) Freeze $(EDK_TOOLS_PATH)/Scripts/lto-ld-wrapper.py to > $(EDK_TOOLS_PATH)/Scripts/lto-ld-wrapper.exe for Windows > 3) Define *_GCC5_*_DLINK_PATH = > ENV(LTO_LD_PREFIX)lto-ld-wrapper, then Windows user can configure > LTO_LD_PREFIX evn to use it. > > And, for lto-ld-wrapper.py script, it should print the full command before > execute it so that user knows the real commands > OK. > Last, on GCC5 DLINK and DLINK_FLAGS. There are two styles to define them. I > prefer style 2 to keep DLINK_FALGS without changes. > 1) > *_GCC5_*_DLINK_PATH = ENV(LTO_LD_PREFIX)lto-ld-wrapper > *_GCC5_IA32_DLINK_FLAGS = --cc "DEF(GCC5_IA32_PREFIX)gcc" > DEF(GCC5_IA32_X64_DLINK_FLAGS) -m elf_i386 --oformat=elf32-i386 > > 2) > *_GCC5_*_DLINK_PATH = ENV(LTO_LD_PREFIX)lto-ld-wrapper --cc > "DEF(GCC5_IA32_PREFIX)gcc" > *_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -m elf_i386 > --oformat=elf32-i386 > That does not work, unfortunately. The build rule puts quotes around the path, and so the --cc argument becomes part of argument 0, e.g., /bin/sh: 1: lto-ld-wrapper --cc aarch64-linux-gnu-gcc: not found due to "$(DLINK)" -o ${dst} $(DLINK_FLAGS) --start-group $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) --end-group $(DLINK2_FLAGS) "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst} ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v2 2/2] BaseTools GCC: add support for GCC/X64 and GCC/AARCH64 in LTO mode
Ard: I have some comments on GCC5 DLINK PATH definition. *_GCC5_*_DLINK_PATH = $(EDK_TOOLS_PATH)/Scripts/lto-ld-wrapper.py 1) It directly points to python script. In OS, python script need be trigged by python execute. 2) Most windows users directly use the binary base tools. They may not install python, and not directly use python script in build process. This patch still breaks windows GCC5 build. So, I suggest: 1) Add lto-ld-wrapper script in BaseTools/BinWrappers/PosixLike to call $(EDK_TOOLS_PATH)/Scripts/lto-ld-wrapper.py for Linux 2) Freeze $(EDK_TOOLS_PATH)/Scripts/lto-ld-wrapper.py to $(EDK_TOOLS_PATH)/Scripts/lto-ld-wrapper.exe for Windows 3) Define *_GCC5_*_DLINK_PATH = ENV(LTO_LD_PREFIX)lto-ld-wrapper, then Windows user can configure LTO_LD_PREFIX evn to use it. And, for lto-ld-wrapper.py script, it should print the full command before execute it so that user knows the real commands Last, on GCC5 DLINK and DLINK_FLAGS. There are two styles to define them. I prefer style 2 to keep DLINK_FALGS without changes. 1) *_GCC5_*_DLINK_PATH = ENV(LTO_LD_PREFIX)lto-ld-wrapper *_GCC5_IA32_DLINK_FLAGS = --cc "DEF(GCC5_IA32_PREFIX)gcc" DEF(GCC5_IA32_X64_DLINK_FLAGS) -m elf_i386 --oformat=elf32-i386 2) *_GCC5_*_DLINK_PATH = ENV(LTO_LD_PREFIX)lto-ld-wrapper --cc "DEF(GCC5_IA32_PREFIX)gcc" *_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -m elf_i386 --oformat=elf32-i386 Thanks Liming > -Original Message- > From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org] > Sent: Monday, July 18, 2016 8:09 PM > To: edk2-devel@lists.01.org; ler...@redhat.com; Gao, Liming >; Shi, Steven ; Zhu, > Yonghong ; Kinney, Michael D > ; Justen, Jordan L > Cc: leif.lindh...@linaro.org; Ard Biesheuvel > Subject: [PATCH v2 2/2] BaseTools GCC: add support for GCC/X64 and > GCC/AARCH64 in LTO mode > > This adds support for GCC 5.x in LTO mode for IA32, X64, ARM and > AARCH64. Due to the fact that the GCC project switched to a new > numbering scheme where the first digit is now incremented for every > major release, the new toolchain is simply called 'GCC5', and is > intended to support all GCC v5.x releases. > > Note that this requires the use of an wrapper script, since the GCC > toolchain family usually invokes the linker directly, whereas LTO > requires GCC to be invoked with the linker arguments decorated with > -Wl,xxx prefixes. > > Since IA32 and X64 enable compiler optimizations (-Os) for both DEBUG > and RELEASE builds, LTO support is equally enabled for both targets. > On ARM and AARCH64, DEBUG builds are not optimized, and so the LTO > optimizations are only enabled for RELEASE. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Ard Biesheuvel > --- > BaseTools/Conf/tools_def.template | 156 > BaseTools/Scripts/lto-ld-wrapper.py | 39 + > 2 files changed, 195 insertions(+) > > diff --git a/BaseTools/Conf/tools_def.template > b/BaseTools/Conf/tools_def.template > index f9b26fad44de..56bcf04690d4 100644 > --- a/BaseTools/Conf/tools_def.template > +++ b/BaseTools/Conf/tools_def.template > @@ -197,6 +197,9 @@ DEFINE GCC48_X64_PREFIX= ENV(GCC48_BIN) > DEFINE GCC49_IA32_PREFIX = ENV(GCC49_BIN) > DEFINE GCC49_X64_PREFIX= ENV(GCC49_BIN) > > +DEFINE GCC5_IA32_PREFIX= ENV(GCC5_BIN) > +DEFINE GCC5_X64_PREFIX = ENV(GCC5_BIN) > + > DEFINE UNIX_IASL_BIN = ENV(IASL_PREFIX)iasl > DEFINE WIN_ASL_BIN_DIR = C:\ASL > DEFINE WIN_IASL_BIN= DEF(WIN_ASL_BIN_DIR)\iasl.exe > @@ -4450,6 +4453,27 @@ DEFINE GCC49_AARCH64_DLINK2_FLAGS= > DEF(GCC48_AARCH64_DLINK2_FLAGS) > DEFINE GCC49_ARM_ASLDLINK_FLAGS = > DEF(GCC48_ARM_ASLDLINK_FLAGS) > DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = > DEF(GCC48_AARCH64_ASLDLINK_FLAGS) > > +DEFINE GCC5_IA32_CC_FLAGS= DEF(GCC49_IA32_CC_FLAGS) -flto > +DEFINE GCC5_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -flto > +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_DLINK2_FLAGS= DEF(GCC49_IA32_DLINK2_FLAGS) > +DEFINE GCC5_X64_DLINK_FLAGS = DEF(GCC49_X64_DLINK_FLAGS) > +DEFINE GCC5_X64_DLINK2_FLAGS = DEF(GCC49_X64_DLINK2_FLAGS) > +DEFINE GCC5_ASM_FLAGS= DEF(GCC49_ASM_FLAGS) > +DEFINE GCC5_ARM_ASM_FLAGS= DEF(GCC49_ARM_ASM_FLAGS) > +DEFINE GCC5_AARCH64_ASM_FLAGS= > DEF(GCC49_AARCH64_ASM_FLAGS) > +DEFINE GCC5_ARM_CC_FLAGS = DEF(GCC49_ARM_CC_FLAGS) > +DEFINE GCC5_AARCH64_CC_FLAGS =