]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Add map file parsing support for CLANG9
authorZhiguang Liu <zhiguang.liu@intel.com>
Tue, 29 Oct 2019 05:07:44 +0000 (13:07 +0800)
committerLiming Gao <liming.gao@intel.com>
Fri, 8 Nov 2019 00:29:36 +0000 (08:29 +0800)
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
BaseTools/Source/Python/Common/Misc.py
BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py

index a488536cb453ba1c532c5528b7d6cc0bad7f0b5a..da5fb380f0354d6e885aa716d2c9b2fead249d63 100755 (executable)
@@ -81,19 +81,22 @@ def GetVariableOffset(mapfilepath, efifilepath, varnames):
 \r
     if len(lines) == 0: return None\r
     firstline = lines[0].strip()\r
+    if re.match('^\s*Address\s*Size\s*Align\s*Out\s*In\s*Symbol\s*$', firstline):\r
+        return _parseForXcodeAndClang9(lines, efifilepath, varnames)\r
     if (firstline.startswith("Archive member included ") and\r
         firstline.endswith(" file (symbol)")):\r
         return _parseForGCC(lines, efifilepath, varnames)\r
     if firstline.startswith("# Path:"):\r
-        return _parseForXcode(lines, efifilepath, varnames)\r
+        return _parseForXcodeAndClang9(lines, efifilepath, varnames)\r
     return _parseGeneral(lines, efifilepath, varnames)\r
 \r
-def _parseForXcode(lines, efifilepath, varnames):\r
+def _parseForXcodeAndClang9(lines, efifilepath, varnames):\r
     status = 0\r
     ret = []\r
     for line in lines:\r
         line = line.strip()\r
-        if status == 0 and line == "# Symbols:":\r
+        if status == 0 and (re.match('^\s*Address\s*Size\s*Align\s*Out\s*In\s*Symbol\s*$', line) \\r
+            or line == "# Symbols:"):\r
             status = 1\r
             continue\r
         if status == 1 and len(line) != 0:\r
index 7d5e4fc34a3e4ce514923bdbc922c2e6b1755510..d962ab0adda73f9e0e3a5edaff32384dd3c3fcb3 100644 (file)
@@ -49,20 +49,23 @@ def parsePcdInfoFromMapFile(mapfilepath, efifilepath):
 \r
     if len(lines) == 0: return None\r
     firstline = lines[0].strip()\r
+    if re.match('^\s*Address\s*Size\s*Align\s*Out\s*In\s*Symbol\s*$', firstline):\r
+        return _parseForXcodeAndClang9(lines, efifilepath)\r
     if (firstline.startswith("Archive member included ") and\r
         firstline.endswith(" file (symbol)")):\r
         return _parseForGCC(lines, efifilepath)\r
     if firstline.startswith("# Path:"):\r
-        return _parseForXcode(lines, efifilepath)\r
+        return _parseForXcodeAndClang9(lines, efifilepath)\r
     return _parseGeneral(lines, efifilepath)\r
 \r
-def _parseForXcode(lines, efifilepath):\r
+def _parseForXcodeAndClang9(lines, efifilepath):\r
     valuePattern = re.compile('^([\da-fA-FxX]+)([\s\S]*)([_]*_gPcd_BinaryPatch_([\w]+))')\r
     status = 0\r
     pcds = []\r
     for line in lines:\r
         line = line.strip()\r
-        if status == 0 and line == "# Symbols:":\r
+        if status == 0 and (re.match('^\s*Address\s*Size\s*Align\s*Out\s*In\s*Symbol\s*$', line) \\r
+            or line == "# Symbols:"):\r
             status = 1\r
             continue\r
         if status == 1 and len(line) != 0:\r