public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Liming Gao" <liming.gao@intel.com>
To: "Shi, Steven" <steven.shi@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Feng, Bob C" <bob.c.feng@intel.com>
Subject: Re: [PATCH] BaseTools: Enhance call stack unwindability for CLANGPDB x64 binary
Date: Thu, 6 Feb 2020 09:26:40 +0000	[thread overview]
Message-ID: <0578a306e8eb4da7b9d830fe15a2b54f@intel.com> (raw)
In-Reply-To: <06C8AB66E78EE34A949939824ABE2B3140333C9A@shsmsx102.ccr.corp.intel.com>

Reviewed-by: Liming Gao <liming.gao@intel.com>

> -----Original Message-----
> From: Shi, Steven <steven.shi@intel.com>
> Sent: Tuesday, February 4, 2020 3:49 PM
> To: Gao, Liming <liming.gao@intel.com>; devel@edk2.groups.io
> Cc: Feng, Bob C <bob.c.feng@intel.com>
> Subject: RE: [PATCH] BaseTools: Enhance call stack unwindability for CLANGPDB x64 binary
> 
> Yes, I did. This patch also enables the Emulator X64 stack unwind as well.
> 
> 
> Thanks
> 
> Steven Shi
> Intel\SSG\SFE\FIE Firmware Infrastructure
> 
> 
> > -----Original Message-----
> > From: Gao, Liming <liming.gao@intel.com>
> > Sent: Tuesday, February 4, 2020 3:22 PM
> > To: Shi, Steven <steven.shi@intel.com>; devel@edk2.groups.io
> > Cc: Feng, Bob C <bob.c.feng@intel.com>
> > Subject: RE: [PATCH] BaseTools: Enhance call stack unwindability for
> > CLANGPDB x64 binary
> >
> > Steven:
> >   Have you verified this change in Emulator X64?
> >
> > Thanks
> > Liming
> > > -----Original Message-----
> > > From: Shi, Steven <steven.shi@intel.com>
> > > Sent: Monday, February 3, 2020 10:02 PM
> > > To: devel@edk2.groups.io
> > > Cc: Gao, Liming <liming.gao@intel.com>; Feng, Bob C
> > <bob.c.feng@intel.com>; Shi, Steven <steven.shi@intel.com>
> > > Subject: [PATCH] BaseTools: Enhance call stack unwindability for
> > CLANGPDB x64 binary
> > >
> > > From: Steven <steven.shi@intel.com>
> > >
> > > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2487
> > >
> > > The call stack unwindability of the COFF X64 binary requires
> > > the binary to remain the pdata and xdata sections.
> > > Details see the MSVC X64 calling convertion doc in below link:
> > > https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention
> > >
> > > Current build options discard or zero the data in pdata and xdata
> > > sections which cause the debugger cannot correctly unwind the
> > > X64 binary call stack in the runtime.
> > > Enhance the build options to force emit the unwind tables and
> > > keep the data of pdata and xdata sections correct in the binary.
> > >
> > > Signed-off-by: Steven Shi <steven.shi@intel.com>
> > > Cc: Liming Gao <liming.gao@intel.com>
> > > Cc: Bob Feng <bob.c.feng@intel.com>
> > > ---
> > >  BaseTools/Conf/tools_def.template | 16 +++++++++-------
> > >  1 file changed, 9 insertions(+), 7 deletions(-)
> > >
> > > diff --git a/BaseTools/Conf/tools_def.template
> > b/BaseTools/Conf/tools_def.template
> > > index feee2bbf16..26294efe05 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
> > >  DEFINE CLANGPDB_X64_TARGET           = -target x86_64-unknown-
> > windows
> > >
> > >  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 -
> > > mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-unknown-
> > pragmas -Wno-incompatible-library-redeclaration -fno-
> > > asynchronous-unwind-tables -mno-implicit-float  -ftrap-
> > function=undefined_behavior_has_been_optimized_away_by_clang -
> > > funsigned-char -fno-ms-extensions -Wno-null-dereference -fms-
> > compatibility -mno-stack-arg-probe
> > > +DEFINE CLANGPDB_ALL_CC_FLAGS         = DEF(GCC48_ALL_CC_FLAGS)
> > DEF(CLANGPDB_WARNING_OVERRIDES) -fno-stack-protector -
> > > mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-unknown-
> > pragmas -Wno-incompatible-library-redeclaration -mno-
> > > implicit-float  -ftrap-
> > function=undefined_behavior_has_been_optimized_away_by_clang -
> > funsigned-char -fno-ms-extensions -Wno-
> > > null-dereference -fms-compatibility -mno-stack-arg-probe
> > >
> > >  ###########################
> > >  # CLANGPDB IA32 definitions
> > > @@ -2817,18 +2817,20 @@ NOOPT_CLANGPDB_IA32_DLINK2_FLAGS     =
> > >  *_CLANGPDB_X64_ASLPP_FLAGS          = DEF(GCC_ASLPP_FLAGS)
> > DEF(CLANGPDB_X64_TARGET)
> > >  *_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
> > > -DEBUG_CLANGPDB_X64_DLINK_FLAGS      = /NOLOGO /NODEFAULTLIB
> > /IGNORE:4001 /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 /DEBUG:GHASH  /lldmap
> > > +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_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)
> > > +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_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
> > > -NOOPT_CLANGPDB_X64_DLINK_FLAGS      = /NOLOGO /NODEFAULTLIB
> > /IGNORE:4001 /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 /DEBUG:GHASH  /lldmap
> > > +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_DLINK2_FLAGS     =
> > > -
> > > +NOOPT_CLANGPDB_X64_GENFW_FLAGS      = --keepexceptiontable
> > >
> > >  #
> > >  #
> > > --
> > > 2.16.1.windows.4


      reply	other threads:[~2020-02-06  9:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-03 14:01 [PATCH] BaseTools: Enhance call stack unwindability for CLANGPDB x64 binary Steven Shi
2020-02-04  7:21 ` Liming Gao
2020-02-04  7:48   ` Steven Shi
2020-02-06  9:26     ` 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=0578a306e8eb4da7b9d830fe15a2b54f@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