From: "Liming Gao" <liming.gao@intel.com>
To: "Liu, Zhiguang" <zhiguang.liu@intel.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Feng, Bob C" <bob.c.feng@intel.com>
Subject: Re: [PATCH 2/2] BaseTools: Add support for parseing map files generated by CLANG9 in GenFv
Date: Mon, 4 Nov 2019 03:28:36 +0000 [thread overview]
Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E536C05@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <20191101062702.165544-2-zhiguang.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
>-----Original Message-----
>From: Liu, Zhiguang
>Sent: Friday, November 01, 2019 2:27 PM
>To: devel@edk2.groups.io
>Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
>Subject: [PATCH 2/2] BaseTools: Add support for parseing map files generated
>by CLANG9 in GenFv
>
>REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2320
>
>Add support for parseing map files generated by CLANG9 in GenFv
>
>Cc: Bob Feng <bob.c.feng@intel.com>
>Cc: Liming Gao <liming.gao@intel.com>
>
>Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
>---
> 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 = 0;
>+ IsUseClang = FALSE;
> while (fgets (Line, MAX_LINE_LEN, PeMapFile) != NULL) {
> //
> // Skip blank line
>@@ -946,6 +949,12 @@ Returns:
> if (FunctionType == 0) {
> sscanf (Line, "%s", KeyWord);
> if (stricmp (KeyWord, "Address") == 0) {
>+ sscanf (Line, "%s %s", KeyWord, KeyWord2);
>+ if (stricmp (KeyWord2, "Size") == 0) {
>+ IsUseClang = TRUE;
>+ FunctionType = 1;
>+ continue;
>+ }
> //
> // function list
> //
>@@ -967,11 +976,20 @@ Returns:
> // Printf Function Information
> //
> if (FunctionType == 1) {
>- sscanf (Line, "%s %s %llx %s", KeyWord, FunctionName,
>&TempLongAddress, FunctionTypeName);
>- FunctionAddress = (UINT64) TempLongAddress;
>- if (FunctionTypeName [1] == '\0' && (FunctionTypeName [0] == 'f' ||
>FunctionTypeName [0] == '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, KeyWord2,
>FunctionTypeName);
>+ FunctionAddress = (UINT64) TempLongAddress;
>+ if (FunctionTypeName [0] == '_' ) {
>+ 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 = (UINT64) TempLongAddress;
>+ if (FunctionTypeName [1] == '\0' && (FunctionTypeName [0] == 'f' ||
>FunctionTypeName [0] == 'F')) {
>+ fprintf (FvMapFile, " 0x%010llx ", (unsigned long long)
>(ImageBaseAddress + FunctionAddress - LinkTimeBaseAddress));
>+ fprintf (FvMapFile, "%s\n", FunctionName);
>+ }
> }
> } else if (FunctionType == 2) {
> sscanf (Line, "%s %s %llx %s", KeyWord, FunctionName,
>&TempLongAddress, FunctionTypeName);
>--
>2.16.2.windows.1
next prev parent reply other threads:[~2019-11-04 3:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-01 6:27 [PATCH 1/2] BaseTools: Add map file parsing support for CLANG9 Zhiguang Liu
2019-11-01 6:27 ` [PATCH 2/2] BaseTools: Add support for parseing map files generated by CLANG9 in GenFv Zhiguang Liu
2019-11-04 3:28 ` Liming Gao [this message]
2019-11-04 3:28 ` [PATCH 1/2] BaseTools: Add map file parsing support for CLANG9 Liming Gao
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=4A89E2EF3DFEDB4C8BFDE51014F606A14E536C05@SHSMSX104.ccr.corp.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