1#!/usr/bin/python 2 3# This file is part of PulseAudio. 4# 5# PulseAudio is free software; you can redistribute it and/or modify 6# it under the terms of the GNU Lesser General Public License as published by 7# the Free Software Foundation; either version 2 of the License, or 8# (at your option) any later version. 9# 10# PulseAudio is distributed in the hope that it will be useful, but 11# WITHOUT ANY WARRANTY; without even the implied warranty of 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13# General Public License for more details. 14# 15# You should have received a copy of the GNU Lesser General Public License 16# along with PulseAudio; if not, see <http://www.gnu.org/licenses/>. 17 18import sys, os, string 19 20exported_symbols = {} 21imported_symbols = {} 22 23for fn in sys.argv[1:]: 24 f = os.popen("nm '%s'" % fn, "r") 25 26 imported_symbols[fn] = [] 27 28 for line in f: 29 sym_address = line[:7].strip() 30 sym_type = line[9].strip() 31 sym_name = line[11:].strip() 32 33 if sym_name in ('_fini', '_init'): 34 continue 35 36 if sym_type in ('T', 'B', 'R', 'D' 'G', 'S', 'D'): 37 if exported_symbols.has_key(sym_name): 38 sys.stderr.write("CONFLICT: %s defined in both '%s' and '%s'.\n" % (sym_name, fn, exported_symbols[sym_name])) 39 else: 40 exported_symbols[sym_name] = fn 41 elif sym_type in ('U',): 42 if sym_name[:3] == 'pa_': 43 imported_symbols[fn].append(sym_name) 44 45 f.close() 46 47dependencies = {} 48unresolved_symbols = {} 49 50for fn in imported_symbols: 51 dependencies[fn] = [] 52 53 for sym in imported_symbols[fn]: 54 if exported_symbols.has_key(sym): 55 if exported_symbols[sym] not in dependencies[fn]: 56 dependencies[fn].append(exported_symbols[sym]) 57 else: 58 if unresolved_symbols.has_key(sym): 59 unresolved_symbols[sym].append(fn) 60 else: 61 unresolved_symbols[sym] = [fn] 62 63for sym, files in unresolved_symbols.iteritems(): 64 print "WARNING: Unresolved symbol '%s' in %s" % (sym, `files`) 65 66k = dependencies.keys() 67k.sort() 68for fn in k: 69 dependencies[fn].sort() 70 print "%s: %s" % (fn, string.join(dependencies[fn], " ")) 71