Update check_elf_file.py for clang-r353983

This commit updates how `check_elf_file.py` parses the symbol name
because the `llvm-readobj` (from clang-r353983) does not print "@" if
the symbol is not versioned.

See also. https://reviews.llvm.org/D56319

Bug: 128959554
Test: CHECK_ELF_FILES=true make check-elf-files
Change-Id: I0dee5e505225e57750a2c86cf0d25a151c218eb1
This commit is contained in:
Logan Chien 2019-03-20 15:10:03 +08:00
parent 88e38f01ba
commit 99cdf5385d
1 changed files with 12 additions and 5 deletions

View File

@ -260,13 +260,20 @@ class ELFParser(object):
_SYMBOL_ENTRY_END_PATTERN = ' }'
@classmethod
def _parse_symbol_name(cls, name_with_version):
@staticmethod
def _parse_symbol_name(name_with_version):
"""Split `name_with_version` into name and version. This function may split
at last occurrence of `@@` or `@`."""
name, version = name_with_version.rsplit('@', 1)
if name and name[-1] == '@':
name = name[:-1]
pos = name_with_version.rfind('@')
if pos == -1:
name = name_with_version
version = ''
else:
if pos > 0 and name_with_version[pos - 1] == '@':
name = name_with_version[0:pos - 1]
else:
name = name_with_version[0:pos]
version = name_with_version[pos + 1:]
return (name, version)