Skip to content

Commit

Permalink
fix: adding -P flag for nm usage
Browse files Browse the repository at this point in the history
  • Loading branch information
vibhatha committed Apr 15, 2024
1 parent 32a2961 commit 257aea1
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions dev/archery/archery/linking.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ def list_dependency_names(self):
names.append(name)
return names

def _extract_symbols(self, symbol_info):
return [re.search(r'\S+$', line).group() for line in symbol_info if line]

def _remove_weak_symbols(self, symbol_info):
return [line for line in symbol_info if not re.search(r'\s[Ww]\s', line)]

Expand All @@ -78,18 +75,16 @@ def list_symbols_for_dependency(self, dependency, remove_symbol_versions=False):
if dependency == 'linux-vdso.so.1':
# this is a virtual library, thus symbols cannot be listed
return []
result = _nm.run('-D', dependency, stdout=subprocess.PIPE)
result = _nm.run('-D', '-P', dependency, stdout=subprocess.PIPE)
lines = result.stdout.decode('utf-8').splitlines()
lines = self._capture_symbols(remove_symbol_versions, lines)
return self._extract_symbols(lines)
return self._capture_symbols(remove_symbol_versions, lines)

def list_undefined_symbols_for_dependency(self, dependency,
remove_symbol_versions=False):
result = _nm.run('-u', dependency, stdout=subprocess.PIPE)
result = _nm.run('-u', '-P', dependency, stdout=subprocess.PIPE)
lines = result.stdout.decode('utf-8').splitlines()
lines = self._capture_symbols(remove_symbol_versions, lines)
lines = self._remove_weak_symbols(lines)
return self._extract_symbols(lines)
return self._remove_weak_symbols(lines)

def extract_library_paths(self, file_path):
system = platform.system()
Expand Down

0 comments on commit 257aea1

Please sign in to comment.