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>
(cherry picked from commit 14239ee077)
This commit is contained in:
Yonghong Zhu
2017-11-02 13:15:34 +08:00
committed by Liming Gao
parent 3ce826f8df
commit 3b4c8c5f97
2 changed files with 36 additions and 1 deletions

View File

@ -67,8 +67,26 @@ def GetVariableOffset(mapfilepath, 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 _parseGeneral(lines, efifilepath, varnames)
def _parseForXcode(lines, efifilepath, varnames):
status = 0
ret = []
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:
for varname in varnames:
if varname in line:
m = re.match('^([\da-fA-FxX]+)([\s\S]*)([_]*%s)$' % varname, line)
if m != None:
ret.append((varname, m.group(1)))
return ret
def _parseForGCC(lines, efifilepath, varnames):
""" Parse map file generated by GCC linker """
status = 0