BaseTools: Add map file parsing support for CLANG9

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>
This commit is contained in:
Zhiguang Liu
2019-10-29 13:07:44 +08:00
committed by Liming Gao
parent 601a18bf08
commit 5cef92771f
2 changed files with 12 additions and 6 deletions

View File

@ -81,19 +81,22 @@ def GetVariableOffset(mapfilepath, efifilepath, varnames):
if len(lines) == 0: return None if len(lines) == 0: return None
firstline = lines[0].strip() 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 if (firstline.startswith("Archive member included ") and
firstline.endswith(" file (symbol)")): firstline.endswith(" file (symbol)")):
return _parseForGCC(lines, efifilepath, varnames) return _parseForGCC(lines, efifilepath, varnames)
if firstline.startswith("# Path:"): if firstline.startswith("# Path:"):
return _parseForXcode(lines, efifilepath, varnames) return _parseForXcodeAndClang9(lines, efifilepath, varnames)
return _parseGeneral(lines, efifilepath, varnames) return _parseGeneral(lines, efifilepath, varnames)
def _parseForXcode(lines, efifilepath, varnames): def _parseForXcodeAndClang9(lines, efifilepath, varnames):
status = 0 status = 0
ret = [] ret = []
for line in lines: for line in lines:
line = line.strip() 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 status = 1
continue continue
if status == 1 and len(line) != 0: if status == 1 and len(line) != 0:

View File

@ -49,20 +49,23 @@ def parsePcdInfoFromMapFile(mapfilepath, efifilepath):
if len(lines) == 0: return None if len(lines) == 0: return None
firstline = lines[0].strip() 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 if (firstline.startswith("Archive member included ") and
firstline.endswith(" file (symbol)")): firstline.endswith(" file (symbol)")):
return _parseForGCC(lines, efifilepath) return _parseForGCC(lines, efifilepath)
if firstline.startswith("# Path:"): if firstline.startswith("# Path:"):
return _parseForXcode(lines, efifilepath) return _parseForXcodeAndClang9(lines, efifilepath)
return _parseGeneral(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]+))') valuePattern = re.compile('^([\da-fA-FxX]+)([\s\S]*)([_]*_gPcd_BinaryPatch_([\w]+))')
status = 0 status = 0
pcds = [] pcds = []
for line in lines: for line in lines:
line = line.strip() 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 status = 1
continue continue
if status == 1 and len(line) != 0: if status == 1 and len(line) != 0: