From: "Liming Gao" <liming.gao@intel.com>
To: "Liu, Zhiguang" <zhiguang.liu@intel.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>,
"cheptsov@ispras.ru" <cheptsov@ispras.ru>
Cc: "Marvin Häuser" <mhaeuser@outlook.de>
Subject: Re: [edk2-devel] [PATCH 1/1] BaseTools: Use SEH exceptions in CLANGPDB for IA32
Date: Mon, 30 Mar 2020 13:50:17 +0000 [thread overview]
Message-ID: <64c4c2f7fd6e422caf6a619a788dbaca@intel.com> (raw)
In-Reply-To: <27f176bde590497a80dafe27f9a34183@intel.com>
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)
> >
> >
> >
prev parent reply other threads:[~2020-03-30 13:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=64c4c2f7fd6e422caf6a619a788dbaca@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox