4 # This file is part of polypaudio.
6 # polypaudio is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU Lesser General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # polypaudio is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public License
17 # along with polypaudio; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 import sys, os, string
26 for fn in sys.argv[1:]:
27 f = os.popen("nm '%s'" % fn, "r")
29 imported_symbols[fn] = []
32 sym_address = line[:7].strip()
33 sym_type = line[9].strip()
34 sym_name = line[11:].strip()
36 if sym_name in ('_fini', '_init'):
39 if sym_type in ('T', 'B', 'R', 'D' 'G', 'S', 'D'):
40 if exported_symbols.has_key(sym_name):
41 sys.stderr.write("CONFLICT: %s defined in both '%s' and '%s'.\n" % (sym_name, fn, exported_symbols[sym_name]))
43 exported_symbols[sym_name] = fn
44 elif sym_type in ('U',):
45 if sym_name[:3] == 'pa_':
46 imported_symbols[fn].append(sym_name)
51 unresolved_symbols = {}
53 for fn in imported_symbols:
56 for sym in imported_symbols[fn]:
57 if exported_symbols.has_key(sym):
58 if exported_symbols[sym] not in dependencies[fn]:
59 dependencies[fn].append(exported_symbols[sym])
61 if unresolved_symbols.has_key(sym):
62 unresolved_symbols[sym].append(fn)
64 unresolved_symbols[sym] = [fn]
66 for sym, files in unresolved_symbols.iteritems():
67 print "WARNING: Unresolved symbol '%s' in %s" % (sym, `files`)
69 k = dependencies.keys()
72 dependencies[fn].sort()
73 print "%s: %s" % (fn, string.join(dependencies[fn], " "))