From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web09.3009.1580801047799235910 for ; Mon, 03 Feb 2020 23:24:07 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: liming.gao@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Feb 2020 23:21:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,398,1574150400"; d="scan'208";a="340630988" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga001.fm.intel.com with ESMTP; 03 Feb 2020 23:21:54 -0800 Received: from shsmsx606.ccr.corp.intel.com (10.109.6.216) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 3 Feb 2020 23:21:54 -0800 Received: from shsmsx606.ccr.corp.intel.com (10.109.6.216) by SHSMSX606.ccr.corp.intel.com (10.109.6.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 4 Feb 2020 15:21:52 +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; Tue, 4 Feb 2020 15:21:52 +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 Date: Tue, 4 Feb 2020 07:21:52 +0000 Message-ID: <0b5cedba13e54a8cad2ca147ebef5fae@intel.com> References: <20200203140153.21556-1-steven.shi@intel.com> In-Reply-To: <20200203140153.21556-1-steven.shi@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 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 >=20 > From: Steven >=20 > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2487 >=20 > 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 >=20 > 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. >=20 > Signed-off-by: Steven Shi > Cc: Liming Gao > Cc: Bob Feng > --- > BaseTools/Conf/tools_def.template | 16 +++++++++------- > 1 file changed, 9 insertions(+), 7 deletions(-) >=20 > 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 -target i6= 86-unknown-windows > DEFINE CLANGPDB_X64_TARGET =3D -target x86_64-unknown-windows >=20 > 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-vara= rgs -Wno-unknown-warning-option -Wno- > microsoft-enum-forward-reference > -DEFINE CLANGPDB_ALL_CC_FLAGS =3D DEF(GCC48_ALL_CC_FLAGS) DEF(CLA= NGPDB_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=3Dundefin= ed_behavior_has_been_optimized_away_by_clang - > funsigned-char -fno-ms-extensions -Wno-null-dereference -fms-compatibilit= y -mno-stack-arg-probe > +DEFINE CLANGPDB_ALL_CC_FLAGS =3D DEF(GCC48_ALL_CC_FLAGS) DEF(CLA= NGPDB_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_a= way_by_clang -funsigned-char -fno-ms-extensions -Wno- > null-dereference -fms-compatibility -mno-stack-arg-probe >=20 > ########################### > # CLANGPDB IA32 definitions > @@ -2817,18 +2817,20 @@ NOOPT_CLANGPDB_IA32_DLINK2_FLAGS =3D > *_CLANGPDB_X64_ASLPP_FLAGS =3D DEF(GCC_ASLPP_FLAGS) DEF(CLANGPD= B_X64_TARGET) > *_CLANGPDB_X64_VFRPP_FLAGS =3D DEF(GCC_VFRPP_FLAGS) DEF(CLANGPD= B_X64_TARGET) >=20 > -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:40= 01 /OPT:REF /OPT:ICF=3D10 /ALIGN:32 /FILEALIGN:32 > /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /DLL /ENTRY:$(IMAGE_ENTR= Y_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-ta= bles > +DEBUG_CLANGPDB_X64_DLINK_FLAGS =3D /NOLOGO /NODEFAULTLIB /IGNORE:40= 01 /OPT:REF /OPT:ICF=3D10 /ALIGN:32 > /FILEALIGN:32 /Machine:X64 /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EF= I_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 > /DEBUG:GHASH /lldmap > DEBUG_CLANGPDB_X64_DLINK2_FLAGS =3D > +DEBUG_CLANGPDB_X64_GENFW_FLAGS =3D --keepexceptiontable >=20 > -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:40= 01 /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.d= ata /lldmap > RELEASE_CLANGPDB_X64_DLINK2_FLAGS =3D > +RELEASE_CLANGPDB_X64_GENFW_FLAGS =3D >=20 > -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:40= 01 /OPT:REF /OPT:ICF=3D10 /ALIGN:32 /FILEALIGN:32 > /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /DLL /ENTRY:$(IMAGE_ENTR= Y_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:40= 01 /OPT:REF /OPT:ICF=3D10 /ALIGN:32 > /FILEALIGN:32 /Machine:X64 /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EF= I_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 > /DEBUG:GHASH /lldmap > NOOPT_CLANGPDB_X64_DLINK2_FLAGS =3D > - > +NOOPT_CLANGPDB_X64_GENFW_FLAGS =3D --keepexceptiontable >=20 > # > # > -- > 2.16.1.windows.4