aboutsummaryrefslogtreecommitdiff
path: root/contrib/devtools/symbol-check.py
diff options
context:
space:
mode:
authorCarl Dong <contact@carldong.me>2021-01-21 13:52:40 -0500
committerfanquake <fanquake@gmail.com>2021-07-07 19:31:37 +0800
commit9fdc8afe117b7b1ea845f8acae9e831922b8f92b (patch)
treea8add8f24a05ac933e831d16e1b798259eabfd8f /contrib/devtools/symbol-check.py
parentbda62eab38c5dd74e222eddedbca19ace9df6daa (diff)
downloadbitcoin-9fdc8afe117b7b1ea845f8acae9e831922b8f92b.tar.xz
devtools: Improve *-check.py tool detection
This is important to make sure that we're not testing tools different from the one we're building with. Introduce determine_wellknown_cmd, which encapsulates how we should handle well-known tools specification (IFS splitting, env override, etc.).
Diffstat (limited to 'contrib/devtools/symbol-check.py')
-rwxr-xr-xcontrib/devtools/symbol-check.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/contrib/devtools/symbol-check.py b/contrib/devtools/symbol-check.py
index 407c0a2d72..61f727fa63 100755
--- a/contrib/devtools/symbol-check.py
+++ b/contrib/devtools/symbol-check.py
@@ -12,12 +12,13 @@ Example usage:
'''
import subprocess
import sys
-import os
from typing import List, Optional
import lief
import pixie
+from utils import determine_wellknown_cmd
+
# Debian 8 (Jessie) EOL: 2020. https://wiki.debian.org/DebianReleases#Production_Releases
#
# - g++ version 4.9.2 (https://packages.debian.org/search?suite=jessie&arch=any&searchon=names&keywords=g%2B%2B)
@@ -60,7 +61,6 @@ IGNORE_EXPORTS = {
'_edata', '_end', '__end__', '_init', '__bss_start', '__bss_start__', '_bss_end__', '__bss_end__', '_fini', '_IO_stdin_used', 'stdin', 'stdout', 'stderr',
'environ', '_environ', '__environ',
}
-CPPFILT_CMD = os.getenv('CPPFILT', '/usr/bin/c++filt')
# Allowed NEEDED libraries
ELF_ALLOWED_LIBRARIES = {
@@ -140,7 +140,7 @@ class CPPFilt(object):
Use a pipe to the 'c++filt' command.
'''
def __init__(self):
- self.proc = subprocess.Popen(CPPFILT_CMD, stdin=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=True)
+ self.proc = subprocess.Popen(determine_wellknown_cmd('CPPFILT', 'c++filt'), stdin=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=True)
def __call__(self, mangled):
self.proc.stdin.write(mangled + '\n')