3 # This file is part of PulseAudio.
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.
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.
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with PulseAudio; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 import sys
, os
, string
25 for fn
in sys
.argv
[1:]:
26 f
= os
.popen("nm '%s'" % fn
, "r")
28 imported_symbols
[fn
] = []
31 sym_address
= line
[:7].strip()
32 sym_type
= line
[9].strip()
33 sym_name
= line
[11:].strip()
35 if sym_name
in ('_fini', '_init'):
38 if sym_type
in ('T', 'B', 'R', 'D' 'G', 'S', 'D'):
39 if exported_symbols
.has_key(sym_name
):
40 sys
.stderr
.write("CONFLICT: %s defined in both '%s' and '%s'.\n" % (sym_name
, fn
, exported_symbols
[sym_name
]))
42 exported_symbols
[sym_name
] = fn
43 elif sym_type
in ('U',):
44 if sym_name
[:3] == 'pa_':
45 imported_symbols
[fn
].append(sym_name
)
50 unresolved_symbols
= {}
52 for fn
in imported_symbols
:
55 for sym
in imported_symbols
[fn
]:
56 if exported_symbols
.has_key(sym
):
57 if exported_symbols
[sym
] not in dependencies
[fn
]:
58 dependencies
[fn
].append(exported_symbols
[sym
])
60 if unresolved_symbols
.has_key(sym
):
61 unresolved_symbols
[sym
].append(fn
)
63 unresolved_symbols
[sym
] = [fn
]
65 for sym
, files
in unresolved_symbols
.iteritems():
66 print "WARNING: Unresolved symbol '%s' in %s" % (sym
, `files`
)
68 k
= dependencies
.keys()
71 dependencies
[fn
].sort()
72 print "%s: %s" % (fn
, string
.join(dependencies
[fn
], " "))