From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web10.151.1572838119650593086 for ; Sun, 03 Nov 2019 19:28:39 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: liming.gao@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Nov 2019 19:28:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,265,1569308400"; d="scan'208";a="205058810" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga006.jf.intel.com with ESMTP; 03 Nov 2019 19:28:39 -0800 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 3 Nov 2019 19:28:38 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 3 Nov 2019 19:28:38 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.127]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.149]) with mapi id 14.03.0439.000; Mon, 4 Nov 2019 11:28:36 +0800 From: "Liming Gao" To: "Liu, Zhiguang" , "devel@edk2.groups.io" CC: "Feng, Bob C" Subject: Re: [PATCH 2/2] BaseTools: Add support for parseing map files generated by CLANG9 in GenFv Thread-Topic: [PATCH 2/2] BaseTools: Add support for parseing map files generated by CLANG9 in GenFv Thread-Index: AQHVkH10Kms8PwJ/FEShyZUE6HeXMKd6XuKQ Date: Mon, 4 Nov 2019 03:28:36 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E536C05@SHSMSX104.ccr.corp.intel.com> References: <20191101062702.165544-1-zhiguang.liu@intel.com> <20191101062702.165544-2-zhiguang.liu@intel.com> In-Reply-To: <20191101062702.165544-2-zhiguang.liu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] 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: Liu, Zhiguang >Sent: Friday, November 01, 2019 2:27 PM >To: devel@edk2.groups.io >Cc: Feng, Bob C ; Gao, Liming >Subject: [PATCH 2/2] BaseTools: Add support for parseing map files generat= ed >by CLANG9 in GenFv > >REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2320 > >Add support for parseing map files generated by CLANG9 in GenFv > >Cc: Bob Feng >Cc: Liming Gao > >Signed-off-by: Zhiguang Liu >--- > BaseTools/Source/C/GenFv/GenFvInternalLib.c | 28 >+++++++++++++++++++++++----- > 1 file changed, 23 insertions(+), 5 deletions(-) > >diff --git a/BaseTools/Source/C/GenFv/GenFvInternalLib.c >b/BaseTools/Source/C/GenFv/GenFvInternalLib.c >index 908740de50..daebfe894c 100644 >--- a/BaseTools/Source/C/GenFv/GenFvInternalLib.c >+++ b/BaseTools/Source/C/GenFv/GenFvInternalLib.c >@@ -791,6 +791,7 @@ Returns: > FILE *PeMapFile; > CHAR8 Line [MAX_LINE_LEN]; > CHAR8 KeyWord [MAX_LINE_LEN]; >+ CHAR8 KeyWord2 [MAX_LINE_LEN]; > CHAR8 FunctionName [MAX_LINE_LEN]; > EFI_PHYSICAL_ADDRESS FunctionAddress; > UINT32 FunctionType; >@@ -805,6 +806,7 @@ Returns: > UINT32 TextVirtualAddress; > UINT32 DataVirtualAddress; > EFI_PHYSICAL_ADDRESS LinkTimeBaseAddress; >+ BOOLEAN IsUseClang; > > // > // Init local variable >@@ -932,6 +934,7 @@ Returns: > // Output Functions information into Fv Map file > // > LinkTimeBaseAddress =3D 0; >+ IsUseClang =3D FALSE; > while (fgets (Line, MAX_LINE_LEN, PeMapFile) !=3D NULL) { > // > // Skip blank line >@@ -946,6 +949,12 @@ Returns: > if (FunctionType =3D=3D 0) { > sscanf (Line, "%s", KeyWord); > if (stricmp (KeyWord, "Address") =3D=3D 0) { >+ sscanf (Line, "%s %s", KeyWord, KeyWord2); >+ if (stricmp (KeyWord2, "Size") =3D=3D 0) { >+ IsUseClang =3D TRUE; >+ FunctionType =3D 1; >+ continue; >+ } > // > // function list > // >@@ -967,11 +976,20 @@ Returns: > // Printf Function Information > // > if (FunctionType =3D=3D 1) { >- sscanf (Line, "%s %s %llx %s", KeyWord, FunctionName, >&TempLongAddress, FunctionTypeName); >- FunctionAddress =3D (UINT64) TempLongAddress; >- if (FunctionTypeName [1] =3D=3D '\0' && (FunctionTypeName [0] =3D= =3D 'f' || >FunctionTypeName [0] =3D=3D 'F')) { >- fprintf (FvMapFile, " 0x%010llx ", (unsigned long long) >(ImageBaseAddress + FunctionAddress - LinkTimeBaseAddress)); >- fprintf (FvMapFile, "%s\n", FunctionName); >+ if (IsUseClang) { >+ sscanf (Line, "%llx %s %s %s", &TempLongAddress, KeyWord, KeyWord= 2, >FunctionTypeName); >+ FunctionAddress =3D (UINT64) TempLongAddress; >+ if (FunctionTypeName [0] =3D=3D '_' ) { >+ fprintf (FvMapFile, " 0x%010llx ", (unsigned long long) >(ImageBaseAddress + FunctionAddress - LinkTimeBaseAddress)); >+ fprintf (FvMapFile, "%s\n", FunctionTypeName); >+ } >+ } else { >+ sscanf (Line, "%s %s %llx %s", KeyWord, FunctionName, >&TempLongAddress, FunctionTypeName); >+ FunctionAddress =3D (UINT64) TempLongAddress; >+ if (FunctionTypeName [1] =3D=3D '\0' && (FunctionTypeName [0] =3D= =3D 'f' || >FunctionTypeName [0] =3D=3D 'F')) { >+ fprintf (FvMapFile, " 0x%010llx ", (unsigned long long) >(ImageBaseAddress + FunctionAddress - LinkTimeBaseAddress)); >+ fprintf (FvMapFile, "%s\n", FunctionName); >+ } > } > } else if (FunctionType =3D=3D 2) { > sscanf (Line, "%s %s %llx %s", KeyWord, FunctionName, >&TempLongAddress, FunctionTypeName); >-- >2.16.2.windows.1