diff options
author | 2019-03-20 15:10:03 +0800 | |
---|---|---|
committer | 2019-03-20 15:24:00 +0800 | |
commit | 99cdf5385db1807a16da562321b87e8960b9eb22 (patch) | |
tree | 52ecc5996d185714daa601a85a6a3d6f962c0682 /tools/check_elf_file.py | |
parent | 88e38f01babb6adecff3b11c207e904bfebc98a0 (diff) |
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
Diffstat (limited to 'tools/check_elf_file.py')
-rwxr-xr-x | tools/check_elf_file.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/tools/check_elf_file.py b/tools/check_elf_file.py index 38c1cf4264..de855c6a7e 100755 --- a/tools/check_elf_file.py +++ b/tools/check_elf_file.py @@ -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) |