public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Zhiguang Liu" <zhiguang.liu@intel.com>
To: devel@edk2.groups.io
Cc: Bob Feng <bob.c.feng@intel.com>, Liming Gao <liming.gao@intel.com>
Subject: [PATCH 1/2] BaseTools: Add map file parsing support for CLANG9
Date: Fri,  1 Nov 2019 14:27:01 +0800	[thread overview]
Message-ID: <20191101062702.165544-1-zhiguang.liu@intel.com> (raw)

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/Python/Common/Misc.py                       | 9 ++++++---
 BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py | 9 ++++++---
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py
index 714eb840ea..403715e6cc 100755
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -81,19 +81,22 @@ def GetVariableOffset(mapfilepath, efifilepath, varnames):
 
     if len(lines) == 0: return None
     firstline = lines[0].strip()
+    if re.match('^\s*Address\s*Size\s*Align\s*Out\s*In\s*Symbol\s*$', firstline):
+        return _parseForXcodeAndClang9(lines, efifilepath, varnames)
     if (firstline.startswith("Archive member included ") and
         firstline.endswith(" file (symbol)")):
         return _parseForGCC(lines, efifilepath, varnames)
     if firstline.startswith("# Path:"):
-        return _parseForXcode(lines, efifilepath, varnames)
+        return _parseForXcodeAndClang9(lines, efifilepath, varnames)
     return _parseGeneral(lines, efifilepath, varnames)
 
-def _parseForXcode(lines, efifilepath, varnames):
+def _parseForXcodeAndClang9(lines, efifilepath, varnames):
     status = 0
     ret = []
     for line in lines:
         line = line.strip()
-        if status == 0 and line == "# Symbols:":
+        if status == 0 and (re.match('^\s*Address\s*Size\s*Align\s*Out\s*In\s*Symbol\s*$', line) \
+            or line == "# Symbols:"):
             status = 1
             continue
         if status == 1 and len(line) != 0:
diff --git a/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py b/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py
index 7d5e4fc34a..d962ab0add 100644
--- a/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py
+++ b/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py
@@ -49,20 +49,23 @@ def parsePcdInfoFromMapFile(mapfilepath, efifilepath):
 
     if len(lines) == 0: return None
     firstline = lines[0].strip()
+    if re.match('^\s*Address\s*Size\s*Align\s*Out\s*In\s*Symbol\s*$', firstline):
+        return _parseForXcodeAndClang9(lines, efifilepath)
     if (firstline.startswith("Archive member included ") and
         firstline.endswith(" file (symbol)")):
         return _parseForGCC(lines, efifilepath)
     if firstline.startswith("# Path:"):
-        return _parseForXcode(lines, efifilepath)
+        return _parseForXcodeAndClang9(lines, efifilepath)
     return _parseGeneral(lines, efifilepath)
 
-def _parseForXcode(lines, efifilepath):
+def _parseForXcodeAndClang9(lines, efifilepath):
     valuePattern = re.compile('^([\da-fA-FxX]+)([\s\S]*)([_]*_gPcd_BinaryPatch_([\w]+))')
     status = 0
     pcds = []
     for line in lines:
         line = line.strip()
-        if status == 0 and line == "# Symbols:":
+        if status == 0 and (re.match('^\s*Address\s*Size\s*Align\s*Out\s*In\s*Symbol\s*$', line) \
+            or line == "# Symbols:"):
             status = 1
             continue
         if status == 1 and len(line) != 0:
-- 
2.16.2.windows.1


             reply	other threads:[~2019-11-01  6:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-01  6:27 Zhiguang Liu [this message]
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
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=20191101062702.165544-1-zhiguang.liu@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