summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/GenPatchPcdTable
diff options
context:
space:
mode:
authorYonghong Zhu <yonghong.zhu@intel.com>2017-11-02 13:15:34 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2017-11-03 14:30:49 +0800
commit14239ee0770fdbb1d69f1e3f5f70b8df30de1895 (patch)
treef47c0533ec54c0d6f52084186283e7a8d8f39dcd /BaseTools/Source/Python/GenPatchPcdTable
parent631ffb70ebbe78b6e3f342b7ad9ab9b75f8796ae (diff)
downloadedk2-14239ee0770fdbb1d69f1e3f5f70b8df30de1895.tar.gz
edk2-14239ee0770fdbb1d69f1e3f5f70b8df30de1895.tar.bz2
edk2-14239ee0770fdbb1d69f1e3f5f70b8df30de1895.zip
BaseTools: parse map file generated by Xcode on Mac
Add support to parse map file generated by Xcode on Mac to get variable offset and Patchable Pcd info in current EFI file. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/GenPatchPcdTable')
-rw-r--r--BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py b/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py
index 4452fac040..fdad5a44dc 100644
--- a/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py
+++ b/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py
@@ -5,7 +5,7 @@
# PCD Name Offset in binary
# ======== ================
#
-# Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
@@ -58,8 +58,25 @@ def parsePcdInfoFromMapFile(mapfilepath, 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 _parseGeneral(lines, efifilepath)
+def _parseForXcode(lines, efifilepath):
+ status = 0
+ pcds = []
+ for index, line in enumerate(lines):
+ line = line.strip()
+ if status == 0 and line == "# Symbols:":
+ status = 1
+ continue
+ if status == 1 and len(line) != 0:
+ if '_gPcd_BinaryPatch_' in line:
+ m = re.match('^([\da-fA-FxX]+)([\s\S]*)([_]*_gPcd_BinaryPatch_([\w]+))', line)
+ if m != None:
+ pcds.append((m.groups(0)[3], int(m.groups(0)[0], 16)))
+ return pcds
+
def _parseForGCC(lines, efifilepath):
""" Parse map file generated by GCC linker """
status = 0