From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web09.9636.1580981203949243633 for ; Thu, 06 Feb 2020 01:26:44 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: liming.gao@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Feb 2020 01:26:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,409,1574150400"; d="scan'208";a="250004803" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga002.jf.intel.com with ESMTP; 06 Feb 2020 01:26:42 -0800 Received: from shsmsx602.ccr.corp.intel.com (10.109.6.142) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 6 Feb 2020 01:26:42 -0800 Received: from shsmsx606.ccr.corp.intel.com (10.109.6.216) by SHSMSX602.ccr.corp.intel.com (10.109.6.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 6 Feb 2020 17:26:40 +0800 Received: from shsmsx606.ccr.corp.intel.com ([10.109.6.216]) by SHSMSX606.ccr.corp.intel.com ([10.109.6.216]) with mapi id 15.01.1713.004; Thu, 6 Feb 2020 17:26:40 +0800 From: "Liming Gao" To: "Shi, Steven" , "devel@edk2.groups.io" CC: "Feng, Bob C" Subject: Re: [PATCH] BaseTools: Enhance call stack unwindability for CLANGPDB x64 binary Thread-Topic: [PATCH] BaseTools: Enhance call stack unwindability for CLANGPDB x64 binary Thread-Index: AQHV2pqRvH/f61dvZUm7MT1NAVVag6gKojNA//+BeICAA8Yq4A== Date: Thu, 6 Feb 2020 09:26:40 +0000 Message-ID: <0578a306e8eb4da7b9d830fe15a2b54f@intel.com> References: <20200203140153.21556-1-steven.shi@intel.com> <0b5cedba13e54a8cad2ca147ebef5fae@intel.com> <06C8AB66E78EE34A949939824ABE2B3140333C9A@shsmsx102.ccr.corp.intel.com> In-Reply-To: <06C8AB66E78EE34A949939824ABE2B3140333C9A@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.2.0.6 dlp-product: dlpe-windows dlp-reaction: no-action x-originating-ip: [10.239.127.36] MIME-Version: 1.0 Return-Path: liming.gao@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao > -----Original Message----- > From: Shi, Steven > Sent: Tuesday, February 4, 2020 3:49 PM > To: Gao, Liming ; devel@edk2.groups.io > Cc: Feng, Bob C > Subject: RE: [PATCH] BaseTools: Enhance call stack unwindability for CLAN= GPDB x64 binary >=20 > Yes, I did. This patch also enables the Emulator X64 stack unwind as well= . >=20 >=20 > Thanks >=20 > Steven Shi > Intel\SSG\SFE\FIE Firmware Infrastructure >=20 >=20 > > -----Original Message----- > > From: Gao, Liming > > Sent: Tuesday, February 4, 2020 3:22 PM > > To: Shi, Steven ; devel@edk2.groups.io > > Cc: Feng, Bob C > > 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 > > > Sent: Monday, February 3, 2020 10:02 PM > > > To: devel@edk2.groups.io > > > Cc: Gao, Liming ; Feng, Bob C > > ; Shi, Steven > > > Subject: [PATCH] BaseTools: Enhance call stack unwindability for > > CLANGPDB x64 binary > > > > > > From: Steven > > > > > > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2487 > > > > > > 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 > > > Cc: Liming Gao > > > Cc: Bob Feng > > > --- > > > 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 =3D -targe= t > > i686-unknown-windows > > > DEFINE CLANGPDB_X64_TARGET =3D -target x86_64-unknown- > > windows > > > > > > DEFINE CLANGPDB_WARNING_OVERRIDES =3D -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 =3D 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=3Dundefined_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 =3D 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=3Dundefined_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 =3D > > > *_CLANGPDB_X64_ASLPP_FLAGS =3D DEF(GCC_ASLPP_FLAGS) > > DEF(CLANGPDB_X64_TARGET) > > > *_CLANGPDB_X64_VFRPP_FLAGS =3D DEF(GCC_VFRPP_FLAGS) > > DEF(CLANGPDB_X64_TARGET) > > > > > > -DEBUG_CLANGPDB_X64_CC_FLAGS =3D DEF(CLANGPDB_ALL_CC_FLAGS) > > -m64 "-DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone - > > > mcmodel=3Dsmall -Oz -flto DEF(CLANGPDB_X64_TARGET) -gcodeview > > > -DEBUG_CLANGPDB_X64_DLINK_FLAGS =3D /NOLOGO /NODEFAULTLIB > > /IGNORE:4001 /OPT:REF /OPT:ICF=3D10 /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 =3D > > DEF(CLANGPDB_ALL_CC_FLAGS) -m64 "-DEFIAPI=3D__attribute__((ms_abi))" - > > mno-red-zone - > > > mcmodel=3Dsmall -Oz -flto DEF(CLANGPDB_X64_TARGET) -gcodeview - > > funwind-tables > > > +DEBUG_CLANGPDB_X64_DLINK_FLAGS =3D /NOLOGO /NODEFAULTLIB > > /IGNORE:4001 /OPT:REF /OPT:ICF=3D10 /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 =3D > > > +DEBUG_CLANGPDB_X64_GENFW_FLAGS =3D --keepexceptiontable > > > > > > -RELEASE_CLANGPDB_X64_CC_FLAGS =3D > > DEF(CLANGPDB_ALL_CC_FLAGS) -m64 "-DEFIAPI=3D__attribute__((ms_abi))" - > > mno-red-zone - > > > mcmodel=3Dsmall -Oz -flto DEF(CLANGPDB_X64_TARGET) > > > +RELEASE_CLANGPDB_X64_CC_FLAGS =3D > > DEF(CLANGPDB_ALL_CC_FLAGS) -m64 "-DEFIAPI=3D__attribute__((ms_abi))" - > > mno-red-zone - > > > mcmodel=3Dsmall -Oz -flto DEF(CLANGPDB_X64_TARGET) -fno-unwind-tables > > > RELEASE_CLANGPDB_X64_DLINK_FLAGS =3D /NOLOGO /NODEFAULTLIB > > /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=3D10 > > > /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=3D.data /lldmap > > > RELEASE_CLANGPDB_X64_DLINK2_FLAGS =3D > > > +RELEASE_CLANGPDB_X64_GENFW_FLAGS =3D > > > > > > -NOOPT_CLANGPDB_X64_CC_FLAGS =3D DEF(CLANGPDB_ALL_CC_FLAGS) > > -m64 "-DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone - > > > mcmodel=3Dsmall -O0 DEF(CLANGPDB_X64_TARGET) -gcodeview > > > -NOOPT_CLANGPDB_X64_DLINK_FLAGS =3D /NOLOGO /NODEFAULTLIB > > /IGNORE:4001 /OPT:REF /OPT:ICF=3D10 /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 =3D > > DEF(CLANGPDB_ALL_CC_FLAGS) -m64 "-DEFIAPI=3D__attribute__((ms_abi))" - > > mno-red-zone - > > > mcmodel=3Dsmall -O0 DEF(CLANGPDB_X64_TARGET) -gcodeview -funwind- > > tables > > > +NOOPT_CLANGPDB_X64_DLINK_FLAGS =3D /NOLOGO /NODEFAULTLIB > > /IGNORE:4001 /OPT:REF /OPT:ICF=3D10 /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 =3D > > > - > > > +NOOPT_CLANGPDB_X64_GENFW_FLAGS =3D --keepexceptiontable > > > > > > # > > > # > > > -- > > > 2.16.1.windows.4