* [PATCH 0/1] BaseTools: Use SEH exceptions in CLANGPDB for IA32 @ 2020-03-27 10:45 Vitaly Cheptsov 2020-03-27 10:45 ` [PATCH 1/1] " Vitaly Cheptsov 0 siblings, 1 reply; 4+ messages in thread From: Vitaly Cheptsov @ 2020-03-27 10:45 UTC (permalink / raw) To: devel; +Cc: Liming Gao, Marvin Häuser, Zhiguang Liu From: Vitaly Cheptsov <vit9696@protonmail.com> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2628 Requesting for merge in edk2-stable202005. CC: Liming Gao <liming.gao@intel.com> CC: Marvin Häuser <mhaeuser@outlook.de> CC: Zhiguang Liu <zhiguang.liu@intel.com> Vitaly Cheptsov (1): BaseTools: Use SEH exceptions in CLANGPDB for IA32 BaseTools/Conf/tools_def.template | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.24.1 (Apple Git-126) ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/1] BaseTools: Use SEH exceptions in CLANGPDB for IA32 2020-03-27 10:45 [PATCH 0/1] BaseTools: Use SEH exceptions in CLANGPDB for IA32 Vitaly Cheptsov @ 2020-03-27 10:45 ` Vitaly Cheptsov 2020-03-30 3:26 ` [edk2-devel] " Zhiguang Liu 0 siblings, 1 reply; 4+ messages in thread From: Vitaly Cheptsov @ 2020-03-27 10:45 UTC (permalink / raw) To: devel; +Cc: Liming Gao, Marvin Häuser, Zhiguang Liu From: Vitaly Cheptsov <vit9696@protonmail.com> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2628 This patch reduces the size of IA32 binaries by ensuring that no .debug_frame / .eh_frame sections are generated through forcing SEH exception model, which is already the default in clang for X64. EDK II does not support exceptions, and in future we should disable them instead of switching to some other variant. Currently this is not possible due to the following LLVM bugs: https://bugs.llvm.org/show_bug.cgi?id=45324 https://bugs.llvm.org/show_bug.cgi?id=45325 Upon applying this patch OvmfPkgIA32.dsc compilation in DEBUG mode gets the following size decrease with clang 9.0.1. Before: FV Space Information SECFV [11%Full] 212992 total, 24512 used, 188480 free PEIFV [22%Full] 917504 total, 203048 used, 714456 free DXEFV [36%Full] 11534336 total, 4215672 used, 7318664 free FVMAIN_COMPACT [37%Full] 3440640 total, 1287776 used, 2152864 free After: FV Space Information SECFV [10%Full] 212992 total, 22112 used, 190880 free PEIFV [19%Full] 917504 total, 176392 used, 741112 free DXEFV [31%Full] 11534336 total, 3657112 used, 7877224 free FVMAIN_COMPACT [33%Full] 3440640 total, 1153896 used, 2286744 free CC: Liming Gao <liming.gao@intel.com> CC: Marvin Häuser <mhaeuser@outlook.de> CC: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com> --- BaseTools/Conf/tools_def.template | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index 2b17d3b297..88d7ab8cab 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -2759,7 +2759,7 @@ DEFINE CLANGPDB_IA32_TARGET = -target i686-unknown-windows-gnu DEFINE CLANGPDB_X64_TARGET = -target x86_64-unknown-windows-gnu DEFINE CLANGPDB_WARNING_OVERRIDES = -Wno-parentheses-equality -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare -Wno-empty-body -Wno-unused-const-variable -Wno-varargs -Wno-unknown-warning-option -Wno-microsoft-enum-forward-reference -DEFINE CLANGPDB_ALL_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) DEF(CLANGPDB_WARNING_OVERRIDES) -fno-stack-protector -funsigned-char -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas -Wno-incompatible-library-redeclaration -Wno-null-dereference -mno-implicit-float -mms-bitfields -mno-stack-arg-probe -nostdlib -nostdlibinc +DEFINE CLANGPDB_ALL_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) DEF(CLANGPDB_WARNING_OVERRIDES) -fno-stack-protector -funsigned-char -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas -Wno-incompatible-library-redeclaration -Wno-null-dereference -mno-implicit-float -mms-bitfields -mno-stack-arg-probe -nostdlib -nostdlibinc -fseh-exceptions ########################### # CLANGPDB IA32 definitions @@ -2784,15 +2784,15 @@ DEFINE CLANGPDB_ALL_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) DEF(CLANGPDB_WARN *_CLANGPDB_IA32_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANGPDB_IA32_TARGET) DEBUG_CLANGPDB_IA32_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586 DEF(CLANGPDB_IA32_TARGET) -gcodeview -DEBUG_CLANGPDB_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DEBUG:GHASH /lldmap +DEBUG_CLANGPDB_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DEBUG:GHASH /MLLVM:-exception-model=wineh /lldmap DEBUG_CLANGPDB_IA32_DLINK2_FLAGS = RELEASE_CLANGPDB_IA32_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586 DEF(CLANGPDB_IA32_TARGET) -RELEASE_CLANGPDB_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /MERGE:.rdata=.data /lldmap +RELEASE_CLANGPDB_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /MERGE:.rdata=.data /MLLVM:-exception-model=wineh /lldmap RELEASE_CLANGPDB_IA32_DLINK2_FLAGS = NOOPT_CLANGPDB_IA32_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) -m32 -O0 -march=i586 DEF(CLANGPDB_IA32_TARGET) -gcodeview -NOOPT_CLANGPDB_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DEBUG:GHASH /lldmap +NOOPT_CLANGPDB_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DEBUG:GHASH /MLLVM:-exception-model=wineh /lldmap NOOPT_CLANGPDB_IA32_DLINK2_FLAGS = ########################## @@ -2818,17 +2818,17 @@ NOOPT_CLANGPDB_IA32_DLINK2_FLAGS = *_CLANGPDB_X64_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANGPDB_X64_TARGET) DEBUG_CLANGPDB_X64_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -Oz -flto DEF(CLANGPDB_X64_TARGET) -gcodeview -funwind-tables -DEBUG_CLANGPDB_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /Machine:X64 /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DEBUG:GHASH /lldmap +DEBUG_CLANGPDB_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /Machine:X64 /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DEBUG:GHASH /MLLVM:-exception-model=wineh /lldmap DEBUG_CLANGPDB_X64_DLINK2_FLAGS = DEBUG_CLANGPDB_X64_GENFW_FLAGS = --keepexceptiontable RELEASE_CLANGPDB_X64_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -Oz -flto DEF(CLANGPDB_X64_TARGET) -fno-unwind-tables -RELEASE_CLANGPDB_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /MERGE:.rdata=.data /lldmap +RELEASE_CLANGPDB_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /MERGE:.rdata=.data /MLLVM:-exception-model=wineh /lldmap RELEASE_CLANGPDB_X64_DLINK2_FLAGS = RELEASE_CLANGPDB_X64_GENFW_FLAGS = NOOPT_CLANGPDB_X64_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -O0 DEF(CLANGPDB_X64_TARGET) -gcodeview -funwind-tables -NOOPT_CLANGPDB_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /Machine:X64 /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DEBUG:GHASH /lldmap +NOOPT_CLANGPDB_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /Machine:X64 /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DEBUG:GHASH /MLLVM:-exception-model=wineh /lldmap NOOPT_CLANGPDB_X64_DLINK2_FLAGS = NOOPT_CLANGPDB_X64_GENFW_FLAGS = --keepexceptiontable -- 2.24.1 (Apple Git-126) ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [edk2-devel] [PATCH 1/1] BaseTools: Use SEH exceptions in CLANGPDB for IA32 2020-03-27 10:45 ` [PATCH 1/1] " Vitaly Cheptsov @ 2020-03-30 3:26 ` Zhiguang Liu 2020-03-30 13:50 ` Liming Gao 0 siblings, 1 reply; 4+ messages in thread From: Zhiguang Liu @ 2020-03-30 3:26 UTC (permalink / raw) To: devel@edk2.groups.io, cheptsov@ispras.ru; +Cc: Gao, Liming, Marvin Häuser Thanks Vitaly. I have confirmed this patch can reduce image size. Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com> > -----Original Message----- > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of > Vitaly Cheptsov > Sent: Friday, March 27, 2020 6:46 PM > To: devel@edk2.groups.io > Cc: Gao, Liming <liming.gao@intel.com>; Marvin Häuser > <mhaeuser@outlook.de>; Liu, Zhiguang <zhiguang.liu@intel.com> > Subject: [edk2-devel] [PATCH 1/1] BaseTools: Use SEH exceptions in > CLANGPDB for IA32 > > From: Vitaly Cheptsov <vit9696@protonmail.com> > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2628 > > This patch reduces the size of IA32 binaries by ensuring that > no .debug_frame / .eh_frame sections are generated through forcing > SEH exception model, which is already the default in clang for X64. > > EDK II does not support exceptions, and in future we should disable > them instead of switching to some other variant. Currently this > is not possible due to the following LLVM bugs: > > https://bugs.llvm.org/show_bug.cgi?id=45324 > https://bugs.llvm.org/show_bug.cgi?id=45325 > > Upon applying this patch OvmfPkgIA32.dsc compilation in DEBUG mode > gets the following size decrease with clang 9.0.1. > > Before: FV Space Information > SECFV [11%Full] 212992 total, 24512 used, 188480 free > PEIFV [22%Full] 917504 total, 203048 used, 714456 free > DXEFV [36%Full] 11534336 total, 4215672 used, 7318664 free > FVMAIN_COMPACT [37%Full] 3440640 total, 1287776 used, 2152864 free > > After: FV Space Information > SECFV [10%Full] 212992 total, 22112 used, 190880 free > PEIFV [19%Full] 917504 total, 176392 used, 741112 free > DXEFV [31%Full] 11534336 total, 3657112 used, 7877224 free > FVMAIN_COMPACT [33%Full] 3440640 total, 1153896 used, 2286744 free > > CC: Liming Gao <liming.gao@intel.com> > CC: Marvin Häuser <mhaeuser@outlook.de> > CC: Zhiguang Liu <zhiguang.liu@intel.com> > Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com> > --- > BaseTools/Conf/tools_def.template | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/BaseTools/Conf/tools_def.template > b/BaseTools/Conf/tools_def.template > index 2b17d3b297..88d7ab8cab 100755 > --- a/BaseTools/Conf/tools_def.template > +++ b/BaseTools/Conf/tools_def.template > @@ -2759,7 +2759,7 @@ DEFINE CLANGPDB_IA32_TARGET = -target > i686-unknown-windows-gnu > DEFINE CLANGPDB_X64_TARGET = -target x86_64-unknown-windows- > gnu > > > > > > DEFINE CLANGPDB_WARNING_OVERRIDES = -Wno-parentheses-equality - > Wno-tautological-compare -Wno-tautological-constant-out-of-range- > compare -Wno-empty-body -Wno-unused-const-variable -Wno-varargs - > Wno-unknown-warning-option -Wno-microsoft-enum-forward-reference > > > -DEFINE CLANGPDB_ALL_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) > DEF(CLANGPDB_WARNING_OVERRIDES) -fno-stack-protector -funsigned- > char -ftrap- > function=undefined_behavior_has_been_optimized_away_by_clang -Wno- > address -Wno-shift-negative-value -Wno-unknown-pragmas -Wno- > incompatible-library-redeclaration -Wno-null-dereference -mno-implicit- > float -mms-bitfields -mno-stack-arg-probe -nostdlib -nostdlibinc > > > +DEFINE CLANGPDB_ALL_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) > DEF(CLANGPDB_WARNING_OVERRIDES) -fno-stack-protector -funsigned- > char -ftrap- > function=undefined_behavior_has_been_optimized_away_by_clang -Wno- > address -Wno-shift-negative-value -Wno-unknown-pragmas -Wno- > incompatible-library-redeclaration -Wno-null-dereference -mno-implicit- > float -mms-bitfields -mno-stack-arg-probe -nostdlib -nostdlibinc -fseh- > exceptions > > > > > > ########################### > > > # CLANGPDB IA32 definitions > > > @@ -2784,15 +2784,15 @@ DEFINE CLANGPDB_ALL_CC_FLAGS = > DEF(GCC48_ALL_CC_FLAGS) DEF(CLANGPDB_WARN > *_CLANGPDB_IA32_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) > DEF(CLANGPDB_IA32_TARGET) > > > > > > DEBUG_CLANGPDB_IA32_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) > -m32 -Oz -flto -march=i586 DEF(CLANGPDB_IA32_TARGET) -gcodeview > > > -DEBUG_CLANGPDB_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB > /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 > /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /DLL > /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER > /SAFESEH:NO /BASE:0 /DEBUG:GHASH /lldmap > > > +DEBUG_CLANGPDB_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB > /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 > /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /DLL > /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER > /SAFESEH:NO /BASE:0 /DEBUG:GHASH /MLLVM:-exception-model=wineh > /lldmap > > > DEBUG_CLANGPDB_IA32_DLINK2_FLAGS = > > > > > > RELEASE_CLANGPDB_IA32_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) > -m32 -Oz -flto -march=i586 DEF(CLANGPDB_IA32_TARGET) > > > -RELEASE_CLANGPDB_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB > /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /ALIGN:32 > /FILEALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /DLL > /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER > /SAFESEH:NO /BASE:0 /MERGE:.rdata=.data /lldmap > > > +RELEASE_CLANGPDB_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB > /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /ALIGN:32 > /FILEALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /DLL > /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER > /SAFESEH:NO /BASE:0 /MERGE:.rdata=.data /MLLVM:-exception- > model=wineh /lldmap > > > RELEASE_CLANGPDB_IA32_DLINK2_FLAGS = > > > > > > NOOPT_CLANGPDB_IA32_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) > -m32 -O0 -march=i586 DEF(CLANGPDB_IA32_TARGET) -gcodeview > > > -NOOPT_CLANGPDB_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB > /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 > /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /DLL > /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER > /SAFESEH:NO /BASE:0 /DEBUG:GHASH /lldmap > > > +NOOPT_CLANGPDB_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB > /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 > /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /DLL > /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER > /SAFESEH:NO /BASE:0 /DEBUG:GHASH /MLLVM:-exception-model=wineh > /lldmap > > > NOOPT_CLANGPDB_IA32_DLINK2_FLAGS = > > > > > > ########################## > > > @@ -2818,17 +2818,17 @@ NOOPT_CLANGPDB_IA32_DLINK2_FLAGS = > *_CLANGPDB_X64_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) > DEF(CLANGPDB_X64_TARGET) > > > > > > DEBUG_CLANGPDB_X64_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) > -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small - > Oz -flto DEF(CLANGPDB_X64_TARGET) -gcodeview -funwind-tables > > > -DEBUG_CLANGPDB_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB > /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /Machine:X64 > /DLL /ENTRY:$(IMAGE_ENTRY_POINT) > /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 > /DEBUG:GHASH /lldmap > > > +DEBUG_CLANGPDB_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB > /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /Machine:X64 > /DLL /ENTRY:$(IMAGE_ENTRY_POINT) > /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 > /DEBUG:GHASH /MLLVM:-exception-model=wineh /lldmap > > > DEBUG_CLANGPDB_X64_DLINK2_FLAGS = > > > DEBUG_CLANGPDB_X64_GENFW_FLAGS = --keepexceptiontable > > > > > > RELEASE_CLANGPDB_X64_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) > -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small - > Oz -flto DEF(CLANGPDB_X64_TARGET) -fno-unwind-tables > > > -RELEASE_CLANGPDB_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB > /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /ALIGN:32 > /FILEALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /DLL > /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER > /SAFESEH:NO /BASE:0 /MERGE:.rdata=.data /lldmap > > > +RELEASE_CLANGPDB_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB > /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /ALIGN:32 > /FILEALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /DLL > /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER > /SAFESEH:NO /BASE:0 /MERGE:.rdata=.data /MLLVM:-exception- > model=wineh /lldmap > > > RELEASE_CLANGPDB_X64_DLINK2_FLAGS = > > > RELEASE_CLANGPDB_X64_GENFW_FLAGS = > > > > > > NOOPT_CLANGPDB_X64_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) > -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small - > O0 DEF(CLANGPDB_X64_TARGET) -gcodeview -funwind-tables > > > -NOOPT_CLANGPDB_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB > /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /Machine:X64 > /DLL /ENTRY:$(IMAGE_ENTRY_POINT) > /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 > /DEBUG:GHASH /lldmap > > > +NOOPT_CLANGPDB_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB > /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /Machine:X64 > /DLL /ENTRY:$(IMAGE_ENTRY_POINT) > /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 > /DEBUG:GHASH /MLLVM:-exception-model=wineh /lldmap > > > NOOPT_CLANGPDB_X64_DLINK2_FLAGS = > > > NOOPT_CLANGPDB_X64_GENFW_FLAGS = --keepexceptiontable > > > > > > -- > 2.24.1 (Apple Git-126) > > > ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [edk2-devel] [PATCH 1/1] BaseTools: Use SEH exceptions in CLANGPDB for IA32 2020-03-30 3:26 ` [edk2-devel] " Zhiguang Liu @ 2020-03-30 13:50 ` Liming Gao 0 siblings, 0 replies; 4+ messages in thread From: Liming Gao @ 2020-03-30 13:50 UTC (permalink / raw) To: Liu, Zhiguang, devel@edk2.groups.io, cheptsov@ispras.ru Cc: Marvin Häuser Reviewed-by: Liming Gao <liming.gao@intel.com> > -----Original Message----- > From: Liu, Zhiguang <zhiguang.liu@intel.com> > Sent: Monday, March 30, 2020 11:26 AM > To: devel@edk2.groups.io; cheptsov@ispras.ru > Cc: Gao, Liming <liming.gao@intel.com>; Marvin Häuser <mhaeuser@outlook.de> > Subject: RE: [edk2-devel] [PATCH 1/1] BaseTools: Use SEH exceptions in CLANGPDB for IA32 > > Thanks Vitaly. > I have confirmed this patch can reduce image size. > Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com> > > > -----Original Message----- > > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of > > Vitaly Cheptsov > > Sent: Friday, March 27, 2020 6:46 PM > > To: devel@edk2.groups.io > > Cc: Gao, Liming <liming.gao@intel.com>; Marvin Häuser > > <mhaeuser@outlook.de>; Liu, Zhiguang <zhiguang.liu@intel.com> > > Subject: [edk2-devel] [PATCH 1/1] BaseTools: Use SEH exceptions in > > CLANGPDB for IA32 > > > > From: Vitaly Cheptsov <vit9696@protonmail.com> > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2628 > > > > This patch reduces the size of IA32 binaries by ensuring that > > no .debug_frame / .eh_frame sections are generated through forcing > > SEH exception model, which is already the default in clang for X64. > > > > EDK II does not support exceptions, and in future we should disable > > them instead of switching to some other variant. Currently this > > is not possible due to the following LLVM bugs: > > > > https://bugs.llvm.org/show_bug.cgi?id=45324 > > https://bugs.llvm.org/show_bug.cgi?id=45325 > > > > Upon applying this patch OvmfPkgIA32.dsc compilation in DEBUG mode > > gets the following size decrease with clang 9.0.1. > > > > Before: FV Space Information > > SECFV [11%Full] 212992 total, 24512 used, 188480 free > > PEIFV [22%Full] 917504 total, 203048 used, 714456 free > > DXEFV [36%Full] 11534336 total, 4215672 used, 7318664 free > > FVMAIN_COMPACT [37%Full] 3440640 total, 1287776 used, 2152864 free > > > > After: FV Space Information > > SECFV [10%Full] 212992 total, 22112 used, 190880 free > > PEIFV [19%Full] 917504 total, 176392 used, 741112 free > > DXEFV [31%Full] 11534336 total, 3657112 used, 7877224 free > > FVMAIN_COMPACT [33%Full] 3440640 total, 1153896 used, 2286744 free > > > > CC: Liming Gao <liming.gao@intel.com> > > CC: Marvin Häuser <mhaeuser@outlook.de> > > CC: Zhiguang Liu <zhiguang.liu@intel.com> > > Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com> > > --- > > BaseTools/Conf/tools_def.template | 14 +++++++------- > > 1 file changed, 7 insertions(+), 7 deletions(-) > > > > diff --git a/BaseTools/Conf/tools_def.template > > b/BaseTools/Conf/tools_def.template > > index 2b17d3b297..88d7ab8cab 100755 > > --- a/BaseTools/Conf/tools_def.template > > +++ b/BaseTools/Conf/tools_def.template > > @@ -2759,7 +2759,7 @@ DEFINE CLANGPDB_IA32_TARGET = -target > > i686-unknown-windows-gnu > > DEFINE CLANGPDB_X64_TARGET = -target x86_64-unknown-windows- > > gnu > > > > > > > > > > > > DEFINE CLANGPDB_WARNING_OVERRIDES = -Wno-parentheses-equality - > > Wno-tautological-compare -Wno-tautological-constant-out-of-range- > > compare -Wno-empty-body -Wno-unused-const-variable -Wno-varargs - > > Wno-unknown-warning-option -Wno-microsoft-enum-forward-reference > > > > > > -DEFINE CLANGPDB_ALL_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) > > DEF(CLANGPDB_WARNING_OVERRIDES) -fno-stack-protector -funsigned- > > char -ftrap- > > function=undefined_behavior_has_been_optimized_away_by_clang -Wno- > > address -Wno-shift-negative-value -Wno-unknown-pragmas -Wno- > > incompatible-library-redeclaration -Wno-null-dereference -mno-implicit- > > float -mms-bitfields -mno-stack-arg-probe -nostdlib -nostdlibinc > > > > > > +DEFINE CLANGPDB_ALL_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) > > DEF(CLANGPDB_WARNING_OVERRIDES) -fno-stack-protector -funsigned- > > char -ftrap- > > function=undefined_behavior_has_been_optimized_away_by_clang -Wno- > > address -Wno-shift-negative-value -Wno-unknown-pragmas -Wno- > > incompatible-library-redeclaration -Wno-null-dereference -mno-implicit- > > float -mms-bitfields -mno-stack-arg-probe -nostdlib -nostdlibinc -fseh- > > exceptions > > > > > > > > > > > > ########################### > > > > > > # CLANGPDB IA32 definitions > > > > > > @@ -2784,15 +2784,15 @@ DEFINE CLANGPDB_ALL_CC_FLAGS = > > DEF(GCC48_ALL_CC_FLAGS) DEF(CLANGPDB_WARN > > *_CLANGPDB_IA32_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) > > DEF(CLANGPDB_IA32_TARGET) > > > > > > > > > > > > DEBUG_CLANGPDB_IA32_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) > > -m32 -Oz -flto -march=i586 DEF(CLANGPDB_IA32_TARGET) -gcodeview > > > > > > -DEBUG_CLANGPDB_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB > > /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 > > /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /DLL > > /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER > > /SAFESEH:NO /BASE:0 /DEBUG:GHASH /lldmap > > > > > > +DEBUG_CLANGPDB_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB > > /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 > > /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /DLL > > /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER > > /SAFESEH:NO /BASE:0 /DEBUG:GHASH /MLLVM:-exception-model=wineh > > /lldmap > > > > > > DEBUG_CLANGPDB_IA32_DLINK2_FLAGS = > > > > > > > > > > > > RELEASE_CLANGPDB_IA32_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) > > -m32 -Oz -flto -march=i586 DEF(CLANGPDB_IA32_TARGET) > > > > > > -RELEASE_CLANGPDB_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB > > /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /ALIGN:32 > > /FILEALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /DLL > > /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER > > /SAFESEH:NO /BASE:0 /MERGE:.rdata=.data /lldmap > > > > > > +RELEASE_CLANGPDB_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB > > /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /ALIGN:32 > > /FILEALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /DLL > > /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER > > /SAFESEH:NO /BASE:0 /MERGE:.rdata=.data /MLLVM:-exception- > > model=wineh /lldmap > > > > > > RELEASE_CLANGPDB_IA32_DLINK2_FLAGS = > > > > > > > > > > > > NOOPT_CLANGPDB_IA32_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) > > -m32 -O0 -march=i586 DEF(CLANGPDB_IA32_TARGET) -gcodeview > > > > > > -NOOPT_CLANGPDB_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB > > /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 > > /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /DLL > > /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER > > /SAFESEH:NO /BASE:0 /DEBUG:GHASH /lldmap > > > > > > +NOOPT_CLANGPDB_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB > > /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 > > /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /DLL > > /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER > > /SAFESEH:NO /BASE:0 /DEBUG:GHASH /MLLVM:-exception-model=wineh > > /lldmap > > > > > > NOOPT_CLANGPDB_IA32_DLINK2_FLAGS = > > > > > > > > > > > > ########################## > > > > > > @@ -2818,17 +2818,17 @@ NOOPT_CLANGPDB_IA32_DLINK2_FLAGS = > > *_CLANGPDB_X64_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) > > DEF(CLANGPDB_X64_TARGET) > > > > > > > > > > > > DEBUG_CLANGPDB_X64_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) > > -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small - > > Oz -flto DEF(CLANGPDB_X64_TARGET) -gcodeview -funwind-tables > > > > > > -DEBUG_CLANGPDB_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB > > /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /Machine:X64 > > /DLL /ENTRY:$(IMAGE_ENTRY_POINT) > > /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 > > /DEBUG:GHASH /lldmap > > > > > > +DEBUG_CLANGPDB_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB > > /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /Machine:X64 > > /DLL /ENTRY:$(IMAGE_ENTRY_POINT) > > /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 > > /DEBUG:GHASH /MLLVM:-exception-model=wineh /lldmap > > > > > > DEBUG_CLANGPDB_X64_DLINK2_FLAGS = > > > > > > DEBUG_CLANGPDB_X64_GENFW_FLAGS = --keepexceptiontable > > > > > > > > > > > > RELEASE_CLANGPDB_X64_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) > > -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small - > > Oz -flto DEF(CLANGPDB_X64_TARGET) -fno-unwind-tables > > > > > > -RELEASE_CLANGPDB_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB > > /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /ALIGN:32 > > /FILEALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /DLL > > /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER > > /SAFESEH:NO /BASE:0 /MERGE:.rdata=.data /lldmap > > > > > > +RELEASE_CLANGPDB_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB > > /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /ALIGN:32 > > /FILEALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /DLL > > /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER > > /SAFESEH:NO /BASE:0 /MERGE:.rdata=.data /MLLVM:-exception- > > model=wineh /lldmap > > > > > > RELEASE_CLANGPDB_X64_DLINK2_FLAGS = > > > > > > RELEASE_CLANGPDB_X64_GENFW_FLAGS = > > > > > > > > > > > > NOOPT_CLANGPDB_X64_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) > > -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small - > > O0 DEF(CLANGPDB_X64_TARGET) -gcodeview -funwind-tables > > > > > > -NOOPT_CLANGPDB_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB > > /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /Machine:X64 > > /DLL /ENTRY:$(IMAGE_ENTRY_POINT) > > /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 > > /DEBUG:GHASH /lldmap > > > > > > +NOOPT_CLANGPDB_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB > > /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 /Machine:X64 > > /DLL /ENTRY:$(IMAGE_ENTRY_POINT) > > /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 > > /DEBUG:GHASH /MLLVM:-exception-model=wineh /lldmap > > > > > > NOOPT_CLANGPDB_X64_DLINK2_FLAGS = > > > > > > NOOPT_CLANGPDB_X64_GENFW_FLAGS = --keepexceptiontable > > > > > > > > > > > > -- > > 2.24.1 (Apple Git-126) > > > > > > ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-03-30 13:50 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-03-27 10:45 [PATCH 0/1] BaseTools: Use SEH exceptions in CLANGPDB for IA32 Vitaly Cheptsov 2020-03-27 10:45 ` [PATCH 1/1] " Vitaly Cheptsov 2020-03-30 3:26 ` [edk2-devel] " Zhiguang Liu 2020-03-30 13:50 ` Liming Gao
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox