17 result = subprocess.run(
18 [
"nm",
"-DCUW",
"--format=sysv", str(shared_library)],
22 output = result.stdout
23 lines_split = (line.split(
"|")
for line
in output.splitlines()
if "|" in line)
27 return set([line[0].strip()
for line
in lines_split
if line[2].strip().isupper()])
30 if __name__ ==
"__main__":
31 parser = argparse.ArgumentParser(
33 description=
"Find common dynamics public symbols between shared libraries.",
35 parser.add_argument(
"shared_libraries", nargs=
"+", type=pathlib.Path)
37 args = parser.parse_args()
40 for shared_library
in args.shared_libraries
43 for lib1, lib2
in itertools.combinations(symbols, 2):
44 print(f
"Common symbols between {lib1[0]} and {lib2[0]}")
45 common_symbols = lib1[1].intersection(lib2[1])
46 for common
in common_symbols: