Commit 6ae1e213 authored by Tom Anderson's avatar Tom Anderson Committed by Commit Bot

[Linux sysroot] Workaround nm bug where symbol version gets printed 2x

BUG=1151959
R=penghuang

Change-Id: Iec5d9fa9db757aeb2c478d51dbc88d5804e513e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2553706
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Auto-Submit: Thomas Anderson <thomasanderson@chromium.org>
Reviewed-by: default avatarPeng Huang <penghuang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#830258}
parent a944f7aa
...@@ -16,13 +16,15 @@ MAX_ALLOWED_GLIBC_VERSION = [2, 17] ...@@ -16,13 +16,15 @@ MAX_ALLOWED_GLIBC_VERSION = [2, 17]
def get_replacements(nm_file, max_allowed_glibc_version): def get_replacements(nm_file, max_allowed_glibc_version):
symbol_format = re.compile('\S+ \S+ ([^@]+)@@?(\S+)\n')
version_format = re.compile('GLIBC_[0-9\.]+') version_format = re.compile('GLIBC_[0-9\.]+')
symbols = {} symbols = {}
for line in nm_file: for line in nm_file:
m = re.match(symbol_format, line) # Some versions of nm have a bug where the version gets printed twice.
symbol = m.group(1) # Since the symbol may either be formatted like "name@@VERSION" or
version = m.group(2) # "name@@VERSION@@VERSION", handle both cases.
symver = line.split('@@')
symbol = symver[0].split(' ')[-1]
version = symver[-1]
if not re.match(version_format, version): if not re.match(version_format, version):
continue continue
if symbol in symbols: if symbol in symbols:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment