[compiler-rt] Allow nm program to be over-ridden for global symbol detection

Summary:
While cross-compiling, a custom nm program may be required. This will also allow for the
use of llvm-nm if desired.

Reviewers: samsonov, beanz, compnerd, eugenis

Subscribers: kubabrecka, dberris, llvm-commits

Differential Revision: https://reviews.llvm.org/D23278

llvm-svn: 278187
This commit is contained in:
Francis Ricci 2016-08-10 00:45:30 +00:00
parent 021eba31dd
commit 81378e46bb
1 changed files with 3 additions and 2 deletions

View File

@ -42,11 +42,12 @@ versioned_functions = set(['memcpy', 'pthread_attr_getaffinity_np',
def get_global_functions(library):
functions = []
nm_proc = subprocess.Popen(['nm', library], stdout=subprocess.PIPE,
nm = os.environ.get('NM', 'nm')
nm_proc = subprocess.Popen([nm, library], stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
nm_out = nm_proc.communicate()[0].decode().split('\n')
if nm_proc.returncode != 0:
raise subprocess.CalledProcessError(nm_proc.returncode, 'nm')
raise subprocess.CalledProcessError(nm_proc.returncode, nm)
func_symbols = ['T', 'W']
# On PowerPC, nm prints function descriptors from .data section.
if os.uname()[4] in ["powerpc", "ppc64"]: